Add clicked event for push button : QPushButton « Qt « C++






Add clicked event for push button

  


#include <QApplication>
#include <QPushButton>

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    QPushButton *button = new QPushButton("Quit");
    QObject::connect(button, SIGNAL(clicked()),&app, SLOT(quit()));
    button->show();
    return app.exec();
}

   
    
  








Related examples in the same category

1.Create PushButton and add to window
2.Calculator with push buttons
3.Button based calculator
4.extends QPushButton
5.toggle button demo