Skip to content

Instantly share code, notes, and snippets.

@oclero
Last active September 20, 2021 16:02
Show Gist options
  • Save oclero/2d570a9f3ae223b8e974d10ee4747eba to your computer and use it in GitHub Desktop.
Save oclero/2d570a9f3ae223b8e974d10ee4747eba to your computer and use it in GitHub Desktop.
How To Step into Qt Source Code to Qt Creator

To step into Qt source code in QtCreator, you'll need two steps:

  1. (step 1) Open the settings dialog with the menu Tools > Options, then in the tab Debugger, in the sub-tab General, in the Source Paths Mapping part, click on the Add Qt Sources... button. Then select the <path_to_qt>/Src directory path. Exemple: C:\Qt\5.15.2\Src if you're on Windows and installed Qt in the default directory.

    This will allow you to step into Qt source coed, but not set breakpoints in cpp files (unless they're already open). You need step 2 for that.

  2. In the Environment tab, then the Locator sub-tab, you can add custom search directories, in the Custom part in the treeview. Choose that part and click on the Add... button (step 2a). Configure the new dialogas your will (step 2b). For example, I've only selected C:\Qt\5.15.2\Src\qtbase\src\widgets, that I've named "QtWidgets".

    Now the QtWidgets source code is fully browsable in QtCreator. Try CTRL+K and look for a Qt .cpp file to see if it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment