You can do it with QObject::sender() function. As you've said inside handler
slot, typecast sender()
to the type, you expect, QPushButton
in your case, and you,ve got a reference to sender object.
In c++ it could be done like this:
// inside handler method
QPushButton *tmpBtn= dynamic_cast<QPushButton*>(sender());
Edit:
A minimal example on how to do this in Ruby:
class SlotContainer < Qt::Object
slots "handler()"
def handler
puts "called by: " + sender().to_s
end
end
if $0 == __FILE__
app = Qt::Application.new(ARGV)
ui = Ui_MainWindow.new
container = SlotContainer.new
window = Qt::MainWindow.new
ui.setupUi(window)
Qt::Object.connect(ui.pushButton, SIGNAL("clicked()"), container, SLOT("handler()"))
window.show
app.exec
end