Answer the question
In order to leave comments, you need to log in
How to run a class method inside the constructor of the same class in a parallel thread?
So is it possible at all?
M_RESULT *rs=new M_RESULT(s); // хотелось в этом классе сделать бесконечный цикл с опросом устройств
thread=new QThread(); //нужно ли тут передавать this?
rs->moveToThread(thread);
thread->start();
connect(rs, &M_RESULT::valueChaged, this, &MyTreeModel::sensor_valueChanged);
connect(this, &MyTreeModel::destroyed, thread, &QThread::terminate);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question