aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/controls/material
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-05-10 09:08:33 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2016-05-10 12:47:13 +0000
commit13bc1d6f34f6aa4425b318ea874270cd994ee336 (patch)
treed063a4da4c3005e335801a7cebcba325d6bbe668 /src/imports/controls/material
parentf2342bf0646c65512e4df864495cfd3c6c11da65 (diff)
Material: fix SwitchDelegate press color
Elevation is required to get a shadow for the indicator, but it also affects the press color, which is undesired. To avoid a darker press color than the other delegates have, elevate only the indicator instead of the whole delegate. Unfortunately, this results to two Material attached object instances for the delegate, so it must be blacklisted in tst_sanity... Change-Id: I8b607ba8f7493fd34a4bdc131a5bfdc5a39159ae Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/imports/controls/material')
-rw-r--r--src/imports/controls/material/Switch.qml2
-rw-r--r--src/imports/controls/material/SwitchDelegate.qml2
-rw-r--r--src/imports/controls/material/SwitchIndicator.qml7
3 files changed, 5 insertions, 6 deletions
diff --git a/src/imports/controls/material/Switch.qml b/src/imports/controls/material/Switch.qml
index 300ccac2..37776100 100644
--- a/src/imports/controls/material/Switch.qml
+++ b/src/imports/controls/material/Switch.qml
@@ -42,8 +42,6 @@ import QtQuick.Templates 2.0 as T
T.Switch {
id: control
- Material.elevation: 1
-
implicitWidth: Math.max(background ? background.implicitWidth : 0,
contentItem.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
diff --git a/src/imports/controls/material/SwitchDelegate.qml b/src/imports/controls/material/SwitchDelegate.qml
index 26781f15..b729f01e 100644
--- a/src/imports/controls/material/SwitchDelegate.qml
+++ b/src/imports/controls/material/SwitchDelegate.qml
@@ -42,8 +42,6 @@ import QtQuick.Controls.Material.impl 2.0
T.SwitchDelegate {
id: control
- Material.elevation: 1
-
implicitWidth: Math.max(background ? background.implicitWidth : 0,
contentItem.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
diff --git a/src/imports/controls/material/SwitchIndicator.qml b/src/imports/controls/material/SwitchIndicator.qml
index 0f64be8e..0d2163b2 100644
--- a/src/imports/controls/material/SwitchIndicator.qml
+++ b/src/imports/controls/material/SwitchIndicator.qml
@@ -39,11 +39,14 @@ import QtQuick.Controls.Material 2.0
import QtQuick.Controls.Material.impl 2.0
Item {
+ id: indicator
implicitWidth: 38
implicitHeight: 32
property alias control: ripple.control
+ Material.elevation: 1
+
Ripple {
id: ripple
x: handle.x + handle.width / 2 - width / 2
@@ -79,9 +82,9 @@ Item {
duration: 300
}
}
- layer.enabled: control.Material.elevation > 0
+ layer.enabled: indicator.Material.elevation > 0
layer.effect: ElevationEffect {
- elevation: control.Material.elevation
+ elevation: indicator.Material.elevation
}
}
}