diff options
author | Venugopal Shivashankar <Venugopal.Shivashankar@qt.io> | 2018-10-03 11:19:27 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2018-10-03 15:16:10 +0000 |
commit | f6bb3c220b1276ee9f5782a4fe0165cf62ba727a (patch) | |
tree | ad54a87aba7d91e062c13336a7c36d70c1a16156 /examples/quick/shared/CheckBox.qml | |
parent | 818d7340e7f0dfeca7c93887702a09f64e07ced9 (diff) |
Example: Update the shared UI controls to use input handlers
Change-Id: I077754d9d9d713d01c7711175eb1b5da5e1f6869
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'examples/quick/shared/CheckBox.qml')
-rw-r--r-- | examples/quick/shared/CheckBox.qml | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/examples/quick/shared/CheckBox.qml b/examples/quick/shared/CheckBox.qml index bcf8178f74..7b1588d2d9 100644 --- a/examples/quick/shared/CheckBox.qml +++ b/examples/quick/shared/CheckBox.qml @@ -48,7 +48,7 @@ ** ****************************************************************************/ -import QtQuick 2.0 +import QtQuick 2.12 Item { id: root @@ -58,7 +58,7 @@ Item { height: implicitHeight property alias text: label.text property bool checked - property alias pressed: mouseArea.pressed + property alias pressed: tapHandler.pressed property alias row: row signal clicked @@ -71,7 +71,7 @@ Item { Rectangle { id: frame gradient: Gradient { - GradientStop { position: 0.0; color: mouseArea.pressed ? Qt.darker(palette.button, 1.3) : palette.button } + GradientStop { position: 0.0; color: tapHandler.pressed ? Qt.darker(palette.button, 1.3) : palette.button } GradientStop { position: 1.0; color: Qt.darker(palette.button, 1.3) } } height: label.implicitHeight * 1.5 @@ -96,10 +96,9 @@ Item { anchors.verticalCenter: frame.verticalCenter } } - MouseArea { - id: mouseArea - anchors.fill: parent - onClicked: { + TapHandler { + id: tapHandler + onTapped: { parent.checked = !parent.checked parent.clicked() } |