[Interest] Loader not finding QRC prefix entries
mark diener
rpzrpzrpz at gmail.com
Fri Apr 17 01:18:03 CEST 2015
Loader and QRC Prefix problem SOLVED.
You must put the prefix identifier and then put the directory that contains
the QML file
A little backwards but at least it works.
Given the previous scenario:
source: "/sm/sm/list.qml"
Thanks all.
On Thu, Apr 16, 2015 at 3:36 PM, mark diener <rpzrpzrpz at gmail.com> wrote:
> 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/7a0e952c/attachment.html>
More information about the Interest
mailing list