aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2021-02-12 08:53:00 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-02-12 16:18:28 +0000
commit8784a2778063cf928b27a908f6580ed37cb4035d (patch)
tree5a0871bc6fdd795d7971bc43c3811ee467d4ff38 /examples
parent0e92e0bd6e7209ad491472b3928840ad78c5371a (diff)
Use functions as signal handlers when accessing parameters
Injected signal handlers are bad practice because they aren't declared. Task-number: QTBUG-89943 Change-Id: I3a691f68342a199bd63034637aa7ed438e3a037b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 4cc91a6a0e4f9063233a4d6554ae64855cf99c14) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'examples')
-rw-r--r--examples/qml/dynamicscene/content/PaletteItem.qml6
-rw-r--r--examples/quick/particles/system/content/dynamicemitters.qml2
-rw-r--r--examples/quick/particles/system/content/startstop.qml2
-rw-r--r--examples/quick/particles/system/content/timedgroupchanges.qml2
-rw-r--r--examples/quick/shapes/content/interactive.qml6
-rw-r--r--examples/quick/touchinteraction/pincharea/flickresize.qml2
-rw-r--r--examples/quick/tutorials/dynamicview/dynamicview3/dynamicview.qml2
-rw-r--r--examples/quick/tutorials/dynamicview/dynamicview4/dynamicview.qml2
-rw-r--r--examples/quick/tutorials/samegame/samegame3/samegame.qml2
-rw-r--r--examples/quick/tutorials/samegame/samegame4/samegame.qml3
10 files changed, 15 insertions, 14 deletions
diff --git a/examples/qml/dynamicscene/content/PaletteItem.qml b/examples/qml/dynamicscene/content/PaletteItem.qml
index 72c4e6a27f..ca734a5dba 100644
--- a/examples/qml/dynamicscene/content/PaletteItem.qml
+++ b/examples/qml/dynamicscene/content/PaletteItem.qml
@@ -62,8 +62,8 @@ Image {
MouseArea {
anchors.fill: parent
- onPressed: Code.startDrag(mouse);
- onPositionChanged: Code.continueDrag(mouse);
- onReleased: Code.endDrag(mouse);
+ onPressed: (mouse)=> Code.startDrag(mouse);
+ onPositionChanged: (mouse)=> Code.continueDrag(mouse);
+ onReleased: (mouse)=> Code.endDrag(mouse);
}
}
diff --git a/examples/quick/particles/system/content/dynamicemitters.qml b/examples/quick/particles/system/content/dynamicemitters.qml
index 226e6de870..8eb87d2baa 100644
--- a/examples/quick/particles/system/content/dynamicemitters.qml
+++ b/examples/quick/particles/system/content/dynamicemitters.qml
@@ -138,7 +138,7 @@ Rectangle {
}
MouseArea {
anchors.fill: parent
- onClicked: customEmit(mouse.x, mouse.y);
+ onClicked: (mouse)=> customEmit(mouse.x, mouse.y);
}
Text {
diff --git a/examples/quick/particles/system/content/startstop.qml b/examples/quick/particles/system/content/startstop.qml
index cf9ad3d79d..a9ef7285aa 100644
--- a/examples/quick/particles/system/content/startstop.qml
+++ b/examples/quick/particles/system/content/startstop.qml
@@ -63,7 +63,7 @@ Rectangle {
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton
- onClicked: {
+ onClicked: (mouse) => {
if (mouse.button == Qt.LeftButton)
particles.running = !particles.running
else
diff --git a/examples/quick/particles/system/content/timedgroupchanges.qml b/examples/quick/particles/system/content/timedgroupchanges.qml
index 9865d3294e..cab992f898 100644
--- a/examples/quick/particles/system/content/timedgroupchanges.qml
+++ b/examples/quick/particles/system/content/timedgroupchanges.qml
@@ -88,7 +88,7 @@ Rectangle {
duration: 1000
Affector {
once: true
- onAffected: worksEmitter.burst(400,x,y)
+ onAffected: (x, y)=> worksEmitter.burst(400,x,y)
}
}
//! [2]
diff --git a/examples/quick/shapes/content/interactive.qml b/examples/quick/shapes/content/interactive.qml
index 78413db3f9..1f7aad3ab0 100644
--- a/examples/quick/shapes/content/interactive.qml
+++ b/examples/quick/shapes/content/interactive.qml
@@ -190,7 +190,7 @@ Rectangle {
onExited: color = rr.color
onPressed: a = true
onReleased: a = false
- onPositionChanged: {
+ onPositionChanged: (mouse)=> {
if (a) {
var pt = mapToItem(rr.parent, mouse.x, mouse.y);
rr.obj[rr.xprop] = pt.x
@@ -323,10 +323,10 @@ Rectangle {
MouseArea {
anchors.fill: parent
- onPressed: {
+ onPressed: (mouse)=> {
canvas.funcs[root.mode].start(mouse.x, mouse.y);
}
- onPositionChanged: {
+ onPositionChanged: (mouse)=> {
canvas.funcs[root.mode].move(mouse.x, mouse.y);
}
onReleased: {
diff --git a/examples/quick/touchinteraction/pincharea/flickresize.qml b/examples/quick/touchinteraction/pincharea/flickresize.qml
index 65db04693d..994fd01b50 100644
--- a/examples/quick/touchinteraction/pincharea/flickresize.qml
+++ b/examples/quick/touchinteraction/pincharea/flickresize.qml
@@ -73,7 +73,7 @@ Rectangle {
initialHeight = flick.contentHeight
}
- onPinchUpdated: {
+ onPinchUpdated: (pinch)=> {
// adjust content pos due to drag
flick.contentX += pinch.previousCenter.x - pinch.center.x
flick.contentY += pinch.previousCenter.y - pinch.center.y
diff --git a/examples/quick/tutorials/dynamicview/dynamicview3/dynamicview.qml b/examples/quick/tutorials/dynamicview/dynamicview3/dynamicview.qml
index 6c64ee2893..eb42a76a47 100644
--- a/examples/quick/tutorials/dynamicview/dynamicview3/dynamicview.qml
+++ b/examples/quick/tutorials/dynamicview/dynamicview3/dynamicview.qml
@@ -120,7 +120,7 @@ Rectangle {
DropArea {
anchors { fill: parent; margins: 10 }
- onEntered: {
+ onEntered: (drag)=> {
visualModel.items.move(
drag.source.DelegateModel.itemsIndex,
dragArea.DelegateModel.itemsIndex)
diff --git a/examples/quick/tutorials/dynamicview/dynamicview4/dynamicview.qml b/examples/quick/tutorials/dynamicview/dynamicview4/dynamicview.qml
index 327ca0cea7..f40f060e7c 100644
--- a/examples/quick/tutorials/dynamicview/dynamicview4/dynamicview.qml
+++ b/examples/quick/tutorials/dynamicview/dynamicview4/dynamicview.qml
@@ -121,7 +121,7 @@ Rectangle {
DropArea {
anchors { fill: parent; margins: 10 }
- onEntered: {
+ onEntered: (drag)=> {
visualModel.items.move(
drag.source.DelegateModel.itemsIndex,
dragArea.DelegateModel.itemsIndex)
diff --git a/examples/quick/tutorials/samegame/samegame3/samegame.qml b/examples/quick/tutorials/samegame/samegame3/samegame.qml
index a84cc67146..11376232a2 100644
--- a/examples/quick/tutorials/samegame/samegame3/samegame.qml
+++ b/examples/quick/tutorials/samegame/samegame3/samegame.qml
@@ -83,7 +83,7 @@ Rectangle {
MouseArea {
anchors.fill: parent
- onClicked: SameGame.handleClick(mouse.x, mouse.y)
+ onClicked: (mouse)=> SameGame.handleClick(mouse.x, mouse.y)
}
}
//![1]
diff --git a/examples/quick/tutorials/samegame/samegame4/samegame.qml b/examples/quick/tutorials/samegame/samegame4/samegame.qml
index 2bfdca9bd6..0cdbcd8cb0 100644
--- a/examples/quick/tutorials/samegame/samegame4/samegame.qml
+++ b/examples/quick/tutorials/samegame/samegame4/samegame.qml
@@ -80,7 +80,8 @@ Rectangle {
height: parent.height - (parent.height % blockSize);
MouseArea {
- anchors.fill: parent; onClicked: SameGame.handleClick(mouse.x,mouse.y);
+ anchors.fill: parent
+ onClicked: (mouse)=> SameGame.handleClick(mouse.x,mouse.y);
}
}
}