Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. value is not updating on GUI
Qt 6.11 is out! See what's new in the release blog

value is not updating on GUI

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 1.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    shashi prasad
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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 ?

      1 Reply Last reply
      0
      • S Offline
        S Offline
        shashi prasad
        wrote on last edited by
        #3

        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.

        jsulmJ 1 Reply Last reply
        0
        • S shashi prasad

          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.

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @shashi-prasad You should NOT update UI in second thread! Never! It is not supported!
          P.S.: this is a duplicate...

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          2

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved