Nominate our 2022 Qt Champions!

Refactoring of Signals

  • Hi,

    I found a problem regarding the refactoring of signals. When I rightclick on the definition of a signal, and choose "find usages" qtcreator doesn't show me the connects of that signal.
    Here's an example

    in glwidget.h:
    void pointAdded();

    I right-click on "pointAdded()" and chose "find Usages"

    The following lines of code are being found:
    emit pointAdded(); (in glwidget.cpp)
    void pointAdded(); (in glwidget.h)

    but this line is NOT found:
    connect (glWidget, SIGNAL pointAdded, this, SLOT updatePushButtons; (in file mainwindow.cpp)
    ( I intentionally removed some parentheses because the forum software was doing strange things)

    If I do this for a slot on the other hand, all lines of code are being found. (including connects in other files)
    Also, the refactoring/renaming function doesn't work for the signal, because in the lines beginning with connect... the name of the signal isn't changed. It works fine for slots though.

    I use qtcreator 3.2.1, (and also 2.8.1).
    Is this a bug? Is there maybe a workaround other than using the find function for signals?


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    I don't know it can be considered as usage in the sense that it's not "active". What happens if you use the new connection style ?

  • Hi,

    thank you for the tip, it works! With the new connection style the occurrence of the signal in the connect order is found when using the "find usages" option.
    I like the new connection style :)


  • Lifetime Qt Champion

    You're very welcome,

    Since you have it working correctly now, please update the thread title prepending [solved].

Log in to reply