A Slot Responds to a Signal : Signal « Qt « C++






A Slot Responds to a Signal

  

#include <QApplication>
#include <QPushButton>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QPushButton button("Quit");
    button.show();

    QObject::connect(&button, SIGNAL(clicked()),&a, SLOT(quit()));

    return a.exec();
}

   
    
  








Related examples in the same category

1.Inherited slot
2.Qt signal test
3.Qt signals and slots
4.Quit Qt application
5.Widget style
6.QSignal mapper
7.event filters
8.Multi-event handlers
9.Mark method with Q_INVOKABLE