Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Program with qml in resource file don't open non-main qml files
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 1.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Harrix
    wrote on 27 Feb 2013, 17:46 last edited by
    #1

    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:
    main.qml
    @import QtQuick 2.0

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

    }
    

    }@

    HarrixMainButton.qml
    @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;
    //viewer.setMainQmlFile&#40;QStringLiteral("qml/HarrixAI/main.qml"&#41;);
    viewer.setSource(QUrl("qrc:qml/qml/HarrixAI/main.qml"));
    viewer.showExpanded();
    
    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.

    1 Reply Last reply
    0
    • C Offline
      C Offline
      chrisadams
      wrote on 1 Mar 2013, 07:30 last edited by
      #2

      Please file a bug about this issue on JIRA.

      Thanks,
      Chris.

      1 Reply Last reply
      0
      • H Offline
        H Offline
        Harrix
        wrote on 1 Mar 2013, 14:00 last edited by
        #3

        I created report of a bag: https://bugreports.qt-project.org/browse/QTBUG-28357
        I hope the problem will be solved.

        1 Reply Last reply
        0

        3/3

        1 Mar 2013, 14:00

        • Login

        • Login or register to search.
        3 out of 3
        • First post
          3/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved