[SOLVED] How to jump from function declaration to function definition.



  • Hello,

    I am on Ubuntu / GCC.

    If I step on a function declaration in header file how can I jump to this function definition in cpp file? (F2 does not work in this case).

    THX!



  • What version are you running? For reference to this I opened up Qt Creator 2.2.1 and opened the Network> Broadcast Receiver demo and F2 worked as expected on the Receiver() function in the header file receiver.h



  • It does work. Sorry. It's getting late here in the US.



  • Glad to help.



  • On the same note, I am including a header file #include "quickfix/SocketInitiator.h"

    and linking a library libquickfix.so that contains classes declared in SocketInitiator.h.

    Also, I have all the source code for the library including SocketInitiator.cpp.

    How would I be able to step into SocketInitiator.cpp while debugging?

    Thanks!



  • I'll attach to this question.

    Has anyone managed to use F2 / Shift-F2 to jump into Qt sources (headers work fine as expected)?


  • Moderators

    Just jump into the header and then hit F4 to go to the cpp file. Once it is loaded it is available via F2 as well.

    The reasoning is that we only want to parse the code that is used in your project: That is your sources and the headers those use. Parsing random .cpp files that happen to be located next to the headers you use will only slow down the parsing as well as the completion itself and does blow up memory usage, too.



  • [quote author="Tobias Hunger" date="1309415289"]Parsing random .cpp files that happen to be located next to the headers you use will only slow down the parsing as well as the completion itself and does blow up memory usage, too.[/quote]

    Sounds reasonable.

    But what do people use then to dive into the Qt sources? I find it really cumbersome to comb through most of the sources just to find the implementation of a specific Qt function.

    Is it possible to instruct QtCreator to index a specific directory which is not in the project?

    I think I generally would like the idea of having "static indices", which can be generated at build time and then serve as an index to QtCreator.


  • Moderators

    I just do the F2/F4 combo most of the time.

    If I really care about Qt stuff, then I just open Qt as a project:-)



  • I do not quite understand the purpose of F4. I think F2 would be enough if it could load a file and jump into function (and etc.) definition as F4 does. Once header and cpp are loaded F2, F4, and Shift-F2 have the same functionality - sort of excessive.



  • I usually use F4, but I also ctrl+click on the method to jump form definition to source and back.



  • F4 does not work if the file you want to jump to is not already open.


Log in to reply
 

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