Navigate Qt Source Code in Qt Creator



  • Hi.
    I know that stepping into Qt Source Code when debugging is possible. I have set this up in Windows and it works (I was tricked at first into thinking that I needed to build the Qt libraries from source in order for this to work, and which I did, but that is not at all necessary. You only need the source and create the mapping in the Debugger settings).

    However, I would find it much more useful if I could directly navigate to the implementation of a Qt method from the editor, via Follow symbol under cursor and Switch between function declaration/definition.

    Follow symbol under cursor works to view definitions in the Qt headers, but it does not work with Qt Source files. Why is there no such functionality although the full source is available?



  • @Diracsbracket said in Navigate Qt Source Code in Qt Creator:

    Why is there no such functionality although the full source is available?

    i think it's because the source is not added to the build tree so the tool did not map it internally.

    I find that, to navigate the source code of qt, the web tool of woboq is super useful. You can simply click on functions and variables to have the "Follow symbol under cursor" and "Switch between function declaration/definition" effect. It's also very easy to search stuff into it



  • @VRonin said in Navigate Qt Source Code in Qt Creator:

    i think it's because the source is not added to the build tree so the tool did not map it internally.

    I don't really understand what that means, but the Woboq online source navigator is great for sure; thanks for the link. So now all that needs to be done is find to an interface from Qt Creator to Woboq... ;-)



  • @Diracsbracket said in Navigate Qt Source Code in Qt Creator:

    I don't really understand what that means

    [disclaimer: an amount of simplification and speculation is involved in the below]
    To enable "Follow symbol under cursor" and "Switch between function declaration/definition" Qt creator does not search the files every time. It creates a database from all the files in your .pro. The Qt source is not scanned to build such a db so the functionality is not available



  • @VRonin said in Navigate Qt Source Code in Qt Creator:

    The Qt source is not scanned to build such a db so the functionality is not available

    Then, would it be overly complicated/too much of a hassle to create such functionality? If people are willing to compile Qt from source, I'm sure they wouldn't mind the extra processing to generate such a DB.



  • You can probably just add qt.pro file to your project but don't expect it to be lightweight



  • @VRonin said in Navigate Qt Source Code in Qt Creator:

    You can probably just add qt.pro file to your project but don't expect it to be lightweight

    I tried that, and indeed it is not a workable solution. Thanks :-)


Log in to reply
 

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