Results 1 to 2 of 2

Thread: who call my slot?

  1. #1
    Join Date
    Oct 2007
    Location
    Italy
    Posts
    172
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    39

    Default who call my slot?

    Hi, can i know into slot Slot if i received a signal by ui.treeWidgetA or ui.treeWidgetB?
    Qt Code:
    1. connect ( ui.treeWidgetA, SIGNAL ( currentItemChanged ( QTreeWidgetItem * , QTreeWidgetItem * ) ),
    2. this, SLOT ( Slot ( QTreeWidgetItem * , QTreeWidgetItem * ) ) );
    3.  
    4. connect ( ui.treeWidgetB, SIGNAL ( currentItemChanged ( QTreeWidgetItem * , QTreeWidgetItem * ) ),
    5. this, SLOT ( Slot ( QTreeWidgetItem * , QTreeWidgetItem * ) ) );
    To copy to clipboard, switch view to plain text mode 
    thx
    Last edited by jacek; 28th November 2007 at 13:45. Reason: wrapped too long lines

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: who call my slot?

    You can use QObject::sender(), but it really breaks the concept of signals & slots --- the idea is to have loose coupling, so the receiver shouldn't need to know who sent the signal.

Similar Threads

  1. How to declare SLOT as a parameter to member function?
    By QPlace in forum Qt Programming
    Replies: 2
    Last Post: 17th July 2018, 01:41
  2. Replies: 2
    Last Post: 8th October 2007, 16:02
  3. Slot to color background of line edit on textedited
    By tpf80 in forum Qt Programming
    Replies: 5
    Last Post: 21st June 2007, 10:02
  4. SLOT and QPushButton
    By mickey in forum Qt Programming
    Replies: 15
    Last Post: 15th February 2006, 07:46
  5. signal slot conection using a string, not a SLOT
    By rianquinn in forum Qt Programming
    Replies: 6
    Last Post: 5th February 2006, 19: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
  •  
Qt is a trademark of The Qt Company.