[Interest] Loader not finding QRC prefix entries

mark diener rpzrpzrpz at gmail.com
Fri Apr 17 00:36:11 CEST 2015


 The loader should have read:

    Loader {

        id: genload

        anchors.fill: parent

        asynchronous: true

        source: "/sm/list.qml"

        focus: true

        onLoaded: {


        }

    }



On Thu, Apr 16, 2015 at 3:30 PM, mark diener <rpzrpzrpz at gmail.com> wrote:

>
> Hello:
>
> Qt 5.4.1, Qt Creator 3.3.2, Mac OSX Yosemite
>
> I have tried to organize my qml files using QRC prefix
>
> Actual QML file locations:
> $projectdir$/qml/qml.qrc
> $projectdir$/qml/main.qml
> $projectdir$/qml/sm/list.qml
>
> qml.qrc resource definiton as seen in Qt Creator:
>
> Resources
> >>>qml (dir)
> >>>>>>qml.qrc
> >>>>>>>>>/
> >>>>>>>>>>>>main.qml
> >>>>>>>>>/sm
> >>>>>>>>>>>>list.qml
>
>
> C++ loads main OK:
>
> engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
>
>
>
> main.qml:
>
> import QtQuick 2.4
>
> import QtQuick.Controls 1.3
>
> import QtQuick.Window 2.2
>
>
>
> ApplicationWindow {
>
>
>     id: gmainwin
>
>
>     height: Screen.height
>
>     width:Screen.width
>
>
>     visible: true
>
>     color: "white"
>
>     opacity: 1
>
>
>     Loader {
>
>         id: genload
>
>         anchors.fill: parent
>
>         asynchronous: true
>
>         source: "/sm/login.qml"
>
>         focus: true
>
>          onLoaded: {
>
>
>         }
>
>     }
>
> }
>
>
> When I run the project, I get the error:
>
> qrc:/sm/list.qml: File not found
>
> I have tried many ways specifying the source: property for the loader.
>
> Examples:
>
> source: "/sm/list.qml"
>
> source: "qrc:///sm/list.qml"
>
> source: "qrc:/list.qml"
>
> source: "/sm/list.qml"
>
> source: "list.qml"
>
> source: ":/sm/list.qml"
>
>
> Anybody know how to use prefixes in the QRC resource file and still have
> loader actually find the source: value.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150416/ad8b08f1/attachment.html>


More information about the Interest mailing list