Qt Creator: View (and debug into) Qt Sources?



  • Hello,

    In the Qt SDK installer I've got the "Qt Sources" installed.

    When using Qt Creator (With MinGW), how do I:

    • Jump to the implementation of a given Qt supplied object or it's methods? F2 only takes me to the header files. (Implementation details would be useful for virtual functions I'm supposed to re-implement)
    • Step in to the Qt source files when debugging. Now, I only see the assembly code for any Qt library frames on the call stack.

    Thank you



  • The problem is that the Qt sources are not provided with the Qt SDK. You can install the Qt 4.7.3 source package yourself though, build it and add it in Qt Creator. This way you should be able to debug the Qt sources.



  • Huh? I installed the sources right from the SDK. You just have to select that you want them. In the tree of items to install, they can be found under Qt SDK -> Miscellaneous -> Qt Sources. I can choose to install versions 4.7.1 through 4.7.3. And yes, they are installed then.



  • I see. nonot1: can you verify that you selected to install the sources?



  • @Andre: Having the sources alone is not sufficient if the libraries are not directly build from it. At the very least you need to create an association from the location where the sources were at compile time to the place were the sources are installed. There's an item in the debugger options, "General" settings.



  • I have not had a chance to play with this again yet. Was thinking of waiting until Qt Creator 2.2 final was released. (what is the schedule for that?)



  • Qt Creator 2.2 final is already released, see:

    http://labs.qt.nokia.com/2011/05/06/qt-creator-2-2-released/



  • Any idea when we may expect an update for the SDK, so we can simply use the SDK updater feature to get the latest and greatest Qt Creator?



  • There has not been set a date for this yet.


  • Moderators

    Updating the sdk with Qt Creator 2.2 now.(just released this afternoon) i have Choosen custom instead of default and got the choises Andre was talking about. Thanks for the hint!



  • I was having problems despite seeing the feature for the source. I am adding this in hopes that it will save others some time. I am using the QtSDK with QtCreator 2.4.1, and I have downloaded the source using the QtSDK package manger. The source is located in the default path (relative to the SDK root) C:\QtSDK\QtSources\4.8.0.

    In the QtCreator options, under Debugger->General you need to click on "Add Qt sources...". Then you need to select C:\QtSDK\QtSources\4.8.0. I was originally making the mistake of selecting C:\QtSDK\QtSources\4.8.0\src - which obviously was failing.

    Once you OK out of the dialog you should be able to debug into the Qt source code in QtCreator.



  • [quote author="bmanc" date="1333571328"]I was having problems despite seeing the feature for the source. I am adding this in hopes that it will save others some time. I am using the QtSDK with QtCreator 2.4.1, and I have downloaded the source using the QtSDK package manger. The source is located in the default path (relative to the SDK root) C:\QtSDK\QtSources\4.8.0.

    In the QtCreator options, under Debugger->General you need to click on "Add Qt sources...". Then you need to select C:\QtSDK\QtSources\4.8.0. I was originally making the mistake of selecting C:\QtSDK\QtSources\4.8.0\src - which obviously was failing.

    Once you OK out of the dialog you should be able to debug into the Qt source code in QtCreator.
    [/quote]

    Thank you for your solution. :)



  • Has anyone tried this with a newer version of Qt and Qt Creator?

    I'm currently trying to use Qt Creator 3.6.1 to debug Qt 5.6.0 for Android (on Windows). The kits were auto generated, once I found a compatible NDK (i.e. android-ndk-r10e-windows-x86), and I am able to debug QML and the C++ in the Qt example app. However I cannot debug the Qt Source, even though I followed the steps mentioned above:

    • I made sure I downloaded the Qt Source when installing Qt.
    • I tried going to Tools -> Options... -> Debugger -> General -> Add Qt sources..., but the paths seem to have changed a bit since bmanc commented four years ago. With Qt installed to C:\Qt\Qt5.6.0AndroidSource, I unsuccessfully tried the following paths: C:\Qt\Qt5.6.0AndroidSource\5.6 and C:\Qt\Qt5.6.0AndroidSource\5.6\Src

    Any help on debugging Qt source (for Android on Windows) would be appreciated. Thanks!



  • @James_Wozniak I had the same problem with the windows Qt 5.6 version. So I had a look into the pdb files. There I found the new path which is "c:/users/qt/work/qt" for the Windows version. Maybe you can have a look into your debugging symbol files for Android and identify the new path.

    TL;DR; If you want to jump into the qt source code while debugging, download source and map source path to "c:/users/qt/work/qt"



  • Sorry to bump an old topic like this but the problem is exactly the same as mine.

    Like said in the topic, to be able to debug into Qt Sources, you are supposed with QtCreator to map the source file by going to Tools->Options->Debug->General->Add Qt sources

    But even by doing so, it doesn't work for me and some help would be really appreciated to solve the issue.
    (The destination path I give is C:\Qt\Qt5.7.0\5.7)



  • @djvi
    Had this bug, too, with the desctop version -- what came out of the button 'Add Qt-Sources' was not usable -- the source-attribute of both entries was not valid. By looking in the pdb-files I added manually an entry with attributes
    source=c:/users/qt/work/qt
    destination=C:\Qt\Qt5.6.0\5.6\Src.
    Take a look into one of your pdb-files and then adapt the paths.
    Added a screenshot of the debugger settings, hope it helps!
    0_1472730942117_debugger_prefs_correct.jpg


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.