Qt wiki will be updated on October 12th 2023 starting at 11:30 AM (EEST) and the maintenance will last around 2-3 hours. During the maintenance the site will be unavailable.

Using Qt Creator for Qt hacking

From Qt Wiki
Jump to navigation Jump to search


Why not use a cute IDE based on Qt to do some hacking on Qt?

Here is a guide to setup a Qt Creator based development environment (QDE) for Qt:

Prepare a developer build

For detailed instructions see Building Qt 5 from Git. Using a shadow build should work which will keep the working directory clean of build artifacts:

MAKEFLAGS=-j14 ../../qt5_12/configure -developer-build -opensource -nomake examples -nomake tests -skip qtwebchannel -skip qtscript -skip qt3d -skip qtdatavis3d -skip qtremoteobjects -skip qtserialport -skip qtvirtualkeyboard -skip qtwebengine -opensource -confirm-license

Please adjust MAKEFLAGS, paths and the list of skipped modules to your preferences.

Register the development Qt Version in Qt Creator

Goto Qt Creator/Preferences/Kits/Qt Version/Add... and select the qmake binary in build-dir/qtbase/bin.

Add a Development kit

Goto Qt Creator/Preferences/Kits/Kits/Add

  • Name: Something like "Desktop Qt %{Qt:Version} clang DEV 64bit"
  • Qt-Version: Select your development version

Open a Qt module project file

Use File/Open Project and select qtbase.pro or whatever module you are planning to fix all the nasty bugs in.

In Project Configuration select your Development kit (some magic might have actually selected the right one for you!). You should limit the build configurations to the ones you actually need, maybe only "Debug".

Build

Building should now work out of the box. The project's build folder should be your shadow build folder if everything is setup correctly. You can check this in the project's build configuration.

First time builds might trigger a one time qmake invocation because the qmake arguments set by Qt Creator differ from the ones given during the initial developer build. But hopefully this should only regenerate the makefiles but not rebuild the whole project.

Have fun!