Use QT_VERSION_CHECK macro for better compatibility.

This commit is contained in:
mfreiholz 2016-04-11 07:27:02 +02:00
parent 14a80f1753
commit fffc84374a
5 changed files with 12 additions and 12 deletions

View File

@ -6,7 +6,7 @@
#include "ads/API.h" #include "ads/API.h"
#if QT_VERSION >= 0x050000 #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#else #else
#include "ads/SectionContent.h" #include "ads/SectionContent.h"
#endif #endif

View File

@ -99,7 +99,7 @@ SectionWidget* ContainerWidget::addSectionContent(const SectionContent::RefPtr&
data.titleWidget = new SectionTitleWidget(sc, NULL); data.titleWidget = new SectionTitleWidget(sc, NULL);
data.contentWidget = new SectionContentWidget(sc, NULL); data.contentWidget = new SectionContentWidget(sc, NULL);
#if QT_VERSION >= 0x050000 #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
QObject::connect(data.titleWidget, &SectionTitleWidget::activeTabChanged, this, &ContainerWidget::onActiveTabChanged); QObject::connect(data.titleWidget, &SectionTitleWidget::activeTabChanged, this, &ContainerWidget::onActiveTabChanged);
#else #else
QObject::connect(data.titleWidget, SIGNAL(activeTabChanged()), this, SLOT(onActiveTabChanged())); QObject::connect(data.titleWidget, SIGNAL(activeTabChanged()), this, SLOT(onActiveTabChanged()));
@ -308,7 +308,7 @@ QMenu* ContainerWidget::createContextMenu() const
a->setProperty("type", "section"); a->setProperty("type", "section");
a->setCheckable(true); a->setCheckable(true);
a->setChecked(true); a->setChecked(true);
#if QT_VERSION >= 0x050000 #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
QObject::connect(a, &QAction::toggled, this, &ContainerWidget::onActionToggleSectionContentVisibility); QObject::connect(a, &QAction::toggled, this, &ContainerWidget::onActionToggleSectionContentVisibility);
#else #else
QObject::connect(a, SIGNAL(toggled(bool)), this, SLOT(onActionToggleSectionContentVisibility(bool))); QObject::connect(a, SIGNAL(toggled(bool)), this, SLOT(onActionToggleSectionContentVisibility(bool)));
@ -330,7 +330,7 @@ QMenu* ContainerWidget::createContextMenu() const
a->setProperty("type", "section"); a->setProperty("type", "section");
a->setCheckable(true); a->setCheckable(true);
a->setChecked(false); a->setChecked(false);
#if QT_VERSION >= 0x050000 #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
QObject::connect(a, &QAction::toggled, this, &ContainerWidget::onActionToggleSectionContentVisibility); QObject::connect(a, &QAction::toggled, this, &ContainerWidget::onActionToggleSectionContentVisibility);
#else #else
QObject::connect(a, SIGNAL(toggled(bool)), this, SLOT(onActionToggleSectionContentVisibility(bool))); QObject::connect(a, SIGNAL(toggled(bool)), this, SLOT(onActionToggleSectionContentVisibility(bool)));
@ -350,7 +350,7 @@ QMenu* ContainerWidget::createContextMenu() const
a->setProperty("type", "floating"); a->setProperty("type", "floating");
a->setCheckable(true); a->setCheckable(true);
a->setChecked(fw->isVisible()); a->setChecked(fw->isVisible());
#if QT_VERSION >= 0x050000 #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
QObject::connect(a, &QAction::toggled, this, &ContainerWidget::onActionToggleSectionContentVisibility); QObject::connect(a, &QAction::toggled, this, &ContainerWidget::onActionToggleSectionContentVisibility);
#else #else
QObject::connect(a, SIGNAL(toggled(bool)), this, SLOT(onActionToggleSectionContentVisibility(bool))); QObject::connect(a, SIGNAL(toggled(bool)), this, SLOT(onActionToggleSectionContentVisibility(bool)));

View File

@ -286,7 +286,7 @@ void hideDropOverlay()
{ {
MyOverlay->hide(); MyOverlay->hide();
delete MyOverlay; delete MyOverlay;
#if QT_VERSION >= 0x050000 #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
MyOverlayParent.clear(); MyOverlayParent.clear();
#else #else
MyOverlayParent = 0; MyOverlayParent = 0;

View File

@ -90,7 +90,7 @@ void SectionTitleWidget::mouseReleaseEvent(QMouseEvent* ev)
InternalContentData data; InternalContentData data;
_fw->takeContent(data); _fw->takeContent(data);
_fw->deleteLater(); _fw->deleteLater();
#if QT_VERSION >= 0x050000 #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
_fw.clear(); _fw.clear();
#else #else
_fw = 0; _fw = 0;
@ -140,7 +140,7 @@ void SectionTitleWidget::mouseReleaseEvent(QMouseEvent* ev)
InternalContentData data; InternalContentData data;
_fw->takeContent(data); _fw->takeContent(data);
_fw->deleteLater(); _fw->deleteLater();
#if QT_VERSION >= 0x050000 #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
_fw.clear(); _fw.clear();
#else #else
_fw = 0; _fw = 0;

View File

@ -55,7 +55,7 @@ SectionWidget::SectionWidget(ContainerWidget* parent) :
closeButton->setToolTip(tr("Close")); closeButton->setToolTip(tr("Close"));
closeButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); closeButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
_tabsLayout->addWidget(closeButton); _tabsLayout->addWidget(closeButton);
#if QT_VERSION >= 0x050000 #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
QObject::connect(closeButton, &QPushButton::clicked, this, &SectionWidget::onCloseButtonClicked); QObject::connect(closeButton, &QPushButton::clicked, this, &SectionWidget::onCloseButtonClicked);
#else #else
QObject::connect(closeButton, SIGNAL(clicked(bool)), this, SLOT(onCloseButtonClicked())); QObject::connect(closeButton, SIGNAL(clicked(bool)), this, SLOT(onCloseButtonClicked()));
@ -119,7 +119,7 @@ void SectionWidget::addContent(const SectionContent::RefPtr& c)
SectionTitleWidget* title = new SectionTitleWidget(c, NULL); SectionTitleWidget* title = new SectionTitleWidget(c, NULL);
_sectionTitles.append(title); _sectionTitles.append(title);
_tabsLayout->insertWidget(_tabsLayout->count() - 2, title); _tabsLayout->insertWidget(_tabsLayout->count() - 2, title);
#if QT_VERSION >= 0x050000 #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
QObject::connect(title, &SectionTitleWidget::clicked, this, &SectionWidget::onSectionTitleClicked); QObject::connect(title, &SectionTitleWidget::clicked, this, &SectionWidget::onSectionTitleClicked);
#else #else
QObject::connect(title, SIGNAL(clicked()), this, SLOT(onSectionTitleClicked())); QObject::connect(title, SIGNAL(clicked()), this, SLOT(onSectionTitleClicked()));
@ -146,7 +146,7 @@ void SectionWidget::addContent(const InternalContentData& data, bool autoActivat
_sectionTitles.append(data.titleWidget); _sectionTitles.append(data.titleWidget);
_tabsLayout->insertWidget(_tabsLayout->count() - 2, data.titleWidget); _tabsLayout->insertWidget(_tabsLayout->count() - 2, data.titleWidget);
data.titleWidget->setVisible(true); data.titleWidget->setVisible(true);
#if QT_VERSION >= 0x050000 #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
QObject::connect(data.titleWidget, &SectionTitleWidget::clicked, this, &SectionWidget::onSectionTitleClicked); QObject::connect(data.titleWidget, &SectionTitleWidget::clicked, this, &SectionWidget::onSectionTitleClicked);
#else #else
QObject::connect(data.titleWidget, SIGNAL(clicked()), this, SLOT(onSectionTitleClicked())); QObject::connect(data.titleWidget, SIGNAL(clicked()), this, SLOT(onSectionTitleClicked()));
@ -257,7 +257,7 @@ void SectionWidget::moveContent(int from, int to)
QLayoutItem* liFrom = NULL; QLayoutItem* liFrom = NULL;
liFrom = _tabsLayout->takeAt(from); liFrom = _tabsLayout->takeAt(from);
#if QT_VERSION >= 0x050000 #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
_tabsLayout->insertItem(to, liFrom); _tabsLayout->insertItem(to, liFrom);
#else #else
_tabsLayout->insertWidget(to, liFrom->widget()); _tabsLayout->insertWidget(to, liFrom->widget());