C++ (Qt)public slots: void MyEventHandler(); QObject::connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(MyEventHandler())); void MyWidget::MyEventHandler() { }