Qt Forum

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

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

    General and Desktop
    2
    3
    363
    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.
    • R
      Red Baron last edited by

      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?

      jsulm 1 Reply Last reply Reply Quote 0
      • jsulm
        jsulm Lifetime Qt Champion @Red Baron last edited by

        @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?

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply Reply Quote 4
        • R
          Red Baron last edited by

          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.

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