[Interest] qt_add_qml_module() RESOURCES vs qt_add_resources()
ekke
ekke at ekkes-corner.org
Thu Mar 14 21:10:02 CET 2024
Hi Mike,
in the meantime I made some progress and got my projects (with QML and
CPP files organized in subdirectories) working without
NO_RESOURCE_TARGET_PATH :)
Also QML_ELEMENT is working, only QT_QML_SINGLETON_TYPE isn't yet.
more details: https://bugreports.qt.io/browse/QTBUG-111763
next topic: looking for a way to refactor ContextProperties into
QML_SINGLETON with c++ ownership
so step-by-step ;-)
ekke
Am 18.02.24 um 14:07 schrieb ekke:
> Hi Mike,
> thanks for your great answer.
> I can second your advices.
> ekke
>
> Am 17.02.24 um 01:00 schrieb Mike Trahearn via Interest:
>> My second advice is more for Ulf - despite your best efforts to
>> educate people in how QML modules have changed the way we should
>> think about our QML organisation since Qt 5, people still have
>> trouble grasping these points:
>>
>> a) what is a QML module anyway? You say whaaaat? Yes, people are
>> still on Qt5 with a Qt5 mindset. It took me ages to work out how to
>> retrain my thinking - and it does for others too. But I would add it
>> is well worth it and does make life a lot easier when you set it up.
>> Alexandra Betouni's recent #QtStories article leans into exactly this
>> point (it's a great read and I absolutely echo her observations and
>> sentiments).
>>
>> b) the thing Ulf and I spoke about in Berlin, which was the very
>> basic fundamental structure of a relatively simple app where all the
>> modules are defined under the "recommended" structure which is
>> guaranteed to work without any fiddling. This is a great starting
>> point for learners, new projects and so on. However...
>>
>> c) For many people, like those here, are not starting from an ideal
>> place of legacy and in Ulf's words, already using and relying on
>> "degenerate modules".
>>
>> While this is unfortunate, it happens and Qt5 allowed that to happen.
>> So when we move things to Qt6 we have a number of steps to consider.
>>
>> 1) moving to CMake
>> 2) formally defining the QML modules in CMake
>> 3) fixing all the QML so it works within the rules
>> 4) going back to CMake to fix the module definitions according to the
>> *allowed* additional properties having considered their exacting
>> requirements and rationale.
>>
>> This has been my own experience so I know what I'm talking about and
>> understand both the pain and the frustration and have vented myself
>> at "why doesn't it work like I expect" and poor Ulf has copped my
>> wrath on more than on occasion. However, I am educated now and we are
>> still friends.
>>
>> d) Ulf write a great little blog series about QML Modules back around
>> Qt6.2. But when you look at those now, some of the information there
>> is dated although the principles are sound.
>>
>> So Ulf, with your inimitable fashion of freely advising not to use
>> foot guns and with your unique sense of humour, would you be prepared
>> to write an updated blog - yay verily may I suggest work with Ash
>> Walton and get it up on the Qt Academy?
>> I would suggest and recommend it as absolute mandatory reading for
>> anyone. I'd even go as far to say "did you do that course" as a first
>> response.
>>
>> There would be some simple steps to cover based on just reworking
>> that blog series:
>>
>> 1 - how it used to be in Qt5 (and why it needed to change)
>> 2 - What is a QML module
>> 3 - Plugin and Backing targets (most confusing for some) and when to
>> link to what given static or shared configurations
>> 4 - simple application structure
>> 5 - a nod to the resource prefix and the new load component main.cpp
>> bootstrap.
>> 6 - a reasoned example (image provider) where you have to use one of
>> the NO options and how a "do it yourself" plugin class looks like.and
>> works in practice.
>> 7 - alternative workarounds for where your source structure cannot
>> match the default expected structure, but how to at least exchange
>> bullets for liquorice in your foot gun if you have to (like me - I
>> don't like the taste, but I don't eat with my feet).
>> 8 - the code model is gleaned from the build folder NOT the source
>> folder.
>> 9 - you don't need to write qmldir or qmltypes
>> 10 - how to declare singletons and internal types.
>> 11 - if you are feeling sadistic you could also cover singletons and
>> ownership but don't be cruel.
>>
>> There's obviously scope for breaking this up into a learning path
>> with several short courses inside building on the last.
>>
>> I really think this would be gold in the hands of the reader in
>> helping them get past this quite large code and paradigm change into
>> a world of much more power, flexibility and productivity.
>>
>> I do hope you get your project into the shape you need. It does sound
>> like but of a pickle at the moment but it is not going to be
>> difficult to get you straight so do not fear or get frustrated.
>>
>> We will get you there!
>>
>
>
> _______________________________________________
> 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/20240314/bd6a2925/attachment.htm>
More information about the Interest
mailing list