aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/controls/material/Button.qml
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2015-12-15 11:44:40 +0100
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2015-12-15 12:14:06 +0000
commit966e45513a6f7e568b9f4ac93a01723742b50a84 (patch)
tree27ccf83ca051f7a6f702d29eb31f2f95c2b21688 /src/imports/controls/material/Button.qml
parentd4df163af0609340f8b4c006ee18daaff563053d (diff)
Material: fix drop shadows
Change-Id: Ic4b1152a0a8a28a64721f064ccd09b669a12e795 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'src/imports/controls/material/Button.qml')
-rw-r--r--src/imports/controls/material/Button.qml35
1 files changed, 19 insertions, 16 deletions
diff --git a/src/imports/controls/material/Button.qml b/src/imports/controls/material/Button.qml
index 582bc472..5204fd3b 100644
--- a/src/imports/controls/material/Button.qml
+++ b/src/imports/controls/material/Button.qml
@@ -69,33 +69,36 @@ T.Button {
//! [label]
//! [background]
- background: Rectangle {
+ background: Item {
implicitWidth: 36
implicitHeight: 36
- radius: 2
- color: !control.enabled ? (control.highlighted ? control.Material.raisedHighlightedButtonDisabledColor : control.Material.raisedButtonDisabledColor) :
- (control.pressed ? (control.highlighted ? control.Material.raisedHighlightedButtonPressColor : control.Material.raisedButtonPressColor) :
- (control.activeFocus ? (control.highlighted ? control.Material.raisedHighlightedButtonHoverColor : control.Material.raisedButtonHoverColor) :
- (control.highlighted ? control.Material.raisedHighlightedButtonColor : control.Material.raisedButtonColor)))
+ Rectangle {
+ id: rect
+ width: parent.width
+ height: parent.height
+ radius: 2
+ color: !control.enabled ? (control.highlighted ? control.Material.raisedHighlightedButtonDisabledColor : control.Material.raisedButtonDisabledColor) :
+ (control.pressed ? (control.highlighted ? control.Material.raisedHighlightedButtonPressColor : control.Material.raisedButtonPressColor) :
+ (control.activeFocus ? (control.highlighted ? control.Material.raisedHighlightedButtonHoverColor : control.Material.raisedButtonHoverColor) :
+ (control.highlighted ? control.Material.raisedHighlightedButtonColor : control.Material.raisedButtonColor)))
- Behavior on color {
- ColorAnimation {
- duration: 400
+ Behavior on color {
+ ColorAnimation {
+ duration: 400
+ }
}
}
- layer.enabled: control.enabled
- layer.effect: DropShadow {
+ DropShadow {
+ source: rect
+ visible: control.enabled
+ width: parent.width
+ height: parent.height
verticalOffset: 1
color: control.Material.dropShadowColor
samples: control.pressed ? 15 : 9
spread: 0.5
-
- // TODO: Doesn't work because of QTBUG-49072
- Behavior on radius {
- NumberAnimation { duration: 1000 }
- }
}
}
//! [background]