Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.15
-
None
Description
https://doc.qt.io/qt-5/qml-qtquick-pointhandler.html#details says:
If it will be used in that way, it can be helpful for your main.cpp to use QQmlContext::setContextProperty() to make the "glass pane" accessible by ID to the entire UI, so that other Items and PointHandlers can be reparented to it.
In the example that follows, an Item named glassPane is declared in QML, so it doesn't make sense (and would not be advisable) to then access this from C++ just to expose it to QML. Perhaps the item could be made a QML singleton and somehow parented to the window instead.
We are also trying to avoid recommending setContextProperty(), in favour of e.g. https://doc.qt.io/qt-5/qqmlapplicationengine.html#setInitialProperties, or singletons.