Why would you want to implmenet sender()?i have been trying to look at this all weekend and i am having trouble understanding how to implement sender()
I don't know what more can I say that the docs are not saying...
May be if you explain what it is you have trouble understanding I could help you more...
Just do something like:QObject * QObject::sender () const [protected]
Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns 0. The pointer is valid only during the execution of the slot that calls this function.
The pointer returned by this function becomes invalid if the sender is destroyed, or if the slot is disconnected from the sender's signal.
Warning: This function violates the object-oriented principle of modularity. However, getting access to the sender might be useful when many signals are connected to a single slot.
See also QSignalMapper.
Qt Code:
if(sender()==someObjPtr) { //do something }To copy to clipboard, switch view to plain text mode





Reply With Quote
Bookmarks