Problems with QThread
-
Hi
i am trying to use QThread. I use simple code in constructor of my class.
metod blink is declared as public slot in header file.Error:
/opt/qt5pi/include/QtCore/qthread.h:120: error: ‘int QThread::exec()’ is protected
int exec();QThread *threadBlink = new QThread(this); connect(this->threadBlink, SIGNAL(started()), this, SLOT(blink())); threadBlink->exec();
Thanks for help
-
Hi
i am trying to use QThread. I use simple code in constructor of my class.
metod blink is declared as public slot in header file.Error:
/opt/qt5pi/include/QtCore/qthread.h:120: error: ‘int QThread::exec()’ is protected
int exec();QThread *threadBlink = new QThread(this); connect(this->threadBlink, SIGNAL(started()), this, SLOT(blink())); threadBlink->exec();
Thanks for help
@nuke
the error message have said thatQThread::exec()
is a protected member ofQThread
if you want to start a thread use
QThread::start
read the documentation for some example
-
Hi
i am trying to use QThread. I use simple code in constructor of my class.
metod blink is declared as public slot in header file.Error:
/opt/qt5pi/include/QtCore/qthread.h:120: error: ‘int QThread::exec()’ is protected
int exec();QThread *threadBlink = new QThread(this); connect(this->threadBlink, SIGNAL(started()), this, SLOT(blink())); threadBlink->exec();
Thanks for help
-
Thanks for help it really works.
But i found another problem when strat the QThread the program does not work as i want it waits until the thread finishes. In method blink is infinite loop for blinking LED i thought it should work separatly from the main program. -
Thanks for help it really works.
But i found another problem when strat the QThread the program does not work as i want it waits until the thread finishes. In method blink is infinite loop for blinking LED i thought it should work separatly from the main program.