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

QML Singleton does not work if not in root folder on MacOS

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 6.5.3
    • Quick: Other
    • None
    • macOS

    Description

      When QML Singleton file is not located in root of the project, there is following error when running the application:

      qrc:/SingletonTest/qml/main.qml:14: TypeError: Colors was a singleton at compile time, but is not a singleton anymore.

      Aliasing all QML files in CMakeFiles.txt (and adopting main.cpp) fixes the issue:

       

      set_source_files_properties(qml/main.qml PROPERTIES QT_RESOURCE_ALIAS main.qml)
      set_source_files_properties(qml/Colors.qml PROPERTIES QT_RESOURCE_ALIAS Colors.qml)

       

      But these aliases must be created for all files in the module.

      Minimal example is attached.

       

       

      Attachments

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

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            kejpi Petr Kopecky
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes