Skip to content

Commit 7964e36

Browse files
committed
Adapt all QML to use JS functions with formal parameters
Fixes runtime warnings such as: qt.qml.context: qrc:/org/asteroid/controls/qml/BorderGestureArea.qml:160:5 Parameter "mouse" is not declared. Injection of parameters into signal handlers is deprecated. Use JavaScript functions with formal parameters instead. As an alternative the following also would work: function onPressed(mouse) { ... }
1 parent ffe3d78 commit 7964e36

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/controls/qml/BorderGestureArea.qml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ import org.asteroid.utils 1.0
6161
acceptsRight: true
6262
acceptsLeft: true
6363
acceptsDown: true
64-
onGestureFinished: {
64+
onGestureFinished: (gesture) => {
6565
if (gesture == "right") {
6666
square.color = "red"
6767
}
@@ -95,7 +95,7 @@ import org.asteroid.utils 1.0
9595
anchors.fill: parent
9696
acceptsUp: true
9797
acceptsDown: true
98-
onGestureFinished: {
98+
onGestureFinished: (gesture) => {
9999
if (gesture == "up") {
100100
square.color = "green"
101101
}
@@ -157,7 +157,7 @@ MouseArea {
157157
property int _mouseStart
158158
property variant _gestures: ["down", "left", "up", "right"]
159159

160-
onPressed: {
160+
onPressed: (mouse) => {
161161
if (mouse.x < boundary && acceptsRight) {
162162
gesture = "right"
163163
max = width - mouse.x
@@ -184,7 +184,7 @@ MouseArea {
184184
gestureStarted(gesture)
185185
}
186186

187-
onPositionChanged: {
187+
onPositionChanged: (mouse) => {
188188
var p = horizontal ? mouse.x : mouse.y
189189
value = Math.max(Math.min(p - _mouseStart, max), -max)
190190
}

src/controls/qml/TextBase.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ FocusScope {
4545

4646
signal enterKeyClicked
4747

48-
Keys.onReleased: {
48+
Keys.onReleased: (event) => {
4949
if (event.key === Qt.Key_Return)
5050
enterKeyClicked()
5151
}

0 commit comments

Comments
 (0)