[SOLVED] Trouble with import



  • Hey,

    I am trying to put my qml files into directories. But for some reason the imports do not work during runtime (qt creator has not trouble finding the types). Here is a minimal example:

    qml.qrc:

    <RCC>
        <qresource prefix="/">
            <file>main.qml</file>
        </qresource>
        <qresource prefix="/area">
            <file>area/Area.qml</file>
        </qresource>
    </RCC>
    

    main.qml:

    import QtQuick 2.5
    import QtQuick.Window 2.2
    
    import "area"
    
    Window {
        visible: true
        Area {}
    }
    

    area/Area.qml:

    import QtQuick 2.0
    
    Rectangle {
        anchors.fill: parent
        MouseArea {
            anchors.fill: parent
            onClicked: {
                Qt.quit();
            }
        }
    }
    

    The error (during runtime) is:

    QQmlApplicationEngine failed to load component
    qrc:/main.qml:8 Area is not a type
    

    Why is Area not found?

    Thanks!
    Nathan


  • Moderators

    Hi @RudolfVonKrugstein I have explained a similar one here.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.