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
-
For Gerrit Dashboard: QTBUG-89380 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
359579,6 | Doc: add a circular mask example snippet for containmentMask | dev | qt/qtdeclarative | Status: ABANDONED | 0 | 0 |
359954,4 | Doc: add example snippets for containmentMask | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
362108,2 | Doc: add example snippets for containmentMask | 6.2 | qt/qtdeclarative | Status: MERGED | +2 | 0 |
362109,2 | Doc: add example snippets for containmentMask | 6.1 | qt/qtdeclarative | Status: MERGED | +2 | 0 |
362112,2 | Doc: add example snippets for containmentMask | tqtc/lts-5.15 | qt/tqtc-qtdeclarative | Status: MERGED | +2 | 0 |