Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Is there a reason why QSignalSpy doesn't support the new style of writing signals?
Qt 6.11 is out! See what's new in the release blog

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

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 1.3k Views
  • 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 Offline
    R Offline
    Red Baron
    wrote on last edited by
    #1

    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?

    jsulmJ 1 Reply Last reply
    0
    • R Red Baron

      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?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @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
      4
      • R Offline
        R Offline
        Red Baron
        wrote on last edited by
        #3

        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
        1

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved