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

connecting signals and slots problem

Scheduled Pinned Locked Moved General and Desktop
signal & slotconnect
3 Posts 3 Posters 1.3k Views 3 Watching
  • 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 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
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on 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
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on 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

        • Login

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