I declare QEventloop class property:
class myClass: public QObject
{
Q_OBJECT
public:
explicit QZXingFilterRunnable(QZXingFilter * filter)
// ...
private:
// ...
QEventLoop myEvt;
};
and then in one of class methods, I want to set event loop for a specific code segment , I don't understand how QEventloop knows its boundary, this is the code:
myClass::myMethod(void*)
: QObject(nullptr)
{
// Code Block1 ....
// ....
// ...code Block2
// ...
// Code Block to be looped by QEventloop
// this is the block I want in loop
timer.setSingleShot(true);
timer.setInterval(100);
QObject::connect(&timer, SIGNAL(timeout()), &something, SLOT(cancel()));
QObject::connect(&timer, SIGNAL(timeout()), &myEvt, SLOT(quit()));
QObject::connect(&watcher, SIGNAL(finished()), &myEvt, SLOT(quit()));
QtConcurrent::run(this,&myClass::myMethod,*param);
timer.start();
myEvt.exec(); // How do MyEvt know which code block is to be in loop ?
//