Unsolved value is not updating on GUI
-
Hi
i am updating a value on GUI in QT in single thread using below code
Label[Index]->setText(time);
this->update();
qApp->processEvents();
qDebug()<<"setting--------------------------------1"<<time<<"index=="<<Index<<">>>>>>>>>>>"<<Label[Index]->text();first time value updated on gui but later it is not updating on gui.
value is set on lavel correctly, checked using code Label[Index]->text().
but it is not updating on gui.
why it is not updating on GUI, please suggest me what i have to do.
Thanks
Shashi -
Hi
Often when qApp->processEvents(); is used
its sign of using loops and killing the event loop.I think we need to see more of the code.
The whole function or what that code is part of.
Also just to be 100% sure. you are just using the normal GUI thread ?
No new Q Thread was create by you ? -
i am using std thread and i am updating label from thread with 2 second interval.
if i am not using qApp->processEvents(); still it is not working.
-
@shashi-prasad You should NOT update UI in second thread! Never! It is not supported!
P.S.: this is a duplicate...