Skip to content

Commit b7a5918

Browse files
committed
Fixed project files
Fixed compilation on compilers that do not support C++14 Only 2 minor places required C++14, no need to impose it
1 parent ddfa6c2 commit b7a5918

File tree

7 files changed

+38
-32
lines changed

7 files changed

+38
-32
lines changed

src/DockAreaWidget.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class CDockAreaLayout
9898
*/
9999
void insertWidget(int index, QWidget* Widget)
100100
{
101-
Widget->setParent(0);
101+
Widget->setParent(nullptr);
102102
if (index < 0)
103103
{
104104
index = m_Widgets.count();
@@ -127,7 +127,7 @@ class CDockAreaLayout
127127
auto LayoutItem = m_ParentLayout->takeAt(1);
128128
if (LayoutItem)
129129
{
130-
LayoutItem->widget()->setParent(0);
130+
LayoutItem->widget()->setParent(nullptr);
131131
}
132132
m_CurrentWidget = nullptr;
133133
m_CurrentIndex = -1;
@@ -167,7 +167,7 @@ class CDockAreaLayout
167167
auto LayoutItem = m_ParentLayout->takeAt(1);
168168
if (LayoutItem)
169169
{
170-
LayoutItem->widget()->setParent(0);
170+
LayoutItem->widget()->setParent(nullptr);
171171
}
172172

173173
m_ParentLayout->addWidget(next);
@@ -315,12 +315,9 @@ void DockAreaWidgetPrivate::createTitleBar()
315315
{
316316
TitleBar = new CDockAreaTitleBar(_this);
317317
Layout->addWidget(TitleBar);
318-
_this->connect(tabBar(), SIGNAL(tabCloseRequested(int)),
319-
SLOT(onTabCloseRequested(int)));
320-
_this->connect(TitleBar, SIGNAL(tabBarClicked(int)),
321-
SLOT(setCurrentIndex(int)));
322-
_this->connect(tabBar(), SIGNAL(tabMoved(int, int)),
323-
SLOT(reorderDockWidget(int, int)));
318+
QObject::connect(tabBar(), &CDockAreaTabBar::tabCloseRequested, _this, &CDockAreaWidget::onTabCloseRequested);
319+
QObject::connect(TitleBar, &CDockAreaTitleBar::tabBarClicked, _this, &CDockAreaWidget::setCurrentIndex);
320+
QObject::connect(tabBar(), &CDockAreaTabBar::tabMoved, _this, &CDockAreaWidget::reorderDockWidget);
324321
}
325322

326323

src/DockContainerWidget.cpp

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
#include "ads_globals.h"
4848
#include "DockSplitter.h"
4949

50+
#include <functional>
5051
#include <iostream>
5152

5253
#if QT_VERSION < 0x050900
@@ -64,7 +65,7 @@ QByteArray qByteArrayToHex(const QByteArray& src, char separator)
6465
const int length = separator ? (src.size() * 3 - 1) : (src.size() * 2);
6566
QByteArray hex(length, Qt::Uninitialized);
6667
char *hexData = hex.data();
67-
const uchar *data = (const uchar *)src.data();
68+
const uchar *data = reinterpret_cast<const uchar *>(src.data());
6869
for (int i = 0, o = 0; i < src.size(); ++i) {
6970
hexData[o++] = toHexLower(data[i] >> 4);
7071
hexData[o++] = toHexLower(data[i] & 0xf);
@@ -96,8 +97,6 @@ static int areaIdToIndex(DockWidgetArea area)
9697
default:
9798
return 4;
9899
}
99-
100-
return 4;
101100
}
102101

103102
/**
@@ -128,7 +127,7 @@ class DockContainerWidgetPrivate
128127
QGridLayout* Layout = nullptr;
129128
QSplitter* RootSplitter = nullptr;
130129
bool isFloating = false;
131-
CDockAreaWidget* LastAddedAreaCache[5]{0, 0, 0, 0, 0};
130+
CDockAreaWidget* LastAddedAreaCache[5];
132131
int VisibleDockAreaCount = -1;
133132
CDockAreaWidget* TopLevelDockArea = nullptr;
134133

@@ -267,7 +266,7 @@ class DockContainerWidgetPrivate
267266
/**
268267
* Helper function for creation of new splitter
269268
*/
270-
CDockSplitter* newSplitter(Qt::Orientation orientation, QWidget* parent = 0)
269+
CDockSplitter* newSplitter(Qt::Orientation orientation, QWidget* parent = nullptr)
271270
{
272271
CDockSplitter* s = new CDockSplitter(orientation, parent);
273272
s->setOpaqueResize(DockManager->configFlags().testFlag(CDockManager::OpaqueSplitterResize));
@@ -291,7 +290,7 @@ class DockContainerWidgetPrivate
291290
DockContainerWidgetPrivate::DockContainerWidgetPrivate(CDockContainerWidget* _public) :
292291
_this(_public)
293292
{
294-
293+
std::fill(std::begin(LastAddedAreaCache),std::end(LastAddedAreaCache), nullptr);
295294
}
296295

297296

@@ -541,7 +540,10 @@ void DockContainerWidgetPrivate::appendDockAreas(const QList<CDockAreaWidget*> N
541540
DockAreas.append(NewDockAreas);
542541
for (auto DockArea : NewDockAreas)
543542
{
544-
_this->connect(DockArea, SIGNAL(viewToggled(bool)), SLOT(onDockAreaViewToggled(bool)));
543+
QObject::connect(DockArea,
544+
&CDockAreaWidget::viewToggled,
545+
_this,
546+
std::bind(&DockContainerWidgetPrivate::onDockAreaViewToggled, this, std::placeholders::_1));
545547
}
546548
}
547549

@@ -611,7 +613,7 @@ bool DockContainerWidgetPrivate::restoreSplitter(QXmlStreamReader& s,
611613
QSplitter* Splitter = nullptr;
612614
if (!Testing)
613615
{
614-
Splitter = newSplitter((Qt::Orientation)Orientation);
616+
Splitter = newSplitter(static_cast<Qt::Orientation>(Orientation));
615617
}
616618
bool Visible = false;
617619
QList<int> Sizes;
@@ -1052,7 +1054,7 @@ void CDockContainerWidget::removeDockArea(CDockAreaWidget* area)
10521054

10531055
// Remove are from parent splitter and recursively hide tree of parent
10541056
// splitters if it has no visible content
1055-
area->setParent(0);
1057+
area->setParent(nullptr);
10561058
internal::hideEmptyParentSplitters(Splitter);
10571059

10581060
// If splitter has more than 1 widgets, we are finished and can leave
@@ -1083,7 +1085,7 @@ void CDockContainerWidget::removeDockArea(CDockAreaWidget* area)
10831085
}
10841086

10851087
// We replace the superfluous RootSplitter with the ChildSplitter
1086-
ChildSplitter->setParent(0);
1088+
ChildSplitter->setParent(nullptr);
10871089
QLayoutItem* li = d->Layout->replaceWidget(Splitter, ChildSplitter);
10881090
d->RootSplitter = ChildSplitter;
10891091
delete li;
@@ -1124,14 +1126,14 @@ CDockAreaWidget* CDockContainerWidget::dockAreaAt(const QPoint& GlobalPos) const
11241126
}
11251127
}
11261128

1127-
return 0;
1129+
return nullptr;
11281130
}
11291131

11301132

11311133
//============================================================================
11321134
CDockAreaWidget* CDockContainerWidget::dockArea(int Index) const
11331135
{
1134-
return (Index < dockAreaCount()) ? d->DockAreas[Index] : 0;
1136+
return (Index < dockAreaCount()) ? d->DockAreas[Index] : nullptr;
11351137
}
11361138

11371139

@@ -1465,6 +1467,5 @@ void CDockContainerWidget::closeOtherAreas(CDockAreaWidget* KeepOpenArea)
14651467

14661468
} // namespace ads
14671469

1468-
#include "moc_DockContainerWidget.cpp"
14691470
//---------------------------------------------------------------------------
14701471
// EOF DockContainerWidget.cpp

src/DockContainerWidget.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ class ADS_EXPORT CDockContainerWidget : public QFrame
6565
friend class CFloatingDockContainer;
6666
friend struct FloatingDockContainerPrivate;
6767
friend class CDockWidget;
68-
Q_PRIVATE_SLOT(d, void onDockAreaViewToggled(bool Visible))
69-
7068
protected:
7169
/**
7270
* Handles activation events to update zOrderIndex

src/DockManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ struct DockManagerPrivate
7272
QMenu* ViewMenu;
7373
CDockManager::eViewMenuInsertionOrder MenuInsertionOrder = CDockManager::MenuAlphabeticallySorted;
7474
bool RestoringState = false;
75-
CDockManager::ConfigFlags ConfigFlags{CDockManager::DefaultConfig};
75+
CDockManager::ConfigFlags ConfigFlags = CDockManager::DefaultConfig;
7676

7777
/**
7878
* Private data constructor

src/ads_globals.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ namespace internal
4444
void replaceSplitterWidget(QSplitter* Splitter, QWidget* From, QWidget* To)
4545
{
4646
int index = Splitter->indexOf(From);
47-
From->setParent(0);
47+
From->setParent(nullptr);
4848
Splitter->insertWidget(index, To);
4949
}
5050

@@ -90,6 +90,17 @@ void hideEmptyParentSplitters(CDockSplitter* Splitter)
9090
}
9191
}
9292

93+
CDockInsertParam::CDockInsertParam(Qt::Orientation orient, bool bottomRight)
94+
: QPair<Qt::Orientation, bool>(orient,bottomRight)
95+
{}
96+
97+
CDockInsertParam::CDockInsertParam(const CDockInsertParam &p)
98+
: QPair<Qt::Orientation, bool>(p)
99+
{}
100+
101+
CDockInsertParam::CDockInsertParam(CDockInsertParam &&p)
102+
: QPair<Qt::Orientation, bool>(std::move(p))
103+
{}
93104

94105
} // namespace internal
95106
} // namespace ads

src/ads_globals.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,10 @@ void hideEmptyParentSplitters(CDockSplitter* FirstParentSplitter);
110110
class CDockInsertParam : public QPair<Qt::Orientation, bool>
111111
{
112112
public:
113-
using QPair::QPair;
113+
CDockInsertParam() = default;
114+
CDockInsertParam(Qt::Orientation orient, bool append);
115+
CDockInsertParam(const CDockInsertParam &p);
116+
CDockInsertParam(CDockInsertParam &&p);
114117
Qt::Orientation orientation() const {return this->first;}
115118
bool append() const {return this->second;}
116119
int insertOffset() const {return append() ? 1 : 0;}

src/src.pro

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ ADS_OUT_ROOT = $${OUT_PWD}/..
22
CONFIG += c++11
33
TARGET = $$qtLibraryTarget(qtadvanceddocking)
44
DEFINES += QT_DEPRECATED_WARNINGS
5-
CONFIG(debug, debug|release) {
6-
mac: TARGET = $$join(TARGET,,,_debug)
7-
win32: TARGET = $$join(TARGET,,,d)
8-
}
95
TEMPLATE = lib
106
DESTDIR = $${ADS_OUT_ROOT}/lib
117
QT += core gui widgets
@@ -68,4 +64,4 @@ isEmpty(PREFIX){
6864
headers.path=$$PREFIX/include
6965
headers.files=$$HEADERS
7066
target.path=$$PREFIX/lib
71-
INSTALLS += headers target
67+
INSTALLS += headers target

0 commit comments

Comments
 (0)