Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. [SOLVED] How to jump from function declaration to function definition.
QtWS25 Last Chance

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

Scheduled Pinned Locked Moved Qt Creator and other tools
12 Posts 5 Posters 20.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vincegata
    wrote on last edited by
    #1

    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!

    1 Reply Last reply
    0
    • B Offline
      B Offline
      bobby
      wrote on last edited by
      #2

      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

      "Linux is not user-friendly." It is user-friendly. It is not ignorant-friendly and idiot-friendly.
      ---Source unknown

      1 Reply Last reply
      0
      • V Offline
        V Offline
        vincegata
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0
        • B Offline
          B Offline
          bobby
          wrote on last edited by
          #4

          Glad to help.

          "Linux is not user-friendly." It is user-friendly. It is not ignorant-friendly and idiot-friendly.
          ---Source unknown

          1 Reply Last reply
          0
          • V Offline
            V Offline
            vincegata
            wrote on last edited by
            #5

            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!

            1 Reply Last reply
            0
            • L Offline
              L Offline
              lgeyer
              wrote on last edited by
              #6

              I'll attach to this question.

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

              1 Reply Last reply
              0
              • T Offline
                T Offline
                tobias.hunger
                wrote on last edited by
                #7

                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.

                1 Reply Last reply
                0
                • L Offline
                  L Offline
                  lgeyer
                  wrote on last edited by
                  #8

                  [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.

                  1 Reply Last reply
                  0
                  • T Offline
                    T Offline
                    tobias.hunger
                    wrote on last edited by
                    #9

                    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:-)

                    1 Reply Last reply
                    0
                    • V Offline
                      V Offline
                      vincegata
                      wrote on last edited by
                      #10

                      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.

                      1 Reply Last reply
                      0
                      • K Offline
                        K Offline
                        kkrzewniak
                        wrote on last edited by
                        #11

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

                        Me, Grimlock, not "nice dino". ME BASH BRAINS!

                        1 Reply Last reply
                        0
                        • V Offline
                          V Offline
                          vincegata
                          wrote on last edited by
                          #12

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

                          1 Reply Last reply
                          0

                          • Login

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved