SHARE
TWEET

Untitled

a guest Jul 27th, 2016 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <QCoreApplication>
  2. #include <QThread>
  3. #include "idprinter.h"
  4.  
  5. int main(int argc, char *argv[])
  6. {
  7.     QCoreApplication a(argc, argv);
  8.     QThread thread1;
  9.     QThread thread2;
  10.     IDPrinter iDPrinter1(3);
  11.     IDPrinter iDPrinter2(4);
  12.  
  13.     QObject::connect(&thread1, SIGNAL(started()), &iDPrinter1, SLOT(print()));
  14.     QObject::connect(&thread2, SIGNAL(started()), &iDPrinter2, SLOT(print()));
  15.  
  16.     iDPrinter1.moveToThread(&thread1);
  17.     iDPrinter2.moveToThread(&thread2);
  18.  
  19.     thread1.start();
  20.     thread2.start();
  21.  
  22.     return a.exec();
  23. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top