Details
-
Bug
-
Resolution: Invalid
-
P2: Important
-
None
-
5.11.0, 6.0.0
-
None
Description
https://codereview.qt-project.org/c/qt/qtdeclarative/+/211550 never added any tests for JavaScript functions, so the invoke call silently fails. That's another issue: we need to warn when invoke fails... it does return a bool after all.
import QtQml import QtQuick Window { id: window visible: true width: 640 height: 480 QtObject { id: mask function contains(point: point) { print("hello") return point.x >= (control.width - width) / 2 && point.x < (control.width + width) / 2 && point.y >= control.y && point.y < control.y + control.height } } Rectangle { id: control width: 10 height: 100 color: tapHandler.pressed ? Qt.darker("#444") : (hoverHandler.hovered ? Qt.lighter("#444") : "#444") anchors.centerIn: parent TapHandler { id: tapHandler } HoverHandler { id: hoverHandler } containmentMask: mask } }
Note that I'm also using type annotations, as suggested by ulherman. Without that, there is a warning that the object doesn't have a contains function at all.
Attachments
Issue Links
- relates to
-
QTBUG-89378 containmentMask documentation should make it clearer that a QtObject can be used
-
- Reported
-
- resulted from
-
QTBUG-82678 Make SplitView use the touch area for hit testing
-
- Closed
-