Please nominate your Qt Champions for 2021!

Program with qml in resource file don't open non-main qml files

  • I installed Qt 5.0.1 for Windows 32-bit (MinGW 4.7, 823 MB)

    Then I created simple Quick 2 application.
    I have two simple qml files:
    @import QtQuick 2.0

    Rectangle {
    width: 360
    height: 360
    Text {
    text: qsTr("Hello World")
    anchors.centerIn: parent
    MouseArea {
    anchors.fill: parent
    onClicked: {



    @import QtQuick 2.0

    Item {
    width: 93
    height: 93

    Rectangle {
        width: 50
        height: 62
        color: "red"


    And the program is working well. Then I put the qml files into the resource res.qrc in prefix qml and change main.cpp:

    @#include <QtGui/QGuiApplication>
    #include "qtquick2applicationviewer.h"
    #include <QUrl>
    #include <QDebug>
    #include <QQmlContext>
    #include <QQuickItem>

    int main(int argc, char *argv[])
    QGuiApplication app(argc, argv);

    QtQuick2ApplicationViewer viewer;
    return app.exec();


    And the program does not work. The second file HarrixMainButton.qml is not loaded. Only the main first file main.qml is loaded.

    @qrc:qml/qml/HarrixAI/main.qml:16:5: HarrixMainButton is not a type
    Unable to find a renderable master window QtQuick2ApplicationViewer(0x28fe08) when trying to render QtQuick2ApplicationViewer(0x28fe08) ( QRect(8,30 116x0) ).@

    How to fix the problem? In Qt 4.7 with Qt Quick 1.1 same method works.

  • Please file a bug about this issue on JIRA.


  • I created report of a bag:
    I hope the problem will be solved.

Log in to reply