Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <QCoreApplication>
- #include <QThread>
- #include "idprinter.h"
- int main(int argc, char *argv[])
- {
- QCoreApplication a(argc, argv);
- QThread thread1;
- QThread thread2;
- IDPrinter iDPrinter1(3);
- IDPrinter iDPrinter2(4);
- QObject::connect(&thread1, SIGNAL(started()), &iDPrinter1, SLOT(print()));
- QObject::connect(&thread2, SIGNAL(started()), &iDPrinter2, SLOT(print()));
- iDPrinter1.moveToThread(&thread1);
- iDPrinter2.moveToThread(&thread2);
- thread1.start();
- thread2.start();
- return a.exec();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement