Is there a reason why QSignalSpy doesn't support the new style of writing signals?



  • I'm using Qt 5.4 though looking at the documentation of 5.10 it seems things haven't changed namely for a given QObject * (let's call it obj) with a given signal (let's call it Obj::signalFoo(bool))

    QSignalSpy objS = new QSignalSpy(obj, SIGNAL(signalFoo(bool)));
    

    is possible however

    QSignalSpy objS = new QSignalSpy(obj, Obj::signalFoo(bool));
    

    is not.

    Is there any particular reason why the new style (the second one) is not available here?


  • Moderators

    @Red-Baron In Qt 5.10 it should work, see: http://doc.qt.io/qt-5/qsignalspy.html#QSignalSpy-1
    Did you try with Qt 5.10?



  • You know what...I did such a silly mistake. I forgot the & in front of the class' name and no wonder it didn't work. facepalm I totally missed the second overriding of the QSignalSpy constructor and a big thank you for pointing that out. It clearly states: This function was introduced in 5.4. It also made me notice the mistake I've made in my own code.


Log in to reply
 

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