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. connecting signals and slots problem
QtWS25 Last Chance

connecting signals and slots problem

Scheduled Pinned Locked Moved General and Desktop
signal & slotconnect
3 Posts 3 Posters 1.2k 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.
  • L Offline
    L Offline
    Lorence
    wrote on 26 Aug 2015, 17:27 last edited by
    #1

    does the signal function and slot function should have the same parameters?

    http://puu.sh/jPpJb/41d5903fcf.png why i keep getting this errors?

    Thanks in advance

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 26 Aug 2015, 17:45 last edited by SGaist
      #2

      hi
      http://doc.qt.io/qt-5/signalsandslots.html
      "
      The signature of a signal must match the signature of the receiving slot. (In fact a slot may have a shorter signature than the signal it receives because it can ignore extra arguments.) "
      So not sure you can mix it the way it seems you try.

      Also it seems you try to include the sender in the signal ?
      you can get the sender in the slot using
      QObject::sender()

      [edit: fixed documentation link to use Qt 5 documentation SGaist]

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 26 Aug 2015, 20:21 last edited by
        #3

        Hi,

        You can't pass a parameter when setting up the connection and since your using Qt 5 you should try the new connect syntax, it helps avoid that mistake.

        There also the possibility of using lambdas for such use case.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0

        2/3

        26 Aug 2015, 17:45

        • Login

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