From e9476ae5b9385ce5a6b4a55f984543aa180492bd Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 24 Apr 2015 01:02:24 +0200 Subject: Use Theme.disabledColor to get sensible looks in disabled state Change-Id: I28831c979f8fa040fc3388eec6f2256930a3d91d Reviewed-by: J-P Nurmi --- src/imports/controls/Switch.qml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/imports/controls/Switch.qml') diff --git a/src/imports/controls/Switch.qml b/src/imports/controls/Switch.qml index ccfdaa3c..518c07ad 100644 --- a/src/imports/controls/Switch.qml +++ b/src/imports/controls/Switch.qml @@ -67,7 +67,6 @@ AbstractSwitch { radius: 10 border.width: control.activeFocus ? 2 : 1 border.color: control.activeFocus ? control.Theme.focusColor : control.Theme.frameColor - opacity: enabled ? 1.0 : control.Theme.disabledOpacity color: control.Theme.backgroundColor Rectangle { @@ -75,9 +74,10 @@ AbstractSwitch { height: 12 radius: 6 - color: Qt.tint(Qt.tint(control.checked ? control.Theme.accentColor : control.Theme.baseColor, - control.checked && control.activeFocus ? control.Theme.focusColor : "transparent"), - control.pressed ? control.Theme.pressColor : "transparent") + color: Qt.tint(control.checked && !control.enabled ? control.Theme.disabledColor : + control.checked && control.activeFocus ? control.Theme.focusColor : + control.checked ? control.Theme.accentColor : control.Theme.baseColor, + control.pressed ? control.Theme.pressColor : "transparent") border.width: control.checked || control.pressed ? 0 : 1 border.color: control.Theme.frameColor @@ -101,10 +101,9 @@ AbstractSwitch { height: parent.height - control.topPadding - control.bottomPadding text: control.text - color: control.Theme.textColor + color: control.enabled ? control.Theme.textColor : control.Theme.disabledColor elide: Text.ElideRight visible: control.text - opacity: enabled ? 1.0 : control.Theme.disabledOpacity horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter } -- cgit v1.2.3