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
=== modified file 'src/UbuntuToolkit/uctheme.cpp'
--- src/UbuntuToolkit/uctheme.cpp 2016-09-09 17:49:07 +0000
+++ src/UbuntuToolkit/uctheme.cpp 2016-09-16 17:10:32 +0000
@@ -150,16 +150,19 @@
150const QString THEME_FOLDER_FORMAT("%1/%2/");150const QString THEME_FOLDER_FORMAT("%1/%2/");
151const QString PARENT_THEME_FILE("parent_theme");151const QString PARENT_THEME_FILE("parent_theme");
152152
153static inline void updateBinding (QQmlAbstractBinding *binding)153#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
154static inline void updateBinding(const QQmlAbstractBinding::Ptr &binding)
154{155{
155#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
156 if (binding->isValueTypeProxy())156 if (binding->isValueTypeProxy())
157 return;157 return;
158 static_cast<QQmlBinding *>(binding)->update();158 static_cast<QQmlBinding*>(binding.data())->update();
159}
159#else160#else
160 binding->update();161static inline void updateBinding (const QQmlAbstractBinding *binding)
162{
163 const_cast<QQmlAbstractBinding*>(binding)->update();
164}
161#endif165#endif
162}
163166
164QStringList themeSearchPath()167QStringList themeSearchPath()
165{168{
@@ -263,11 +266,14 @@
263 // restore the config binding to the config target266 // restore the config binding to the config target
264#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)267#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
265 if (config.configBinding && !config.configBinding->isValueTypeProxy()) {268 if (config.configBinding && !config.configBinding->isValueTypeProxy()) {
269 QQmlBinding *qmlBinding = static_cast<QQmlBinding*>(config.configBinding.data());
270 qmlBinding->removeFromObject();
271 QQmlPropertyPrivate::removeBinding(config.paletteProperty);
266#else272#else
267 if (config.configBinding && config.configBinding->bindingType() == QQmlAbstractBinding::Binding) {273 if (config.configBinding && config.configBinding->bindingType() == QQmlAbstractBinding::Binding) {
268#endif
269 QQmlBinding *qmlBinding = static_cast<QQmlBinding*>(config.configBinding);274 QQmlBinding *qmlBinding = static_cast<QQmlBinding*>(config.configBinding);
270 qmlBinding->removeFromObject();275 qmlBinding->removeFromObject();
276#endif
271 qmlBinding->setTarget(config.configProperty);277 qmlBinding->setTarget(config.configProperty);
272 }278 }
273279
@@ -275,7 +281,7 @@
275 // restore the binding to the palette281 // restore the binding to the palette
276#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)282#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
277 QQmlAbstractBinding::Ptr prev(QQmlPropertyPrivate::binding(config.paletteProperty));283 QQmlAbstractBinding::Ptr prev(QQmlPropertyPrivate::binding(config.paletteProperty));
278 QQmlPropertyPrivate::setBinding(config.paletteProperty, config.paletteBinding);284 QQmlPropertyPrivate::setBinding(config.paletteProperty, config.paletteBinding.data());
279#else285#else
280 QQmlAbstractBinding *prev = QQmlPropertyPrivate::setBinding(config.paletteProperty, config.paletteBinding);286 QQmlAbstractBinding *prev = QQmlPropertyPrivate::setBinding(config.paletteProperty, config.paletteBinding);
281#endif287#endif
@@ -293,7 +299,7 @@
293 }299 }
294300
295 config.paletteProperty = QQmlProperty();301 config.paletteProperty = QQmlProperty();
296 config.paletteBinding = NULL;302 config.paletteBinding = Q_NULLPTR;
297 config.paletteValue.clear();303 config.paletteValue.clear();
298 }304 }
299305
@@ -346,6 +352,10 @@
346 config.paletteBinding = QQmlPropertyPrivate::binding(config.paletteProperty);352 config.paletteBinding = QQmlPropertyPrivate::binding(config.paletteProperty);
347 if (!config.paletteBinding) {353 if (!config.paletteBinding) {
348 config.paletteValue = config.paletteProperty.read();354 config.paletteValue = config.paletteProperty.read();
355#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
356 } else {
357 QQmlPropertyPrivate::removeBinding(config.paletteProperty);
358#endif
349 }359 }
350360
351 // apply configuration361 // apply configuration
@@ -353,17 +363,26 @@
353 // transfer binding's target363 // transfer binding's target
354#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)364#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
355 if (!config.configBinding->isValueTypeProxy()) {365 if (!config.configBinding->isValueTypeProxy()) {
366 QQmlBinding *qmlBinding = static_cast<QQmlBinding*>(config.configBinding.data());
356#else367#else
357 if (config.configBinding->bindingType() == QQmlAbstractBinding::Binding) {368 if (config.configBinding->bindingType() == QQmlAbstractBinding::Binding) {
358#endif
359 QQmlBinding *qmlBinding = static_cast<QQmlBinding*>(config.configBinding);369 QQmlBinding *qmlBinding = static_cast<QQmlBinding*>(config.configBinding);
370#endif
360 qmlBinding->setTarget(config.paletteProperty);371 qmlBinding->setTarget(config.paletteProperty);
361 }372 }
373#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
374 QQmlPropertyPrivate::setBinding(config.paletteProperty, config.configBinding.data());
375#else
362 QQmlPropertyPrivate::setBinding(config.paletteProperty, config.configBinding);376 QQmlPropertyPrivate::setBinding(config.paletteProperty, config.configBinding);
377#endif
363 } else {378 } else {
364 if (config.paletteBinding) {379 if (config.paletteBinding) {
380#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
381 QQmlPropertyPrivate::removeBinding(config.paletteProperty);
382#else
365 // remove binding so the property doesn't clear it383 // remove binding so the property doesn't clear it
366 QQmlPropertyPrivate::setBinding(config.paletteProperty, 0);384 QQmlPropertyPrivate::setBinding(config.paletteProperty, 0);
385#endif
367 }386 }
368 config.paletteProperty.write(config.configProperty.read());387 config.paletteProperty.write(config.configProperty.read());
369 }388 }
370389
=== modified file 'src/UbuntuToolkit/uctheme_p.h'
--- src/UbuntuToolkit/uctheme_p.h 2016-09-09 17:49:07 +0000
+++ src/UbuntuToolkit/uctheme_p.h 2016-09-16 17:10:32 +0000
@@ -27,12 +27,17 @@
27#include <QtQml/QQmlComponent>27#include <QtQml/QQmlComponent>
28#include <QtQml/QQmlParserStatus>28#include <QtQml/QQmlParserStatus>
29#include <QtQml/QQmlProperty>29#include <QtQml/QQmlProperty>
30#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
31#include <QtQml/private/qqmlabstractbinding_p.h>
32#endif
30#include <QtQml/private/qpodvector_p.h>33#include <QtQml/private/qpodvector_p.h>
3134
32#include <UbuntuToolkit/ubuntutoolkitglobal.h>35#include <UbuntuToolkit/ubuntutoolkitglobal.h>
33#include <UbuntuToolkit/private/ucdefaulttheme_p.h>36#include <UbuntuToolkit/private/ucdefaulttheme_p.h>
3437
38#if QT_VERSION < QT_VERSION_CHECK(5, 6, 0)
35class QQmlAbstractBinding;39class QQmlAbstractBinding;
40#endif
36class QQuickItem;41class QQuickItem;
3742
38UT_NAMESPACE_BEGIN43UT_NAMESPACE_BEGIN
@@ -148,8 +153,13 @@
148 QQmlProperty configProperty;153 QQmlProperty configProperty;
149 QQmlProperty paletteProperty;154 QQmlProperty paletteProperty;
150 QVariant paletteValue;155 QVariant paletteValue;
156#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
157 QQmlAbstractBinding::Ptr configBinding;
158 QQmlAbstractBinding::Ptr paletteBinding;
159#else
151 QQmlAbstractBinding *configBinding;160 QQmlAbstractBinding *configBinding;
152 QQmlAbstractBinding *paletteBinding;161 QQmlAbstractBinding *paletteBinding;
162#endif
153 };163 };
154164
155 // configuration palette, not the original theme one165 // configuration palette, not the original theme one
156166
=== modified file 'tests/unit/unit.pro'
--- tests/unit/unit.pro 2016-09-16 11:13:32 +0000
+++ tests/unit/unit.pro 2016-09-16 17:10:32 +0000
@@ -29,7 +29,7 @@
29 mousefilters \29 mousefilters \
30 animator \30 animator \
31 serviceproperties \31 serviceproperties \
32# subtheming \ # FIXME: Breaks with Qt 5.6. See bug #1570478.32 subtheming \
33 swipearea \33 swipearea \
34 touchregistry \34 touchregistry \
35 bottomedge \35 bottomedge \
@@ -38,7 +38,7 @@
38 units \38 units \
39 scaling_image_provider \39 scaling_image_provider \
40 qquick_image_extension \40 qquick_image_extension \
41# performance \ # FIXME: Breaks with Qt 5.6. See bug #1570478.41 performance \
42 mainview \42 mainview \
43 i18n \43 i18n \
44 arguments \44 arguments \

Subscribers

People subscribed via source and target branches