diff options
author | Venugopal Shivashankar <Venugopal.Shivashankar@qt.io> | 2018-10-12 15:11:55 +0200 |
---|---|---|
committer | Venugopal Shivashankar <Venugopal.Shivashankar@qt.io> | 2018-10-29 12:54:00 +0000 |
commit | 11e2c7e48064f16c7800adfbc503a199ac6ea8f3 (patch) | |
tree | 3138a5a4d8270c15a39cda9a275dc99289aafe59 | |
parent | 229e4efc076d6a6746f1e659c59696e05e1d1c4c (diff) |
Doc: Replace MouseArea instances with TapHandler in the snippet files
Change-Id: I27420612cb2a0387684874d797edc159f4485e79
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
-rw-r--r-- | doc/snippets/qmlapp/usecases/animations.qml | 22 | ||||
-rw-r--r-- | doc/snippets/qmlapp/usecases/integratingjs-inline.qml | 7 | ||||
-rw-r--r-- | doc/snippets/qmlapp/usecases/integratingjs.qml | 7 |
3 files changed, 15 insertions, 21 deletions
diff --git a/doc/snippets/qmlapp/usecases/animations.qml b/doc/snippets/qmlapp/usecases/animations.qml index beb01c473..a7d5e3048 100644 --- a/doc/snippets/qmlapp/usecases/animations.qml +++ b/doc/snippets/qmlapp/usecases/animations.qml @@ -49,7 +49,7 @@ ****************************************************************************/ //![0] -import QtQuick 2.3 +import QtQuick 2.12 Item { @@ -76,9 +76,8 @@ Item { width: 120 height: 120 - MouseArea { - anchors.fill: parent - onClicked: container.state == 'other' ? container.state = '' : container.state = 'other' + TapHandler { + onTapped: container.state === '' ? container.state = 'other' : container.state = '' } } states: [ @@ -124,9 +123,8 @@ Item { } } - MouseArea { - anchors.fill: parent - onClicked: parent.x == 0 ? parent.x = 200 : parent.x = 0 + TapHandler { + onTapped: parent.x == 0 ? parent.x = 200 : parent.x = 0 } } } @@ -153,10 +151,9 @@ Item { PauseAnimation { duration: 250 } // This puts a bit of time between the loop } - MouseArea { - anchors.fill: parent + TapHandler { // The animation starts running when you click within the rectangle - onClicked: xAnim.running = true + onTapped: xAnim.running = true } } } @@ -173,10 +170,9 @@ Item { width: 120 height: 120 - MouseArea { - anchors.fill: parent + TapHandler { // The animation starts running when you click within the rectange - onClicked: anim.running = true; + onTapped: anim.running = true; } } diff --git a/doc/snippets/qmlapp/usecases/integratingjs-inline.qml b/doc/snippets/qmlapp/usecases/integratingjs-inline.qml index 70d1afe9e..8e98b461e 100644 --- a/doc/snippets/qmlapp/usecases/integratingjs-inline.qml +++ b/doc/snippets/qmlapp/usecases/integratingjs-inline.qml @@ -49,7 +49,7 @@ ****************************************************************************/ //![0] -import QtQuick 2.3 +import QtQuick 2.12 Item { id: container @@ -64,10 +64,9 @@ Item { return container.randomNumber(); } - MouseArea { - anchors.fill: parent + TapHandler { // This line uses the JS function from the item - onClicked: rectangle.rotation = container.getNumber(); + onTapped: rectangle.rotation = container.getNumber(); } Rectangle { diff --git a/doc/snippets/qmlapp/usecases/integratingjs.qml b/doc/snippets/qmlapp/usecases/integratingjs.qml index eb26f4614..9a9d86027 100644 --- a/doc/snippets/qmlapp/usecases/integratingjs.qml +++ b/doc/snippets/qmlapp/usecases/integratingjs.qml @@ -49,7 +49,7 @@ ****************************************************************************/ //![0] -import QtQuick 2.3 +import QtQuick 2.12 import "myscript.js" as Logic Item { @@ -62,10 +62,9 @@ Item { height: 480 } - MouseArea { - anchors.fill: parent + TapHandler { // This line uses the JS function from the separate JS file - onClicked: rectangle.rotation = Logic.getRandom(rectangle.rotation); + onTapped: rectangle.rotation = Logic.getRandom(rectangle.rotation); } Rectangle { |