Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-11277

QtQuick2ControlsApplicationViewer template generated by Qt Creator doesn't work when the QML file is a resource

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Not Evaluated
    • None
    • Qt Creator 3.0.0
    • Quick / QML Support
    • None

    Description

      Creating a Qt Quick Controls project in Qt Creator 3.0 produces this template code:

      #include "qtquick2controlsapplicationviewer.h"

      int main(int argc, char *argv[])

      { Application app(argc, argv); QtQuick2ControlsApplicationViewer viewer; viewer.setMainQmlFile(QStringLiteral("qml/QtQuickControlsTest/main.qml")); viewer.show(); return app.exec(); }

      However, there is no way to use the QML file as a resource with QtQuick2ControlsApplicationViewer. Simply placing the QML file into a resource file and modifying the generated code to use it leads to an error indicating "Your root item has to be a Window."

      A workaround is to modify the generated code to use QQmlApplicationEngine instead.

      Attachments

        Issue Links

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

          Activity

            People

              kkohne Kai Köhne
              yuhsueh Yu-Chen Hsueh (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes