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. Signal connected to multiple objects/slots - slots call order
Qt 6.11 is out! See what's new in the release blog

Signal connected to multiple objects/slots - slots call order

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 2.8k Views 1 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.
  • K Offline
    K Offline
    kanito73
    wrote on last edited by
    #1

    Hello friends

    I have a doubt about the call order of slots... If I connect a single signal to more than one object/slot, the calls to the slot functions will follow the same order as they were connected?

    For example:

    QObject::connect ( this, SIGNAL(valueChanged(int)), object1, SLOT(slot1(int)) );
    QObject::connect ( this, SIGNAL(valueChanged(int)), object2, SLOT(slot2(int)) );
    QObject::connect ( this, SIGNAL(valueChanged(int)), object3, SLOT(slot3(int)) );

    will it call slot1, slot2 and slot3, or they may be called in aleatory order?

    Thanks for your comments

    1 Reply Last reply
    0
    • JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by
      #2

      Hi, and welcome to the Qt Dev Net!

      See the "QObject documentation":http://doc.qt.io/qt-5/qobject.html#connect-4:
      [quote]If a signal is connected to several slots, the slots are activated in the same order as the order the connection was made, when the signal is emitted[/quote]

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      1
      • dheerendraD Offline
        dheerendraD Offline
        dheerendra
        Moderators Qt Champions 2024 Qt Champions 2022 Qt Champions 2017
        wrote on last edited by
        #3

        They will follow the same order. You can refer to the documentation.

        Dheerendra
        @Community Service
        Certified Qt Specialist
        https://www.pthinks.com

        1 Reply Last reply
        3

        • Login

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