From 93ddfb64135e268f79a7d2c0d484054051c6cc35 Mon Sep 17 00:00:00 2001 From: mfreiholz Date: Fri, 12 Feb 2016 11:07:45 +0100 Subject: [PATCH] Updates compatibility for Qt 4.5.3 and MSVC2008 --- .../AdvancedDockingSystem.pro | 2 +- AdvancedDockingSystem/include/ads/API.h | 11 +++++-- .../include/ads/SectionTitleWidget.h | 2 +- AdvancedDockingSystemDemo/src/mainwindow.cpp | 32 +++++++++++-------- AdvancedDockingSystemDemo/src/mainwindow.h | 2 +- 5 files changed, 30 insertions(+), 19 deletions(-) diff --git a/AdvancedDockingSystem/AdvancedDockingSystem.pro b/AdvancedDockingSystem/AdvancedDockingSystem.pro index 5138549..2df4e8d 100644 --- a/AdvancedDockingSystem/AdvancedDockingSystem.pro +++ b/AdvancedDockingSystem/AdvancedDockingSystem.pro @@ -19,7 +19,7 @@ windows { # MSVC *-msvc* { #QMAKE_CXXFLAGS += /Za - QMAKE_CXXFLAGS += /FS + #QMAKE_CXXFLAGS += /FS } } diff --git a/AdvancedDockingSystem/include/ads/API.h b/AdvancedDockingSystem/include/ads/API.h index f485e1e..24253ac 100644 --- a/AdvancedDockingSystem/include/ads/API.h +++ b/AdvancedDockingSystem/include/ads/API.h @@ -12,8 +12,15 @@ class QSplitter; * Developed by Manuel Freiholz */ -#define ADS_NAMESPACE_BEGIN namespace ads { -#define ADS_NAMESPACE_END } +#if 0 + #define ADS_NAMESPACE_BEGIN namespace ads { + #define ADS_NAMESPACE_END } + #define ADS_NS ads +#else + #define ADS_NAMESPACE_BEGIN + #define ADS_NAMESPACE_END + #define ADS_NS +#endif // Width of the native window frame border (based on OS). #define ADS_WINDOW_FRAME_BORDER_WIDTH 7 diff --git a/AdvancedDockingSystem/include/ads/SectionTitleWidget.h b/AdvancedDockingSystem/include/ads/SectionTitleWidget.h index 77e03d9..d49ab31 100644 --- a/AdvancedDockingSystem/include/ads/SectionTitleWidget.h +++ b/AdvancedDockingSystem/include/ads/SectionTitleWidget.h @@ -15,7 +15,7 @@ class FloatingWidget; class SectionTitleWidget : public QFrame { Q_OBJECT - Q_PROPERTY(bool activeTab MEMBER _activeTab NOTIFY activeTabChanged) + //Q_PROPERTY(bool activeTab MEMBER _activeTab NOTIFY activeTabChanged) friend class SectionWidget; diff --git a/AdvancedDockingSystemDemo/src/mainwindow.cpp b/AdvancedDockingSystemDemo/src/mainwindow.cpp index de078a2..ab76838 100644 --- a/AdvancedDockingSystemDemo/src/mainwindow.cpp +++ b/AdvancedDockingSystemDemo/src/mainwindow.cpp @@ -19,7 +19,7 @@ static int CONTENT_COUNT = 0; -static ads::SectionContent::RefPtr createLongTextLabelSC() +static ADS_NS::SectionContent::RefPtr createLongTextLabelSC() { QWidget* w = new QWidget(); QBoxLayout* bl = new QBoxLayout(QBoxLayout::TopToBottom); @@ -32,18 +32,18 @@ static ads::SectionContent::RefPtr createLongTextLabelSC() bl->addWidget(l); const int index = ++CONTENT_COUNT; - return ads::SectionContent::newSectionContent(new IconTitleWidget(QIcon(), QString("Label %1").arg(index)), w, QString("uname-%1").arg(index)); + return ADS_NS::SectionContent::newSectionContent(new IconTitleWidget(QIcon(), QString("Label %1").arg(index)), w, QString("uname-%1").arg(index)); } -static ads::SectionContent::RefPtr createCalendarSC() +static ADS_NS::SectionContent::RefPtr createCalendarSC() { QCalendarWidget* w = new QCalendarWidget(); const int index = ++CONTENT_COUNT; - return ads::SectionContent::newSectionContent(new IconTitleWidget(QIcon(), QString("Calendar %1").arg(index)), w, QString("uname-%1").arg(index)); + return ADS_NS::SectionContent::newSectionContent(new IconTitleWidget(QIcon(), QString("Calendar %1").arg(index)), w, QString("uname-%1").arg(index)); } -static ads::SectionContent::RefPtr createFileSystemTreeSC() +static ADS_NS::SectionContent::RefPtr createFileSystemTreeSC() { QTreeView* w = new QTreeView(); // QFileSystemModel* m = new QFileSystemModel(w); @@ -51,7 +51,7 @@ static ads::SectionContent::RefPtr createFileSystemTreeSC() // w->setModel(m); const int index = ++CONTENT_COUNT; - return ads::SectionContent::newSectionContent(new IconTitleWidget(QIcon(), QString("Filesystem %1").arg(index)), w, QString("uname-%1").arg(index)); + return ADS_NS::SectionContent::newSectionContent(new IconTitleWidget(QIcon(), QString("Filesystem %1").arg(index)), w, QString("uname-%1").arg(index)); } /////////////////////////////////////////////////////////////////////// @@ -63,28 +63,32 @@ MainWindow::MainWindow(QWidget *parent) : ui->setupUi(this); ui->mainToolBar->hide(); ui->statusBar->hide(); +#if QT_VERSION >= 0x050000 QObject::connect(ui->actionAddSectionContent, &QAction::triggered, this, &MainWindow::onActionAddSectionContentTriggered); +#else + QObject::connect(ui->actionAddSectionContent, SIGNAL(triggered(bool)), this, SLOT(onActionAddSectionContentTriggered())); +#endif // CREATE SOME TESTING DOCKS - _container = new ads::ContainerWidget(); + _container = new ADS_NS::ContainerWidget(); _container->setOrientation(Qt::Vertical); setCentralWidget(_container); - ads::SectionWidget* section = NULL; + ADS_NS::SectionWidget* section = NULL; - section = new ads::SectionWidget(_container); + section = new ADS_NS::SectionWidget(_container); section->addContent(createLongTextLabelSC()); _container->addSection(section); - section = new ads::SectionWidget(_container); + section = new ADS_NS::SectionWidget(_container); section->addContent(createCalendarSC()); _container->addSection(section); - section = new ads::SectionWidget(_container); + section = new ADS_NS::SectionWidget(_container); section->addContent(createFileSystemTreeSC()); _container->addSection(section); - section = new ads::SectionWidget(_container); + section = new ADS_NS::SectionWidget(_container); section->addContent(createCalendarSC()); _container->addSection(section); @@ -112,9 +116,9 @@ void MainWindow::onActionAddSectionContentTriggered() // auto titleWidget = new IconTitleWidget(QIcon(), QString("Title")); // auto contentWidget = createRandomWidget(-1, -1); -// auto content = ads::SectionContent::newSectionContent(titleWidget, contentWidget); +// auto content = ADS_NS::SectionContent::newSectionContent(titleWidget, contentWidget); -// auto section = new ads::SectionWidget(_container); +// auto section = new ADS_NS::SectionWidget(_container); // _container->addSection(section); // section->addContent(content); } diff --git a/AdvancedDockingSystemDemo/src/mainwindow.h b/AdvancedDockingSystemDemo/src/mainwindow.h index 54995ee..0d7d62a 100644 --- a/AdvancedDockingSystemDemo/src/mainwindow.h +++ b/AdvancedDockingSystemDemo/src/mainwindow.h @@ -29,7 +29,7 @@ protected: private: Ui::MainWindow *ui; - ads::ContainerWidget* _container; + ADS_NS::ContainerWidget* _container; }; #endif // MAINWINDOW_H