Results 1 to 3 of 3

Thread: Collect signals from multiple QObjects

  1. #1
    Join Date
    Jul 2015
    Posts
    87
    Thanks
    1
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Collect signals from multiple QObjects

    Hi,

    the Object analogCheck emits a signal finished(), when the analog check has finished.
    The object is created multiple times (up to 20x).
    What is the best way to collect all fnished() signals from all created "analogCheck *dev = new analogCheck(pDev, this)".
    For me i would connect all finished() signals to the same slot and increment a counter with each calling and when
    the counter reaches the counter of created objects i collected all finished() signals.

    Is there a better way?

    Qt Code:
    1. QPointer<deviceAnalog> pDev = new deviceAnalog(channel, serial, devType, this);
    2. analogCheck *dev = new analogCheck(pDev, this);
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Collect signals from multiple QObjects

    Use QList with analogCheck pointers. In slot from signal finished() remove signal sender from list. An empty list means that all objects have finished.

  3. #3
    Join Date
    Jul 2015
    Posts
    87
    Thanks
    1
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Collect signals from multiple QObjects

    Quote Originally Posted by Lesiok View Post
    Use QList with analogCheck pointers. In slot from signal finished() remove signal sender from list. An empty list means that all objects have finished.
    Yes, that's a better idea than a counter. Thank You

Similar Threads

  1. Replies: 2
    Last Post: 8th June 2016, 20:17
  2. Easy to collect video signals by PLC
    By wondertek in forum General Discussion
    Replies: 0
    Last Post: 16th October 2013, 08:03
  3. Multiple slots and signals
    By saad_saadi in forum Newbie
    Replies: 2
    Last Post: 8th August 2013, 10:35
  4. Multiple inheritance of QObjects
    By tescrin in forum Qt Programming
    Replies: 1
    Last Post: 7th January 2013, 22:57
  5. Replies: 3
    Last Post: 26th October 2010, 22:52

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.