[Interest] Odd behaviour when organizing .qml files into folders

Jérôme Godbout godboutj at amotus.ca
Fri Feb 22 20:08:05 CET 2019


And what is the advantage to declare it into the Resources manually? I add my qml to my .qrc files and then add the .qrc to my resources, SO I end up with a single listing of the file into my project tree. I add the qrc:/// to the import path and everything is fine.

Inside my qt.conf:
Qml2Imports = :/

This is the import part to make sure you can make subfolder into the .qrc and use the import into them easily.

For example:

qrc:///MyFolder
qrc:///MyFolder/qmldir
qrc:///MyFolder/MyComponent.qml

// Your other qml file
import MyFolder 1.0

MyComponent
{
}

Maybe I’m missing the point to have them declared over again into the .pro? So if you add/remove a qml file you have to add/remove it at multiple places or rebuild the solution?

I use sub repos and each one of them import their source and .qrc files to the main project with  .pri. It work fine. My project stay clean, here a example of what it look like:
[cid:image002.png at 01D4CAB8.07741BB0]

From: Interest <interest-bounces at qt-project.org> On Behalf Of mail at herrdiel.de
Sent: February 22, 2019 12:59 PM
To: interest at qt-project.org
Subject: Re: [Interest] Odd behaviour when organizing .qml files into folders


Thanks everyone for time, attention and effort!
Am 18.02.2019 um 09:29 schrieb Christian Kandeler:
I suggest the opposite: Don't have a qrc file at all, but let qmake auto-generate it by adding the qml files directly to RESOURCES.

Wow, that's interesting! I've tried that out for starters.

This excerpt from my .pro file shows what I do:

@

ONE.files = qml/AAAA.qml \

             qml/BBBB.qml \

             qml/CCCC.qml

ONE.prefix = /ONE



TWO.files =  qml/DDDD.qml \

             qml/EEEE.qml \

             qml/FFFF.qml \

             qml/GGGG.qml

TWO.prefix = /TWO



RESOURCES += qml.qrc \

    exampledata.qrc \

    oldicons.qrc \

    ONE \

    TWO

@



That leads to this project tree:





[cid:image001.png at 01D4CAB6.C42C4040]



I've read QTCREATORBUG-20103 ("Absolute path shown...") and QTCREATORBUG-22015 ("QML files of dynamically generated..") and now I am confused.

        Am I doing it right?

        The files appear twice (see also bottom qml folder. Do I need to care which one to work on? I don't want to edit a generated file :-)

        Can I get rid of the qmake_ prefix?

        (How) can I address

        Is there a way to get rid of the over-correct folder structure repetitions?

        Will the absolute path be different on a different machine?



Did  I use this feature correctly in the first place?



Best regards,

Sebastian





--

http://www.classintouch.de - Tablet-Software für Lehrer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20190222/853daf45/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 17139 bytes
Desc: image001.png
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20190222/853daf45/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 31594 bytes
Desc: image002.png
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20190222/853daf45/attachment-0001.png>


More information about the Interest mailing list