Advertisement
Felanpro

Signals and Slots.

Jul 3rd, 2016
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <QApplication>
  2. #include <QPushButton> //Allow PushButtons.
  3.  
  4. int main(int argc, char *argv[])
  5. {
  6.     QApplication prog(argc, argv);
  7.     QPushButton *button = new QPushButton("Quit"); //Declare.
  8.     button->show(); //Display.
  9.     QObject::connect(button, SIGNAL(clicked()), &prog, SLOT(quit()));
  10.  
  11.     //SIGNAL() = the event that the user does.
  12.     //SLOT() = the code that gets executed after the event.
  13.  
  14.     return prog.exec();
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement