Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-85925

PointHandler documentation's usage of setContextProperty is confusing

    XMLWordPrintable

Details

    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.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            srutledg Shawn Rutledge
            mitch_curtis Mitch Curtis
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes