Various fixes after code review

Minimum required Qt lowered to 5.5.0
Added CI for Qt 5.5.1 build
Increased C++ standard to C++14
Fixed use of spaces instead of tabs
Removed duplicate constructors
This commit is contained in:
Luca Beldi 2019-01-25 16:28:36 +00:00
parent ee616c2541
commit e113790bbe
12 changed files with 54 additions and 45 deletions

View File

@ -8,6 +8,30 @@ git:
matrix:
fast_finish: true
include:
- name: Ubuntu qmake Qt5.5.1
os: linux
dist: trusty
group: stable
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- sourceline: 'ppa:beineri/opt-qt551-trusty'
update: true
packages:
- qt55base
- qt55tools
- gcc-6
- g++-6
- libc6-i386
script:
- PATH="/opt/qt55/bin:$PATH"
- CXX="g++-6"
- CC="gcc-6"
- qt55-env.sh
- qmake
- make
- make install
- name: Ubuntu qmake dll
os: linux
dist: xenial

View File

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.3)
set(ads_VERSION "2.3.2")
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_AUTOMOC ON)
@ -8,7 +8,7 @@ set(CMAKE_AUTORCC ON)
project(QtAdvancedDockingSystem VERSION ${ads_VERSION})
option(BUILD_STATIC "Build the static library" OFF)
option(BUILD_EXAMPLES "Build the examples" ON)
set(REQUIRED_QT_VERSION 5.7.0)
set(REQUIRED_QT_VERSION 5.5.0)
find_package(Qt5Core ${REQUIRED_QT_VERSION} REQUIRED)
find_package(Qt5Gui ${REQUIRED_QT_VERSION} REQUIRED)
find_package(Qt5Widgets ${REQUIRED_QT_VERSION} REQUIRED)

View File

@ -1,12 +1,12 @@
cmake_minimum_required(VERSION 3.3)
set (CMAKE_CXX_STANDARD 11)
set (CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
project(ads_demo VERSION "1.0")
set(REQUIRED_QT_VERSION 5.7.0)
set(REQUIRED_QT_VERSION 5.5.0)
find_package(Qt5Core ${REQUIRED_QT_VERSION} REQUIRED)
find_package(Qt5Gui ${REQUIRED_QT_VERSION} REQUIRED)
find_package(Qt5Widgets ${REQUIRED_QT_VERSION} REQUIRED)

View File

@ -3,7 +3,7 @@ ADS_OUT_ROOT = $${OUT_PWD}/..
TARGET = AdvancedDockingSystemDemo
DESTDIR = $${ADS_OUT_ROOT}/lib
QT += core gui widgets
CONFIG += c++11
CONFIG += c++14
CONFIG += debug_and_release
DEFINES += QT_DEPRECATED_WARNINGS

View File

@ -1,11 +1,11 @@
cmake_minimum_required(VERSION 3.3)
set (CMAKE_CXX_STANDARD 11)
set (CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
project(ads_example VERSION "1.0")
set(REQUIRED_QT_VERSION 5.7.0)
set(REQUIRED_QT_VERSION 5.5.0)
find_package(Qt5Core ${REQUIRED_QT_VERSION} REQUIRED)
find_package(Qt5Gui ${REQUIRED_QT_VERSION} REQUIRED)
find_package(Qt5Widgets ${REQUIRED_QT_VERSION} REQUIRED)

View File

@ -5,7 +5,7 @@ QT += core gui widgets
TARGET = Example1
DESTDIR = $${ADS_OUT_ROOT}/lib
TEMPLATE = app
CONFIG += c++11
CONFIG += c++14
CONFIG += debug_and_release
adsBuildStatic {
DEFINES += ADS_STATIC

View File

@ -98,7 +98,7 @@ public:
*/
void insertWidget(int index, QWidget* Widget)
{
Widget->setParent(nullptr);
Widget->setParent(nullptr);
if (index < 0)
{
index = m_Widgets.count();
@ -127,7 +127,7 @@ public:
auto LayoutItem = m_ParentLayout->takeAt(1);
if (LayoutItem)
{
LayoutItem->widget()->setParent(nullptr);
LayoutItem->widget()->setParent(nullptr);
}
m_CurrentWidget = nullptr;
m_CurrentIndex = -1;
@ -167,7 +167,7 @@ public:
auto LayoutItem = m_ParentLayout->takeAt(1);
if (LayoutItem)
{
LayoutItem->widget()->setParent(nullptr);
LayoutItem->widget()->setParent(nullptr);
}
m_ParentLayout->addWidget(next);
@ -315,9 +315,9 @@ void DockAreaWidgetPrivate::createTitleBar()
{
TitleBar = new CDockAreaTitleBar(_this);
Layout->addWidget(TitleBar);
QObject::connect(tabBar(), &CDockAreaTabBar::tabCloseRequested, _this, &CDockAreaWidget::onTabCloseRequested);
QObject::connect(TitleBar, &CDockAreaTitleBar::tabBarClicked, _this, &CDockAreaWidget::setCurrentIndex);
QObject::connect(tabBar(), &CDockAreaTabBar::tabMoved, _this, &CDockAreaWidget::reorderDockWidget);
QObject::connect(tabBar(), &CDockAreaTabBar::tabCloseRequested, _this, &CDockAreaWidget::onTabCloseRequested);
QObject::connect(TitleBar, &CDockAreaTitleBar::tabBarClicked, _this, &CDockAreaWidget::setCurrentIndex);
QObject::connect(tabBar(), &CDockAreaTabBar::tabMoved, _this, &CDockAreaWidget::reorderDockWidget);
}

View File

@ -127,7 +127,7 @@ public:
QGridLayout* Layout = nullptr;
QSplitter* RootSplitter = nullptr;
bool isFloating = false;
CDockAreaWidget* LastAddedAreaCache[5];
CDockAreaWidget* LastAddedAreaCache[5];
int VisibleDockAreaCount = -1;
CDockAreaWidget* TopLevelDockArea = nullptr;
@ -266,7 +266,7 @@ public:
/**
* Helper function for creation of new splitter
*/
CDockSplitter* newSplitter(Qt::Orientation orientation, QWidget* parent = nullptr)
CDockSplitter* newSplitter(Qt::Orientation orientation, QWidget* parent = nullptr)
{
CDockSplitter* s = new CDockSplitter(orientation, parent);
s->setOpaqueResize(DockManager->configFlags().testFlag(CDockManager::OpaqueSplitterResize));
@ -290,7 +290,7 @@ public:
DockContainerWidgetPrivate::DockContainerWidgetPrivate(CDockContainerWidget* _public) :
_this(_public)
{
std::fill(std::begin(LastAddedAreaCache),std::end(LastAddedAreaCache), nullptr);
std::fill(std::begin(LastAddedAreaCache),std::end(LastAddedAreaCache), nullptr);
}
@ -540,10 +540,10 @@ void DockContainerWidgetPrivate::appendDockAreas(const QList<CDockAreaWidget*> N
DockAreas.append(NewDockAreas);
for (auto DockArea : NewDockAreas)
{
QObject::connect(DockArea,
&CDockAreaWidget::viewToggled,
_this,
std::bind(&DockContainerWidgetPrivate::onDockAreaViewToggled, this, std::placeholders::_1));
QObject::connect(DockArea,
&CDockAreaWidget::viewToggled,
_this,
std::bind(&DockContainerWidgetPrivate::onDockAreaViewToggled, this, std::placeholders::_1));
}
}
@ -613,7 +613,7 @@ bool DockContainerWidgetPrivate::restoreSplitter(QXmlStreamReader& s,
QSplitter* Splitter = nullptr;
if (!Testing)
{
Splitter = newSplitter(static_cast<Qt::Orientation>(Orientation));
Splitter = newSplitter(static_cast<Qt::Orientation>(Orientation));
}
bool Visible = false;
QList<int> Sizes;
@ -1054,7 +1054,7 @@ void CDockContainerWidget::removeDockArea(CDockAreaWidget* area)
// Remove are from parent splitter and recursively hide tree of parent
// splitters if it has no visible content
area->setParent(nullptr);
area->setParent(nullptr);
internal::hideEmptyParentSplitters(Splitter);
// If splitter has more than 1 widgets, we are finished and can leave
@ -1085,7 +1085,7 @@ void CDockContainerWidget::removeDockArea(CDockAreaWidget* area)
}
// We replace the superfluous RootSplitter with the ChildSplitter
ChildSplitter->setParent(nullptr);
ChildSplitter->setParent(nullptr);
QLayoutItem* li = d->Layout->replaceWidget(Splitter, ChildSplitter);
d->RootSplitter = ChildSplitter;
delete li;
@ -1126,14 +1126,14 @@ CDockAreaWidget* CDockContainerWidget::dockAreaAt(const QPoint& GlobalPos) const
}
}
return nullptr;
return nullptr;
}
//============================================================================
CDockAreaWidget* CDockContainerWidget::dockArea(int Index) const
{
return (Index < dockAreaCount()) ? d->DockAreas[Index] : nullptr;
return (Index < dockAreaCount()) ? d->DockAreas[Index] : nullptr;
}

View File

@ -72,7 +72,7 @@ struct DockManagerPrivate
QMenu* ViewMenu;
CDockManager::eViewMenuInsertionOrder MenuInsertionOrder = CDockManager::MenuAlphabeticallySorted;
bool RestoringState = false;
CDockManager::ConfigFlags ConfigFlags = CDockManager::DefaultConfig;
CDockManager::ConfigFlags ConfigFlags = CDockManager::DefaultConfig;
/**
* Private data constructor

View File

@ -44,7 +44,7 @@ namespace internal
void replaceSplitterWidget(QSplitter* Splitter, QWidget* From, QWidget* To)
{
int index = Splitter->indexOf(From);
From->setParent(nullptr);
From->setParent(nullptr);
Splitter->insertWidget(index, To);
}
@ -90,18 +90,6 @@ void hideEmptyParentSplitters(CDockSplitter* Splitter)
}
}
CDockInsertParam::CDockInsertParam(Qt::Orientation orient, bool bottomRight)
: QPair<Qt::Orientation, bool>(orient,bottomRight)
{}
CDockInsertParam::CDockInsertParam(const CDockInsertParam &p)
: QPair<Qt::Orientation, bool>(p)
{}
CDockInsertParam::CDockInsertParam(CDockInsertParam &&p)
: QPair<Qt::Orientation, bool>(std::move(p))
{}
} // namespace internal
} // namespace ads

View File

@ -110,10 +110,7 @@ void hideEmptyParentSplitters(CDockSplitter* FirstParentSplitter);
class CDockInsertParam : public QPair<Qt::Orientation, bool>
{
public:
CDockInsertParam() = default;
CDockInsertParam(Qt::Orientation orient, bool append);
CDockInsertParam(const CDockInsertParam &p);
CDockInsertParam(CDockInsertParam &&p);
using QPair::QPair;
Qt::Orientation orientation() const {return this->first;}
bool append() const {return this->second;}
int insertOffset() const {return append() ? 1 : 0;}

View File

@ -1,5 +1,5 @@
ADS_OUT_ROOT = $${OUT_PWD}/..
CONFIG += c++11
CONFIG += c++14
CONFIG += debug_and_release
TARGET = $$qtLibraryTarget(qtadvanceddocking)
DEFINES += QT_DEPRECATED_WARNINGS