From 119e43db9747ee070c84fc3ffb4c81ee4db35da8 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 22 Feb 2016 14:50:24 +0100 Subject: Material: add missing focus highlights Change-Id: Id678a095a56f7494c9f32160326ba667a6c0dc28 Task-number: QTBUG-51257 Reviewed-by: Mitch Curtis Reviewed-by: BogDan Vatra --- src/imports/controls/material/Button.qml | 8 ++++++++ src/imports/controls/material/CheckBox.qml | 2 +- src/imports/controls/material/ComboBox.qml | 8 ++++++++ src/imports/controls/material/RadioButton.qml | 2 +- src/imports/controls/material/SliderHandle.qml | 10 +++++++++- src/imports/controls/material/Switch.qml | 2 +- 6 files changed, 28 insertions(+), 4 deletions(-) (limited to 'src/imports/controls') diff --git a/src/imports/controls/material/Button.qml b/src/imports/controls/material/Button.qml index 77128861..a869c915 100644 --- a/src/imports/controls/material/Button.qml +++ b/src/imports/controls/material/Button.qml @@ -91,6 +91,14 @@ T.Button { } } + Rectangle { + width: parent.width + height: parent.height + radius: parent.radius + visible: control.activeFocus + color: control.Material.checkBoxUncheckedRippleColor + } + layer.enabled: control.enabled layer.effect: DropShadow { verticalOffset: 1 diff --git a/src/imports/controls/material/CheckBox.qml b/src/imports/controls/material/CheckBox.qml index 5becfc5c..230f696f 100644 --- a/src/imports/controls/material/CheckBox.qml +++ b/src/imports/controls/material/CheckBox.qml @@ -87,7 +87,7 @@ T.CheckBox { height: width control: control colored: control.checked - opacity: control.pressed ? 1 : 0 + opacity: control.pressed || control.activeFocus ? 1 : 0 } // TODO: This needs to be transparent diff --git a/src/imports/controls/material/ComboBox.qml b/src/imports/controls/material/ComboBox.qml index 7f47672e..1c293567 100644 --- a/src/imports/controls/material/ComboBox.qml +++ b/src/imports/controls/material/ComboBox.qml @@ -101,6 +101,14 @@ T.ComboBox { opacity: !control.enabled ? 0.5 : 1.0 source: "qrc:/qt-project.org/imports/Qt/labs/controls/material/images/drop-indicator.png" } + + Rectangle { + width: parent.width + height: parent.height + radius: parent.radius + visible: control.activeFocus + color: control.Material.checkBoxUncheckedRippleColor + } } //! [background] diff --git a/src/imports/controls/material/RadioButton.qml b/src/imports/controls/material/RadioButton.qml index 25d91a5c..f01d2dc9 100644 --- a/src/imports/controls/material/RadioButton.qml +++ b/src/imports/controls/material/RadioButton.qml @@ -72,7 +72,7 @@ T.RadioButton { height: width control: control colored: control.checked - opacity: control.pressed ? 1 : 0 + opacity: control.pressed || control.activeFocus ? 1 : 0 } Rectangle { diff --git a/src/imports/controls/material/SliderHandle.qml b/src/imports/controls/material/SliderHandle.qml index dc1a836d..6f54eaf5 100644 --- a/src/imports/controls/material/SliderHandle.qml +++ b/src/imports/controls/material/SliderHandle.qml @@ -55,7 +55,7 @@ Item { height: parent.height radius: width / 2 color: root.control.Material.accentColor - scale: root.handlePressed || root.handleHasFocus ? 1.5 : 1 + scale: root.handlePressed ? 1.5 : 1 Behavior on scale { NumberAnimation { @@ -63,4 +63,12 @@ Item { } } } + + Ripple { + width: parent.width + height: width + control: root.control + colored: true + opacity: root.handleHasFocus && !root.handlePressed ? 1 : 0 + } } diff --git a/src/imports/controls/material/Switch.qml b/src/imports/controls/material/Switch.qml index f44fb31a..0b9edcab 100644 --- a/src/imports/controls/material/Switch.qml +++ b/src/imports/controls/material/Switch.qml @@ -68,7 +68,7 @@ T.Switch { height: width control: control colored: control.checked - opacity: control.pressed ? 1 : 0 + opacity: control.pressed || control.activeFocus ? 1 : 0 } Rectangle { -- cgit v1.2.3