[Development] Using QtCreator for Qt development
Eike Ziller
Eike.Ziller at qt.io
Mon Dec 12 10:20:16 CET 2022
> Am 10/12/2022 um 13:57 schrieb Владимир Белявский <belyavskyv at gmail.com>:
>
> Hello there,
> I suspect that my Qt development process is far away from optimal...
>
> I have a top-level developer shadow build and my process looks like:
> 1. Open source files that need to be changed in QtCreator
> 2. Make changes
> 3. Go to the console and run cmake build
> 4. Go back to IDE and fix the code if build failed
> 5. Repeat p3 and p4 multiple times
> 6. Go to the console and run ctest
> 7. Open failed tests in IDE, investigate the problem, fix code
> 8. Repeat p1-p7 multiple times
> ...
> 42. Go to console, commit and push to gerrit.
>
> So the question - is it possible somehow to open my configured Qt as a normal project in Qt Creator,
Yes.
- register your self-built Qt as a Qt version in Qt Creator
- create a kit that uses that Qt version
- open the CMakeLists.txt from your Qt sources
- choose the kit that you created and your Qt build directory
(It probably is also fine to choose a kit that has _no_ Qt set, but I didn't check. Do _not_ choose a kit with a _different_ Qt though.)
> view all the modules there as separate projects,
If you built Qt with a qt5.git build, then all of Qt is a single project from CMake's point of view, and therefore also from Qt Creator's point of view.
If you want to open individual modules in Qt Creator, you need to configure modules individually.
> build them individually
Qt Creator usually builds the project. There are some other things that can be done, e.g. building specific CMake targets (via Locator "cm", or by choosing the target in the build configuration),
and building "for" a specific run configuration (which is useful for just building & running a test).
> or all together right from IDE,
Yes.
> also view all unit tests there, debug, fix, build and run selected directly and so on?
I think the only well-supported Qt configuration is with QT_BUILD_TESTS=ON and QT_BUILD_TESTS_BY_DEFAULT=ON. Or are there CMake variables to turn individual test on for the build?
Anyway, with both on, you can just choose a test to run & debug. It looks like our autotest integration (the separate "Tests" panel) takes ages looking for tests, but running tests directly as normal run configurations works fine.
Qt also has some mechanism for opening tests as separate CMake projects, but I don't know how that works.
Br, Eike
--
Eike Ziller
Principal Software Engineer
The Qt Company GmbH
Erich-Thilo-Straße 10
D-12489 Berlin
eike.ziller at qt.io
http://qt.io
Geschäftsführer: Mika Pälsi,
Juha Varelius, Jouni Lintunen
Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B
More information about the Development
mailing list