aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Holland <dominik.holland@pelagicore.com>2017-08-18 15:46:02 +0200
committerDominik Holland <dominik.holland@pelagicore.com>2017-08-21 09:07:00 +0000
commit3afe40cd240a23ec3bf981771f26c7e65b7b1434 (patch)
treee383a4305f478b45d663c25955aecaa8d1a48c2d
parente6fdf8f85b439cdad1c17f3f06a85957af2e7f25 (diff)
Fix compilation with Qt 5.10 (dev)
The private API got refactored. Change-Id: Ic1c71d5a5befc67e069ee631483024335ef28070 Reviewed-by: Volker Krause <volker.krause@kdab.com>
-rw-r--r--plugins/styles/neptune/neptunestyle.cpp25
-rw-r--r--plugins/styles/neptune/neptunestyle.h13
2 files changed, 36 insertions, 2 deletions
diff --git a/plugins/styles/neptune/neptunestyle.cpp b/plugins/styles/neptune/neptunestyle.cpp
index ed9573f..d838f5b 100644
--- a/plugins/styles/neptune/neptunestyle.cpp
+++ b/plugins/styles/neptune/neptunestyle.cpp
@@ -35,7 +35,9 @@
#include <QtQuick/QQuickWindow>
#include <QtGui/QGuiApplication>
-
+#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
+#include <QtQuickControls2/private/qquickstyle_p.h>
+#endif
class ThemeData
{
@@ -194,7 +196,11 @@ static QByteArray resolveSetting(const QSharedPointer<QSettings> &settings, cons
}
NeptuneStyle::NeptuneStyle(QObject *parent)
+#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
+ : QQuickAttachedObject(parent)
+#else
: QQuickStyleAttached(parent)
+#endif
, m_data(new StyleData(GlobalStyleData))
{
init();
@@ -347,7 +353,11 @@ void NeptuneStyle::init()
{
static bool initialized = false;
if (!initialized) {
+#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
+ QSharedPointer<QSettings> settings = QQuickStylePrivate::settings(QStringLiteral("Neptune"));
+#else
QSharedPointer<QSettings> settings = QQuickStyleAttached::settings(QStringLiteral("Neptune"));
+#endif
QByteArray data;
data = resolveSetting(settings, "Theme");
@@ -376,7 +386,11 @@ void NeptuneStyle::init()
initialized = true;
m_data.reset(new StyleData(GlobalStyleData));
+#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
+ QQuickAttachedObject::init();
+#else
QQuickStyleAttached::init();
+#endif
}
void NeptuneStyle::resolveGlobalThemeData(const QSharedPointer<QSettings> &settings)
@@ -399,7 +413,11 @@ void NeptuneStyle::resolveGlobalThemeData(const QSharedPointer<QSettings> &setti
}
}
+#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
+void NeptuneStyle::attachedParentChange(QQuickAttachedObject *newParent, QQuickAttachedObject *oldParent)
+#else
void NeptuneStyle::parentStyleChange(QQuickStyleAttached *newParent, QQuickStyleAttached *oldParent)
+#endif
{
Q_UNUSED(oldParent);
NeptuneStyle* neptune = qobject_cast<NeptuneStyle *>(newParent);
@@ -416,8 +434,13 @@ void NeptuneStyle::inheritStyle(const StyleData& data)
void NeptuneStyle::propagateStyle(const StyleData& data)
{
+#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
+ const auto styles = attachedChildren();
+ for (QQuickAttachedObject *child: styles) {
+#else
const auto styles = childStyles();
for (QQuickStyleAttached *child: styles) {
+#endif
NeptuneStyle* neptune = qobject_cast<NeptuneStyle *>(child);
if (neptune)
neptune->inheritStyle(data);
diff --git a/plugins/styles/neptune/neptunestyle.h b/plugins/styles/neptune/neptunestyle.h
index f5a55c0..9266280 100644
--- a/plugins/styles/neptune/neptunestyle.h
+++ b/plugins/styles/neptune/neptunestyle.h
@@ -37,11 +37,18 @@
#include <QtGui/QGuiApplication>
#include <QtQml>
-#include <QtQuickControls2/private/qquickstyleattached_p.h>
class StyleData;
+#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
+#include <QtQuickControls2/private/qquickattachedobject_p.h>
+
+class NeptuneStyle : public QQuickAttachedObject
+#else
+#include <QtQuickControls2/private/qquickstyleattached_p.h>
+
class NeptuneStyle : public QQuickStyleAttached
+#endif
{
Q_OBJECT
Q_PROPERTY(QColor darkColor READ darkColor NOTIFY neptuneStyleChanged FINAL)
@@ -133,7 +140,11 @@ private:
qreal m_windowHeight;
protected:
+#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
+ void attachedParentChange(QQuickAttachedObject *newParent, QQuickAttachedObject *oldParent);
+#else
void parentStyleChange(QQuickStyleAttached *newParent, QQuickStyleAttached *oldParent);
+#endif
void inheritStyle(const StyleData &data);
void propagateStyle(const StyleData &data);
void resolveGlobalThemeData(const QSharedPointer<QSettings> &settings);