Results 1 to 9 of 9

Thread: Confusing Signal/Slot behaviour, more than one slot firing, why?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2009
    Posts
    22
    Thanks
    2
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Confusing Signal/Slot behaviour, more than one slot firing, why?

    Hi, I was wondering if someone could clear something up for me here. I have a User class that holds basic info like name etc that I want to load per user, it another function I have linked up some the signals emitted from the class to the slots in the constrctor. It looks something like this.

    Qt Code:
    1. connect(userA, SIGNAL(isLoaded()), this, SLOT(onALoaded()));
    2. connect(userB, SIGNAL(isLoaded()), this, SLOT(onBLoaded()));
    3. }
    4.  
    5. UserData* userA;
    6. UserData* userB
    7.  
    8. private slots:
    9. void onALoaded()
    10. {
    11. //some A stuff
    12. }
    13.  
    14. void onBLoaded()
    15. {
    16. //some B stuff
    17. }
    To copy to clipboard, switch view to plain text mode 

    What I am finding is that both slots are firing even though the signal originates from two different objects. This obviously cannot be correct, this would mean every push button defined would fire every slot a push button is connected too, so what could have gone wrong in my case?

    Thanks
    Last edited by hybrid_snyper; 6th November 2012 at 14:26.

Similar Threads

  1. Replies: 2
    Last Post: 3rd May 2011, 20:22
  2. QProcess finished slot not firing
    By doggrant in forum Qt Programming
    Replies: 0
    Last Post: 10th November 2010, 13:09
  3. Wierd behaviour in a slot routine
    By koenig in forum Newbie
    Replies: 7
    Last Post: 29th January 2010, 07:27
  4. pointers behaviour in qt and specially signals/slot mechanism
    By salmanmanekia in forum Qt Programming
    Replies: 5
    Last Post: 17th August 2008, 19:34
  5. signal slot conection using a string, not a SLOT
    By rianquinn in forum Qt Programming
    Replies: 6
    Last Post: 5th February 2006, 18: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.