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

Add QQmlEngine::createComponent(string module, string componentName)

    XMLWordPrintable

Details

    • 3f4856dbc (dev)

    Description

      (name pending bikeshedding, string could be either QStringView or const QString &)

       

      This should avoid the currently uglyness of having to load main.qml via the qrc path:

       

      // current
      QQmlApplicationEngine engine("main.qml"); // bad if only qrc available
      // or
      QQmlApplicationEngine engine("qrc://coolproject/moduleA/main.qml"); // hassle to type
      
      // then
      QQmlApplicationEngine engine;
      engine.createComponen("coolproject.moduleA", "Main.qml") // TODO: return type?
      // should this maybe only be load, but QQMlComponent gets a create overload?

       

      Further benefits might  be the ability to easily access a QML singleton by name from C++.

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-97156
          # Subject Branch Project Status CR V

          Activity

            People

              fabiankosmale Fabian Kosmale
              fabiankosmale Fabian Kosmale
              Votes:
              1 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: