Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

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

    Tools
    5
    12
    18940
    Loading More Posts
    • 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
      vincegata last edited by

      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 Reply Quote 0
      • B
        bobby last edited by

        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 Reply Quote 0
        • V
          vincegata last edited by

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

          1 Reply Last reply Reply Quote 0
          • B
            bobby last edited by

            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 Reply Quote 0
            • V
              vincegata last edited by

              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 Reply Quote 0
              • L
                lgeyer last edited by

                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 Reply Quote 0
                • T
                  tobias.hunger last edited by

                  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 Reply Quote 0
                  • L
                    lgeyer last edited by

                    [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 Reply Quote 0
                    • T
                      tobias.hunger last edited by

                      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 Reply Quote 0
                      • V
                        vincegata last edited by

                        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 Reply Quote 0
                        • K
                          kkrzewniak last edited by

                          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 Reply Quote 0
                          • V
                            vincegata last edited by

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

                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post