From e6542f01d39e49b0d5aca61b8cb4a06cf2825fc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Mon, 2 Nov 2015 10:08:07 +0100 Subject: [PATCH] [aurorae] Use property binding for toggled state So far we manually updated the toggled state depending on the button type and the corresponding client property. This had an error sneaked in for onAllDesktops: it was bound to desktop change instead of on all desktop change causing the button to not reflect the state correctly. To prevent such errors it's now setup to a property binding to the client's state directly. BUG: 354702 FIXED-IN: 5.4.3 REVIEW: 125917 --- clients/aurorae/src/qml/DecorationButton.qml | 35 +++----------------- 1 file changed, 4 insertions(+), 31 deletions(-) diff --git a/clients/aurorae/src/qml/DecorationButton.qml b/clients/aurorae/src/qml/DecorationButton.qml index dd23fe2d84..6c295d09a1 100644 --- a/clients/aurorae/src/qml/DecorationButton.qml +++ b/clients/aurorae/src/qml/DecorationButton.qml @@ -107,45 +107,18 @@ Item { switch (button.buttonType) { case DecorationOptions.DecorationButtonOnAllDesktops: // all desktops - button.toggled = decoration.client.onAllDesktops; + button.toggled = Qt.binding(function() { return decoration.client.onAllDesktops; }); break; case DecorationOptions.DecorationButtonKeepAbove: - button.toggled = decoration.client.keepAbove; + button.toggled = Qt.binding(function() { return decoration.client.keepAbove; }); break; case DecorationOptions.DecorationButtonKeepBelow: - button.toggled = decoration.client.keepBelow; + button.toggled = Qt.binding(function() { return decoration.client.keepBelow; }); break; case DecorationOptions.DecorationButtonShade: - button.toggled = decoration.client.shaded; + button.toggled = Qt.binding(function() { return decoration.client.shaded; }); break; } } - Connections { - target: decoration.client - onShadedChanged: { - if (button.buttonType != DecorationOptions.DecorationButtonShade) { - return; - } - button.toggled = decoration.client.shaded; - } - onKeepBelowChanged: { - if (button.buttonType != DecorationOptions.DecorationButtonKeepBelow) { - return; - } - button.toggled = decoration.client.keepBelow; - } - onKeepAboveChanged: { - if (button.buttonType != DecorationOptions.DecorationButtonKeepAbove) { - return; - } - button.toggled = decoration.client.keepAbove; - } - onDesktopChanged: { - if (button.buttonType != DecorationOptions.DecorationButtonOnAllDesktops) { - return; - } - button.toggled = decoration.client.onAllDesktops; - } - } } }