diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2018-04-20 09:34:00 +0200 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2018-04-20 08:05:37 +0000 |
commit | e23beb63cc0dbbe69d193e3445f6ca9d4f586ad4 (patch) | |
tree | 6a937bbf6a835f46c74e3b836aa5fb5e8bcbcc17 /src/imports/controls/material | |
parent | 9b8338c20236f705d1472c0a7c7244646369d58f (diff) |
Ensure that CheckIndicator works with MenuItem
This was broken in 99b2fbbc90466c79837c7e68ac5d7a15b2f91699.
MenuItem doesn't have a checkState property, so we need to check its
checked property instead.
Change-Id: I3c2f9b27a1fe81c1de3500fad7e7bbe17ce6e02e
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'src/imports/controls/material')
-rw-r--r-- | src/imports/controls/material/CheckIndicator.qml | 13 | ||||
-rw-r--r-- | src/imports/controls/material/MenuItem.qml | 1 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src/imports/controls/material/CheckIndicator.qml b/src/imports/controls/material/CheckIndicator.qml index 71962150..dbba4ca4 100644 --- a/src/imports/controls/material/CheckIndicator.qml +++ b/src/imports/controls/material/CheckIndicator.qml @@ -44,11 +44,12 @@ Rectangle { implicitHeight: 18 color: "transparent" border.color: !control.enabled ? control.Material.hintTextColor - : control.checkState !== Qt.Unchecked ? control.Material.accentColor : control.Material.secondaryTextColor - border.width: control.checkState !== Qt.Unchecked ? width / 2 : 2 + : checkState !== Qt.Unchecked ? control.Material.accentColor : control.Material.secondaryTextColor + border.width: checkState !== Qt.Unchecked ? width / 2 : 2 radius: 2 property Item control + property int checkState: control.checkState Behavior on border.width { NumberAnimation { @@ -74,7 +75,7 @@ Rectangle { source: "qrc:/qt-project.org/imports/QtQuick/Controls.2/Material/images/check.png" fillMode: Image.PreserveAspectFit - scale: control.checkState === Qt.Checked ? 1 : 0 + scale: checkState === Qt.Checked ? 1 : 0 Behavior on scale { NumberAnimation { duration: 100 } } } @@ -84,18 +85,18 @@ Rectangle { width: 12 height: 3 - scale: control.checkState === Qt.PartiallyChecked ? 1 : 0 + scale: checkState === Qt.PartiallyChecked ? 1 : 0 Behavior on scale { NumberAnimation { duration: 100 } } } states: [ State { name: "checked" - when: control.checkState === Qt.Checked + when: checkState === Qt.Checked }, State { name: "partiallychecked" - when: control.checkState === Qt.PartiallyChecked + when: checkState === Qt.PartiallyChecked } ] diff --git a/src/imports/controls/material/MenuItem.qml b/src/imports/controls/material/MenuItem.qml index 13d4694c..54d13f8e 100644 --- a/src/imports/controls/material/MenuItem.qml +++ b/src/imports/controls/material/MenuItem.qml @@ -65,6 +65,7 @@ T.MenuItem { y: control.topPadding + (control.availableHeight - height) / 2 visible: control.checkable control: control + checkState: control.checked ? Qt.Checked : Qt.Unchecked } arrow: ColorImage { |