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. is there QProgressBar on StatusBar in the other thread Demo?
Forum Updated to NodeBB v4.3 + New Features

is there QProgressBar on StatusBar in the other thread Demo?

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 1.1k Views 2 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.
  • O Offline
    O Offline
    opengpu2
    wrote on last edited by
    #1

    is there QProgressBar on StatusBar in the other thread Demo?
    i want to do sth really slow...and is it possible to add and update the QProgressBar on the StatusBar of the QWidget which i so the things? will it be frozen while doing things?
    or should i add the QProgressBar in a new QWidget in a new Thread?
    what is the normally and best way to use QProgressBar ?

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

      Hi,

      You can't manipulate GUI elements in another thread, however you can use signals and slots between object in another thread and widgets.

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      O 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        You can't manipulate GUI elements in another thread, however you can use signals and slots between object in another thread and widgets.

        Hope it helps

        O Offline
        O Offline
        opengpu2
        wrote on last edited by
        #3

        @SGaist it's QueueConnection....and the slot implement when it returns to the main thread .... does it fit the situation that update the progressBar when its parent widget is frozen on the main thread in some situation?

        1 Reply Last reply
        0
        • A Offline
          A Offline
          alex_malyu
          wrote on last edited by alex_malyu
          #4

          There are 2 usual cases of using timers with lengthy computation:

          1. computation is performed in the gui thread.

          you need to call void QCoreApplication::processEvents ( QEventLoop::ProcessEventsFlags flags = QEventLoop::AllEvents ) [static]
          periodically from the function you run computation at to allow gui(progress bar for example) to update,

          1. Computation done in separate thread(s)
            In this case GUi thread is not busy and you do not have to do anything to update it,
            But you use thread safe notification: (signal/slot with specific connection type or QCoreApplication::postEvent ( QObject * receiver, QEvent * event )

          Second way usually leads to more responsive and faster applications, but usually is more difficult to implement right.

          1 Reply Last reply
          0

          • Login

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