Valderman

01-two-windows.cpp

Apr 1st, 2022 (edited)
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.56 KB | None | 0 0
  1. #include <QtWidgets>
  2. #include "Counter.h"
  3.  
  4. int main(int argc, char** argv)
  5. {
  6.     QApplication app(argc, argv);
  7.  
  8.     QLabel      lbl("0");
  9.     QPushButton cmd("ADD");
  10.     Counter     counter;
  11.  
  12.     lbl.show();
  13.     cmd.show();
  14.  
  15.     QObject::connect(&cmd, SIGNAL(clicked()),
  16.                      &counter, SLOT(slotInc()));
  17.  
  18.     QObject::connect(&counter, SIGNAL(counterChanged(int)),
  19.                      &lbl, SLOT(setNum(int)));
  20.  
  21.     QObject::connect(&counter, SIGNAL(goodbye()),
  22.                      &app, SLOT(quit()));
  23.  
  24.     return app.exec();
  25. }
Add Comment
Please, Sign In to add comment