diff options
author | Mitch Curtis <mitch.curtis@theqtcompany.com> | 2016-04-13 10:35:12 +0200 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@theqtcompany.com> | 2016-04-13 09:07:55 +0000 |
commit | 0a9634b74c21881deb125a8f7a4c9fea787ca636 (patch) | |
tree | bf7b2d2e17232052235dee46b2e5ba3e9e648661 /src/imports/controls/material/MenuItem.qml | |
parent | 2a1d244066c47803407c225d31164dadfc19dd58 (diff) |
Material: use CheckIndicator for MenuItem's indicator
Change-Id: I0a3fe3a5ded3467ca404bf5e632dad5f60b08e77
Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'src/imports/controls/material/MenuItem.qml')
-rw-r--r-- | src/imports/controls/material/MenuItem.qml | 70 |
1 files changed, 2 insertions, 68 deletions
diff --git a/src/imports/controls/material/MenuItem.qml b/src/imports/controls/material/MenuItem.qml index e2042894..76b1b648 100644 --- a/src/imports/controls/material/MenuItem.qml +++ b/src/imports/controls/material/MenuItem.qml @@ -53,77 +53,11 @@ T.MenuItem { spacing: 16 //! [indicator] - indicator: Rectangle { - id: indicatorItem + indicator: CheckIndicator { x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2 y: control.topPadding + (control.availableHeight - height) / 2 - implicitWidth: 20 - implicitHeight: 20 - color: "transparent" - border.color: control.checked ? control.Material.accentColor : control.Material.secondaryTextColor - border.width: control.checked ? width / 2 : 2 - radius: 2 - visible: control.checkable - - Behavior on border.width { - NumberAnimation { - duration: 100 - easing.type: Easing.OutCubic - } - } - - Behavior on border.color { - ColorAnimation { - duration: 100 - easing.type: Easing.OutCubic - } - } - - Ripple { - width: parent.width - height: width - control: control - colored: control.checked - opacity: control.pressed ? 1 : 0 - } - - // TODO: This needs to be transparent - Image { - id: checkImage - x: (parent.width - width) / 2 - y: (parent.height - height) / 2 - width: 16 - height: 16 - source: "qrc:/qt-project.org/imports/Qt/labs/controls/material/images/check.png" - fillMode: Image.PreserveAspectFit - - scale: control.checked ? 1 : 0 - Behavior on scale { NumberAnimation { duration: 100 } } - } - - states: State { - name: "checked" - when: control.checked - } - - transitions: Transition { - SequentialAnimation { - NumberAnimation { - target: indicatorItem - property: "scale" - // Go down 2 pixels in size. - to: 1 - 2 / indicatorItem.width - duration: 120 - } - NumberAnimation { - target: indicatorItem - property: "scale" - to: 1 - duration: 120 - } - } - } + control: control } //! [indicator] |