From eae24fccc57437170e2ba01b894fa24fe65292be Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Tue, 12 Apr 2016 16:19:58 +0200 Subject: Add QQuickAbstractButton::down This property will determine whether or not the button is visually pressed. Having such a distinction allows users more control over their controls. The patch also fixes the problem with ComboBox where pressing on the ComboBox when it's open would cause a delegate in the popup to show as being pressed. Unless explicitly set, this property follows the value of the pressed property. To return to the default value, set it to undefined. Change-Id: I29ecf325ed2ede125613f0c878b0427937599866 Task-number: QTBUG-51005 Reviewed-by: J-P Nurmi --- src/imports/controls/Button.qml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/imports/controls/Button.qml') diff --git a/src/imports/controls/Button.qml b/src/imports/controls/Button.qml index 82ff0914..406ae931 100644 --- a/src/imports/controls/Button.qml +++ b/src/imports/controls/Button.qml @@ -55,7 +55,7 @@ T.Button { text: control.text font: control.font opacity: enabled || highlighted ? 1 : 0.3 - color: control.checked || control.highlighted ? "#ffffff" : (control.activeKeyFocus ? "#0066ff" : (control.pressed ? "#26282a" : "#353637")) + color: control.checked || control.highlighted ? "#ffffff" : (control.activeKeyFocus ? "#0066ff" : (control.down ? "#26282a" : "#353637")) horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter elide: Text.ElideRight @@ -68,9 +68,9 @@ T.Button { implicitHeight: 40 opacity: enabled ? 1 : (control.checked ? 0.2 : 0.3) color: control.checked || control.highlighted ? - (control.activeKeyFocus ? (control.pressed ? "#599bff" : "#0066ff") : (control.pressed ? "#585a5c" : "#353637")) : - (control.activeKeyFocus ? (control.pressed ? "#cce0ff" : "#f0f6ff") : (control.pressed ? "#d6d6d6" : "#f6f6f6")) - border.color: control.activeKeyFocus ? "#0066ff" : (control.pressed ? "#26282a" : "#353637") + (control.activeKeyFocus ? (control.down ? "#599bff" : "#0066ff") : (control.down ? "#585a5c" : "#353637")) : + (control.activeKeyFocus ? (control.down ? "#cce0ff" : "#f0f6ff") : (control.down ? "#d6d6d6" : "#f6f6f6")) + border.color: control.activeKeyFocus ? "#0066ff" : (control.down ? "#26282a" : "#353637") border.width: control.checked || control.highlighted ? 0 : (control.activeKeyFocus ? 2 : 1) } //! [background] -- cgit v1.2.3