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

Register singleton instance clears all elements in that namespace version

XMLWordPrintable

      In https://doc.qt.io/qt-5/qqmlengine.html#QML_SINGLETON

      This behavior can be overridden by calling qmlRegisterSingletonType() with a specific factory function or qmlRegisterSingletonInstance() with a specific instance for the same class and the same type namespace and version.

      But calling qmlRegisterSingletonInstance causes all other QML_ELEMENT to not be available. I've attached an example application to demonstrate the issue. The example works if main.cpp:16 is commented.

       

        1. main.cpp
          0.8 kB
          João Barbosa
        2. singleton-bug.pro
          0.2 kB
          João Barbosa
        3. singleton.h
          0.3 kB
          João Barbosa
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            jbarbosa João Barbosa
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes