-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
QML modules with cmake #12380
base: master
Are you sure you want to change the base?
QML modules with cmake #12380
Conversation
This looks like a lot of rearranging the deck chairs. But I don't quite understand the underlying benefit of this change? Can you explain what's gained here? |
Is it basically all about this:
Which does all the qml module magic whereas before we need to set the resources correctly and qmldir manually and so forth? |
cedc18b
to
1f5cf1b
Compare
The main benefit is the migration to the mechanisms for working with QML modules in qt6 as old approach with qrc files is deprecated and don't recommended for modern qt applications. |
This code creates an independent qml module that is compiled as a static library and embedded into the application. Then you can use the |
Yeah the improved static analysis and performance from compiling is really nice. I wanted to get to this but it was a decent amount of work to get working |
Yes, it's a lot of work. I don't have much free time, but I already migrated FlightDisplay, FlightMap and json files, and if this approach works for the original qgc, I can create another PR's with these changes. |
Looks like all good stuff then. I"m concerned about leaving it half done. We need to work towards wrapping up 5.0. If this could get fully done in the next couple months then I'm ok with it. |
Can someone create an Issue for completing the work on this? And then if anyone picks up a setup to convert make a note in there so we don't end up working on the same things. |
I think I can do it next month if I have enough time. But I don't see any conflict even in partial migration, these 2 approaches can be combined without problems |
There is no conflict. It just makes it harder to navigate the source since it's inconsistent. |
What do you mean? To me, this is a much simpler approach to navigating and organizing code. Am I missing something? |
Not at all. I'm just saying for someone looking through the source for the first time it can be confusing to see something done two different ways. |
@s-lisovenko So I wondering about the movement of qml files into a parallel universe of src/UI directories. For example: Before the PlanView directory included all the stuff associated with the PlanView. Both C++ and qml controls. But now things are in two places. I'm not sure that's better from a discoverability standpoint. What is the reasoning behind those moves? |
I know Qt used to be designed in a way where it was recommended to put QML files in their own directory tree, although they now provide options in CMake making that less important. One of the perks of autogenerated qmldir files |
This is a good question, there are different strategies. What logic did I follow and what do I use in my production applications:
As for PlanView, PlanView should be part of the MissionManager module(my opinion) with backend and frontend. But since at the moment it was a separate folder of qml files, I placed it in the UI folder, since unfortunately I do not have much time to radically rework the application structure. |
Exactly, especially starting with qt 6.8 you have no any restrictions with project organization |
So last night I realized this new mechanism caused a significant problem with custom builds. The concept of resource overrides in custom builds is a fundamental aspect of omodifying the QGC ui to fit the needs of a custom build. The custom build example has a number of example usages of this. By moving to this new model as far as I can tell this is no longer possible. That's a really big problem. Do you see any way to move to this new model but keep the resource override concept? |
I'm not very familiar with the concept of custom build in QGC, as I've never used it. When I quickly looked through it, I didn't see anything overridden except the icons. The concept of QML plugins is not new, it is a separate module that can be reused in different parts of the application. Could you describe what exactly the problem is? About icons for now we can leave it as part of qrc system as it more flexible. |
You can see examples of this being used in custom-example/qgroundcontrol.exclusion and friends. It allows the custom example build to add custom actions to the toolstrip and overlay things onto the FlyView |
looks like we can control this with a cmake array? We can add any resources we want to the module and control it all at the configure stage. |
There's that, but there's also the concept of import path priority. I'm pretty sure if you have a path like Qt/Qml/QGroundControl, and Qt/Qml/Custom, whichever you import first will take precedence when loading modules with the same name. Theres also cmake options like QT_QML_SKIP_QMLDIR_ENTRY and QT_DISCARD_FILE_CONTENTS and QT_RESOURCE_ALIAS that may help otherwise. |
For reference here are some new gstreamer cmake scripts from 1.25.1 Edit: Wrong comment section but whatever |
That seems promising. Sure would be nice to move into the 21st century with this qml cmake stuff. |
I don't quite understand what you mean here. Take this for example:
How would import path help you with that? |
Basically I just mean the order of the following should matter:
In that case, if you have some module called MainRootWindow.qml in both paths, then it should take the one imported first. But I think it could be affected by things done in CMake too, just not 100% as I've never tried and it's been a while since I remember reading a post about it. |
Create separated qml plugins used qt6 cmake functionality
Create next separated qml plugins:
First step in reworking old QML integration with .qrc files
Checklist:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.