Merge lp:~zsombi/ubuntu-ui-toolkit/fixPaletteChange into lp:ubuntu-ui-toolkit/staging

Proposed by Zsombor Egri
Status: Merged
Approved by: Timo Jyrinki
Approved revision: 2106
Merged at revision: 2111
Proposed branch: lp:~zsombi/ubuntu-ui-toolkit/fixPaletteChange
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 159 lines (+40/-11)
3 files modified
src/UbuntuToolkit/uctheme.cpp (+28/-9)
src/UbuntuToolkit/uctheme_p.h (+10/-0)
tests/unit/unit.pro (+2/-2)
To merge this branch: bzr merge lp:~zsombi/ubuntu-ui-toolkit/fixPaletteChange
Reviewer Review Type Date Requested Status
ubuntu-sdk-build-bot continuous-integration Approve
Cris Dywan Approve
Review via email: mp+305986@code.launchpad.net

Commit message

Fix property binding restore on theme palette values.

Description of the change

Fix property binding restore on theme palette values.

To post a comment you must log in.
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Cris Dywan (kalikiana) wrote :

Niiiiice. Thanks for sorting this out!

review: Approve
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

Sorry armhf failure because of arale but now the yakkety should be fixed first.

Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

Yakkety tests now fixed ("fixed") with another MP, retopapproving.

Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/UbuntuToolkit/uctheme.cpp'
2--- src/UbuntuToolkit/uctheme.cpp 2016-09-09 17:49:07 +0000
3+++ src/UbuntuToolkit/uctheme.cpp 2016-09-16 17:10:32 +0000
4@@ -150,16 +150,19 @@
5 const QString THEME_FOLDER_FORMAT("%1/%2/");
6 const QString PARENT_THEME_FILE("parent_theme");
7
8-static inline void updateBinding (QQmlAbstractBinding *binding)
9+#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
10+static inline void updateBinding(const QQmlAbstractBinding::Ptr &binding)
11 {
12-#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
13 if (binding->isValueTypeProxy())
14 return;
15- static_cast<QQmlBinding *>(binding)->update();
16+ static_cast<QQmlBinding*>(binding.data())->update();
17+}
18 #else
19- binding->update();
20+static inline void updateBinding (const QQmlAbstractBinding *binding)
21+{
22+ const_cast<QQmlAbstractBinding*>(binding)->update();
23+}
24 #endif
25-}
26
27 QStringList themeSearchPath()
28 {
29@@ -263,11 +266,14 @@
30 // restore the config binding to the config target
31 #if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
32 if (config.configBinding && !config.configBinding->isValueTypeProxy()) {
33+ QQmlBinding *qmlBinding = static_cast<QQmlBinding*>(config.configBinding.data());
34+ qmlBinding->removeFromObject();
35+ QQmlPropertyPrivate::removeBinding(config.paletteProperty);
36 #else
37 if (config.configBinding && config.configBinding->bindingType() == QQmlAbstractBinding::Binding) {
38-#endif
39 QQmlBinding *qmlBinding = static_cast<QQmlBinding*>(config.configBinding);
40 qmlBinding->removeFromObject();
41+#endif
42 qmlBinding->setTarget(config.configProperty);
43 }
44
45@@ -275,7 +281,7 @@
46 // restore the binding to the palette
47 #if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
48 QQmlAbstractBinding::Ptr prev(QQmlPropertyPrivate::binding(config.paletteProperty));
49- QQmlPropertyPrivate::setBinding(config.paletteProperty, config.paletteBinding);
50+ QQmlPropertyPrivate::setBinding(config.paletteProperty, config.paletteBinding.data());
51 #else
52 QQmlAbstractBinding *prev = QQmlPropertyPrivate::setBinding(config.paletteProperty, config.paletteBinding);
53 #endif
54@@ -293,7 +299,7 @@
55 }
56
57 config.paletteProperty = QQmlProperty();
58- config.paletteBinding = NULL;
59+ config.paletteBinding = Q_NULLPTR;
60 config.paletteValue.clear();
61 }
62
63@@ -346,6 +352,10 @@
64 config.paletteBinding = QQmlPropertyPrivate::binding(config.paletteProperty);
65 if (!config.paletteBinding) {
66 config.paletteValue = config.paletteProperty.read();
67+#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
68+ } else {
69+ QQmlPropertyPrivate::removeBinding(config.paletteProperty);
70+#endif
71 }
72
73 // apply configuration
74@@ -353,17 +363,26 @@
75 // transfer binding's target
76 #if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
77 if (!config.configBinding->isValueTypeProxy()) {
78+ QQmlBinding *qmlBinding = static_cast<QQmlBinding*>(config.configBinding.data());
79 #else
80 if (config.configBinding->bindingType() == QQmlAbstractBinding::Binding) {
81-#endif
82 QQmlBinding *qmlBinding = static_cast<QQmlBinding*>(config.configBinding);
83+#endif
84 qmlBinding->setTarget(config.paletteProperty);
85 }
86+#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
87+ QQmlPropertyPrivate::setBinding(config.paletteProperty, config.configBinding.data());
88+#else
89 QQmlPropertyPrivate::setBinding(config.paletteProperty, config.configBinding);
90+#endif
91 } else {
92 if (config.paletteBinding) {
93+#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
94+ QQmlPropertyPrivate::removeBinding(config.paletteProperty);
95+#else
96 // remove binding so the property doesn't clear it
97 QQmlPropertyPrivate::setBinding(config.paletteProperty, 0);
98+#endif
99 }
100 config.paletteProperty.write(config.configProperty.read());
101 }
102
103=== modified file 'src/UbuntuToolkit/uctheme_p.h'
104--- src/UbuntuToolkit/uctheme_p.h 2016-09-09 17:49:07 +0000
105+++ src/UbuntuToolkit/uctheme_p.h 2016-09-16 17:10:32 +0000
106@@ -27,12 +27,17 @@
107 #include <QtQml/QQmlComponent>
108 #include <QtQml/QQmlParserStatus>
109 #include <QtQml/QQmlProperty>
110+#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
111+#include <QtQml/private/qqmlabstractbinding_p.h>
112+#endif
113 #include <QtQml/private/qpodvector_p.h>
114
115 #include <UbuntuToolkit/ubuntutoolkitglobal.h>
116 #include <UbuntuToolkit/private/ucdefaulttheme_p.h>
117
118+#if QT_VERSION < QT_VERSION_CHECK(5, 6, 0)
119 class QQmlAbstractBinding;
120+#endif
121 class QQuickItem;
122
123 UT_NAMESPACE_BEGIN
124@@ -148,8 +153,13 @@
125 QQmlProperty configProperty;
126 QQmlProperty paletteProperty;
127 QVariant paletteValue;
128+#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
129+ QQmlAbstractBinding::Ptr configBinding;
130+ QQmlAbstractBinding::Ptr paletteBinding;
131+#else
132 QQmlAbstractBinding *configBinding;
133 QQmlAbstractBinding *paletteBinding;
134+#endif
135 };
136
137 // configuration palette, not the original theme one
138
139=== modified file 'tests/unit/unit.pro'
140--- tests/unit/unit.pro 2016-09-16 11:13:32 +0000
141+++ tests/unit/unit.pro 2016-09-16 17:10:32 +0000
142@@ -29,7 +29,7 @@
143 mousefilters \
144 animator \
145 serviceproperties \
146-# subtheming \ # FIXME: Breaks with Qt 5.6. See bug #1570478.
147+ subtheming \
148 swipearea \
149 touchregistry \
150 bottomedge \
151@@ -38,7 +38,7 @@
152 units \
153 scaling_image_provider \
154 qquick_image_extension \
155-# performance \ # FIXME: Breaks with Qt 5.6. See bug #1570478.
156+ performance \
157 mainview \
158 i18n \
159 arguments \

Subscribers

People subscribed via source and target branches