How is QEventLoop processed ? In what sequence ?
-
I am using the attached code as a part of standard C while loop to actually print the debug and texttEdit messages "on the fly" - not only AFTER the entire while loop is finished.
I understand that QEventLoop "runs inside" Qt application loop, hence has to be started and then terminated.
The QTimer::singleShot is the timer and its SLOT(quit()) returns the processing to main application loop - stops the QEventLoop .I do not understand when does the output test message gets processed .
I understand it is yet another "event"....Does it get processed before the loop.exec();?
I would appreciate if somebody could explain to me the timing sequence of the code . To me it looks that all the code AFTER QEventLoop loop; and BEFORE loop.exec(); could be called
QEventLoop setup.Help would be greatly appreciated.
Thanks.int LoopDelay = 2000; { // declare QEventLoop ?? QEventLoop loop; // setup loop timer and return SLOT to main application loop QTimer::singleShot(LoopDelay , &loop, SLOT(quit())); // output test message text = " \t\t RUn QEventLoop delay "; text += QString::number(LoopDelay ); m_ui->textEdit_13->append( text); // execute QEventLoop loop.exec(); } text = " \t\t QEventLoop delay finished "; text += QString::number(LoopDelay ); m_ui->textEdit_13->append( text); -
Oh, new user name ...
-
I am using the attached code as a part of standard C while loop to actually print the debug and texttEdit messages "on the fly" - not only AFTER the entire while loop is finished.
I understand that QEventLoop "runs inside" Qt application loop, hence has to be started and then terminated.
The QTimer::singleShot is the timer and its SLOT(quit()) returns the processing to main application loop - stops the QEventLoop .I do not understand when does the output test message gets processed .
I understand it is yet another "event"....Does it get processed before the loop.exec();?
I would appreciate if somebody could explain to me the timing sequence of the code . To me it looks that all the code AFTER QEventLoop loop; and BEFORE loop.exec(); could be called
QEventLoop setup.Help would be greatly appreciated.
Thanks.int LoopDelay = 2000; { // declare QEventLoop ?? QEventLoop loop; // setup loop timer and return SLOT to main application loop QTimer::singleShot(LoopDelay , &loop, SLOT(quit())); // output test message text = " \t\t RUn QEventLoop delay "; text += QString::number(LoopDelay ); m_ui->textEdit_13->append( text); // execute QEventLoop loop.exec(); } text = " \t\t QEventLoop delay finished "; text += QString::number(LoopDelay ); m_ui->textEdit_13->append( text);@JanaHus said in How is QEventLoop processed ? In what sequence ?:
Does it get processed before the loop.exec();?
Yes, of course. The internal state of the UI widget object will be updated and an update of the screen, if required, will be scheduled.
Does it update the screen? No. That will occur only when your code enters the Qt event loop; whether that is a local QEventLoop or the main application loop.
-
J JanaHus has marked this topic as solved on
-
Oh, new user name ...
@Christian-Ehrlicher said in How is QEventLoop processed ? In what sequence ?:
Oh, new user name ...
Should I ask? My replies usually do not result in banning *<8O)