Updates compatibility for Qt 4.5.3 and MSVC2008

This commit is contained in:
mfreiholz 2016-02-12 11:07:45 +01:00
parent 8f13dbd77c
commit 93ddfb6413
5 changed files with 30 additions and 19 deletions

View File

@ -19,7 +19,7 @@ windows {
# MSVC # MSVC
*-msvc* { *-msvc* {
#QMAKE_CXXFLAGS += /Za #QMAKE_CXXFLAGS += /Za
QMAKE_CXXFLAGS += /FS #QMAKE_CXXFLAGS += /FS
} }
} }

View File

@ -12,8 +12,15 @@ class QSplitter;
* Developed by Manuel Freiholz * Developed by Manuel Freiholz
*/ */
#define ADS_NAMESPACE_BEGIN namespace ads { #if 0
#define ADS_NAMESPACE_END } #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). // Width of the native window frame border (based on OS).
#define ADS_WINDOW_FRAME_BORDER_WIDTH 7 #define ADS_WINDOW_FRAME_BORDER_WIDTH 7

View File

@ -15,7 +15,7 @@ class FloatingWidget;
class SectionTitleWidget : public QFrame class SectionTitleWidget : public QFrame
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(bool activeTab MEMBER _activeTab NOTIFY activeTabChanged) //Q_PROPERTY(bool activeTab MEMBER _activeTab NOTIFY activeTabChanged)
friend class SectionWidget; friend class SectionWidget;

View File

@ -19,7 +19,7 @@
static int CONTENT_COUNT = 0; static int CONTENT_COUNT = 0;
static ads::SectionContent::RefPtr createLongTextLabelSC() static ADS_NS::SectionContent::RefPtr createLongTextLabelSC()
{ {
QWidget* w = new QWidget(); QWidget* w = new QWidget();
QBoxLayout* bl = new QBoxLayout(QBoxLayout::TopToBottom); QBoxLayout* bl = new QBoxLayout(QBoxLayout::TopToBottom);
@ -32,18 +32,18 @@ static ads::SectionContent::RefPtr createLongTextLabelSC()
bl->addWidget(l); bl->addWidget(l);
const int index = ++CONTENT_COUNT; 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(); QCalendarWidget* w = new QCalendarWidget();
const int index = ++CONTENT_COUNT; 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(); QTreeView* w = new QTreeView();
// QFileSystemModel* m = new QFileSystemModel(w); // QFileSystemModel* m = new QFileSystemModel(w);
@ -51,7 +51,7 @@ static ads::SectionContent::RefPtr createFileSystemTreeSC()
// w->setModel(m); // w->setModel(m);
const int index = ++CONTENT_COUNT; 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->setupUi(this);
ui->mainToolBar->hide(); ui->mainToolBar->hide();
ui->statusBar->hide(); ui->statusBar->hide();
#if QT_VERSION >= 0x050000
QObject::connect(ui->actionAddSectionContent, &QAction::triggered, this, &MainWindow::onActionAddSectionContentTriggered); 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 // CREATE SOME TESTING DOCKS
_container = new ads::ContainerWidget(); _container = new ADS_NS::ContainerWidget();
_container->setOrientation(Qt::Vertical); _container->setOrientation(Qt::Vertical);
setCentralWidget(_container); 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()); section->addContent(createLongTextLabelSC());
_container->addSection(section); _container->addSection(section);
section = new ads::SectionWidget(_container); section = new ADS_NS::SectionWidget(_container);
section->addContent(createCalendarSC()); section->addContent(createCalendarSC());
_container->addSection(section); _container->addSection(section);
section = new ads::SectionWidget(_container); section = new ADS_NS::SectionWidget(_container);
section->addContent(createFileSystemTreeSC()); section->addContent(createFileSystemTreeSC());
_container->addSection(section); _container->addSection(section);
section = new ads::SectionWidget(_container); section = new ADS_NS::SectionWidget(_container);
section->addContent(createCalendarSC()); section->addContent(createCalendarSC());
_container->addSection(section); _container->addSection(section);
@ -112,9 +116,9 @@ void MainWindow::onActionAddSectionContentTriggered()
// auto titleWidget = new IconTitleWidget(QIcon(), QString("Title")); // auto titleWidget = new IconTitleWidget(QIcon(), QString("Title"));
// auto contentWidget = createRandomWidget(-1, -1); // 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); // _container->addSection(section);
// section->addContent(content); // section->addContent(content);
} }

View File

@ -29,7 +29,7 @@ protected:
private: private:
Ui::MainWindow *ui; Ui::MainWindow *ui;
ads::ContainerWidget* _container; ADS_NS::ContainerWidget* _container;
}; };
#endif // MAINWINDOW_H #endif // MAINWINDOW_H