Yes in fact, that is one of the dangers of using sender() - you break the loose coupling and need to know exactly what kind of widget invoked the slot (of course using a C++-style dynamic_cast<> instead of (QPushButton*) as advised earlier would have trapped the error).Originally Posted by meissner
Change the signature of your function to take an int parameter. This will contain the id of the button that was pressed. Then you can do:
Qt Code:
buttons->button(id)->setText("bla");To copy to clipboard, switch view to plain text mode
Bookmarks