Qt Creator "Follow Symbol Under Cursor"



  • Hello everyone,

    I find "Follow Symbol Under Cursor" feature very useful and I use it frequently in my everyday work. But there is one issue, which sometimes makes this feature totally useless.
    Mostly I am working with C/C++ projects in Qt Creator and if I have some function defined in 1 header (interface), but there is several different implementations (depending on build configuration), pressing the "Follow Symbol Under Cursor" shortcut just moves me to one of the implementations, so I have no chance to choose, in which implementation I am interested in right now.
    From my point of view, it will be more useful, if in case of more than 1 implementation Qt Creator will ask me about it (some drop-down list, for example), so I will be able to choose particular implementation.

    Is there any additional configuration options in Qt Creator, which I should check, or there is no such functionality so far?

    UPDATE: I've created a suggestion ticket Qt's JIRA:
    https://bugreports.qt.io/browse/QTCREATORBUG-14257



  • Hi,
    The solution is in multiple files. When you have multiple definitions of your functions and only 1 declaration you should place those definitions into multiple files and in your project file include the right cpp or c file that holds the wanted definition.
    e.g.
    #(CONFIGURED_A) // Or something like this, read the docs
    SOURCES += MyFirstFile.c
    #else
    SOURCES += MySecondFile.c
    #endif



  • @Jeroentjehome
    Thanks for the reply. It fixes the problem, for sure.
    But in the other hand such feature would be very useful.
    I will create a feature request and post it here later, if somebody else is also interested.


Log in to reply
 

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