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

Furkan Üzümcü furkanuzumcu at gmail.com
Mon Feb 18 03:19:10 CET 2019


I think it would be more helpful If we see your .pro file as well. But I'll tell you what I can say from what I understand.

Qt Creator displays the files inside arc file in the project tree as well. So, I don't think you need to add the QML files to DISTFILES too. If you remove them from there and only add them to the arc file, you should be fine.

Here's my folder structure as an example:


Regards,
Furkan Üzümcü
On Feb 17, 2019, 05:43 -0500, mail at herrdiel.de, wrote:
> Hi,
>
> in order to keep a big project organized I understand that it is good
> practice to have a structure of folders, each containing a bunch of code
> files that belong  together. There must be a proper name for that, maybe
> "project tree" or "code hierarchy" - I don't know (I am almost totally
> self-taught).
>
> The QtCreator, being a good IDE, further separates .h from .cpp files,
> presenting them as different (virtual) folder structures. As a
> speciality for Qt, the .qml files have been integrated as a folder
> inside Sources.
>
> Can you tell me a starting point for some "best practice" information on
> how to achieve a proper folder hierarchy within that qml folder?
> QtCreator behaves a little odd here, it seems to have two
> "philosophies", interfering with one another.
>
> My structure *before* having a subfolder for my .qml files (simplified a
> lot):
>
> Project
> - myProject.pro
> - Headers
> - - src
> - - - controller // many .h files in nested folder structures
> - - - model  // many .h files in nested folder structures
> - Sources
> - - src
> - - - controller // many .cpp files in nested folder structures
> - - - model // many .cpp files in nested folder structures
> - - qml
> - - - qmlFile1.qml
> - - - qmlFile2.qml
> - - - qmlFile3.qml    // everything crammed into one folder without
> hierarchy, in alphabetical order
> - - - qmlFile4.qml
> - - - qmlFile5.qml
> - - main.cpp
> - - qml.qrc // automagically organized by QtCreator, in chronological order
>
> I would like to have an organizing folder structure for the .qml files,
> too. But when I start doing this (for example with "add existing
> directory"), QtCreator reacts "interestingly":
>
> - #1: The new folder does *not* appear inside the qml folder, but inside
> a new "top level" entry "QML", alongside Headers and Sources
> - #2: Every file from the Sources/qml folder reappears here, as an entry
> doublette
> - #3: In myProject.pro all .qml files (incl. the new one) are being
> added to DISTFILES (probably the reason for #2)
> - #4: The resource file qml.qrc has not changed, the new file in the
> subfolder is missing here.
>
> Project
> - myProject.pro
> - Headers
> - Sources
> - - qml  // like before, without the new folder and file
> - - main.cpp
> - - qml.qrc // no entry for the new folder or the new file
> - QML
> - - newFolder
> - - - newQmlFile.qml // << my new folder and file structure
> - - qmlFile1.qml
> - - qmlFile2.qml
> - - qmlFile3.qml    // everything from Sources/qml reappears here
> - - qmlFile4.qml
> - - qmlFile5.qml
>
> What is the recommended way to organize my .qml code base without having
> entry doublettes? Is it possible to have qml.qrc working like before?
>
> Thanks for reading!
>
> Sebastian
>
> -
> http://www.classintouch.de - Tablet-Software für Lehrer
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> https://lists.qt-project.org/listinfo/interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20190217/31d0a6d0/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Project Tree.png
Type: image/png
Size: 99994 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20190217/31d0a6d0/attachment.png>


More information about the Interest mailing list