Results 1 to 13 of 13

Thread: how to know which signal is called a certain slot?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2015
    Posts
    128
    Thanks
    70
    Qt products
    Qt5
    Platforms
    Windows

    Default how to know which signal is called a certain slot?

    Hi,
    There are 5 Classes and from each class I have 4 objects. When each object (each of these 20 objects) change , signal of that is emitted and calls a certain slot. for example:
    Qt Code:
    1. connect(obj1_0, SIGNAL(sig1()), this, SLOT(myslot()));//obj1_0 is a type of Class1
    2. connect(obj1_1, SIGNAL(sig1()), this, SLOT(myslot()));
    3. connect(obj1_2, SIGNAL(sig1()), this, SLOT(myslot()));
    4. connect(obj1_3, SIGNAL(sig1()), this, SLOT(myslot()));
    5.  
    6. connect(obj2_0, SIGNAL(sig2()), this, SLOT(myslot()));//obj2_0 is a type of Class2 deference from Class1
    7. connect(obj2_1, SIGNAL(sig2()), this, SLOT(myslot()));
    8. connect(obj2_2, SIGNAL(sig2()), this, SLOT(myslot()));
    9. connect(obj2_3, SIGNAL(sig2()), this, SLOT(myslot()));
    10. .
    11. .
    12. .
    13. .
    14. connect(obj5_0, SIGNAL(sig5()), this, SLOT(myslot()));//obj5_0 is a type of Class5 deference from Class1, Class2, Class3, Class4
    15. connect(obj5_1, SIGNAL(sig5()), this, SLOT(myslot()));
    16. connect(obj5_2, SIGNAL(sig5()), this, SLOT(myslot()));
    17. connect(obj5_3, SIGNAL(sig5()), this, SLOT(myslot()));
    To copy to clipboard, switch view to plain text mode 

    I am using QSignalMapper for this and defined 5 objects of this class for all of Class1,...,Class5 like obj1_signalmapper, obj2_signalmapper,..., obj5_signalmapper by a "int id". But I need to know which object and from which kind of class send signal(for example know first: obj1_2 send and seccond:from type of Class1). I can know obj id but I can not know this object is for which class because obj1_3 has the same "id" that obj5_3 has.

    Thanks for any help.
    Last edited by Alex22; 10th December 2015 at 20:42.

Similar Threads

  1. Replies: 3
    Last Post: 1st October 2015, 19:56
  2. Slot never called
    By Kola73 in forum Newbie
    Replies: 2
    Last Post: 27th June 2015, 08:48
  3. Replies: 2
    Last Post: 26th August 2011, 08:51
  4. Qt bug? Signal emitted once, slot called multiple times
    By MattPhillips in forum Qt Programming
    Replies: 22
    Last Post: 1st December 2010, 22:32
  5. SLOT not being called
    By steg90 in forum Qt Programming
    Replies: 4
    Last Post: 6th December 2007, 11:30

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.