QT Project refactoring / General questions about qt project structures
-
Hey guys,
I am working on a larger qt project, that I should refactor. At the moment this project is a single pro file with a lot of qml and image files. Since we could only use qml and no c++ till now (because of some historical reasons in the old application structure). From now on we want to use QT to improve the performance by for example creating our own models. For that I want to restructure the project a bit.
I informed myself a little on what is the best approach for this. My final take is to use a subdir project. It should look a bit like the following:
/Application/Application.pro
/Application/app/app.pro
/Application/app/app.qrc
/Application/app/...qml
/Application/libs/charts/charts.pro
/Application/libs/utils/utils.proDoes this project structure makes sense? In the end we would have some libs that contain qt/qml modules that I can import in the app. The charts lib for example would be a shared plugin lib that is used by the application. The charts lib provide some models from C++ and some charts from qml.
Does it make sense to abstract everything in its own lib. Because I always want to import them from qml using import Application.Charts 1.0 or import Application.Utils 1.0. Does it make sense to stay with qmake or should I switch to cmake? Currently we are using QT5 but with the refactoring we could also switch to QT6.
I also tried to set up a project with a plugin lib and and an app.pro but I failed to get it running. I always get some new errors. Does anyone know some good resources about this? I find it hard to get good resources or even just an simple example project.
-
Hi and welcome to devnet,
To your last question, yes you should move to CMake. There have been new features added in Qt 6 that will likely be of use for your project but that are only available through cmake.
As for examples... maybe check some of the KDE's core projects. They already use CMake and some mix QML and C++.