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. ProgressBar Blocking Window [solved]
Forum Updated to NodeBB v4.3 + New Features

ProgressBar Blocking Window [solved]

Scheduled Pinned Locked Moved General and Desktop
10 Posts 3 Posters 3.6k 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.
  • A Offline
    A Offline
    ausn_63
    wrote on last edited by
    #1

    Hi, guys.

    When I use QProgressBar to show progress of one operation, it will block the whole window.
    Is there any way to avoid this? I must put the operation to another thread? Is there any function to do this in QProgressBar?

    Thanks.

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

      Hi,

      What do you mean by "it will block the whole window" ? While doing your long operation, do you update the progress bar ?

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

      1 Reply Last reply
      0
      • A Offline
        A Offline
        ausn_63
        wrote on last edited by
        #3

        Hi,
        I mean the window is frozen. I cannot manipulate other widgets until the peration is done.
        How to update the window?

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

          It depends on the operation. Is it an external call you make ? Do you have full control on the operation ? etc…

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

          1 Reply Last reply
          0
          • IamSumitI Offline
            IamSumitI Offline
            IamSumit
            wrote on last edited by
            #5

            Hello ausn_63,
            Yes you can do with threading...
            Just make another thread class with signal that provides updates to progressbar and emit it(signal) within the thread , The corresponding slot should be in main thread.
            I am sure your Application will not be frozen..

            Be Cute

            1 Reply Last reply
            0
            • A Offline
              A Offline
              ausn_63
              wrote on last edited by
              #6

              Thanks.

              I just think the default QProgressBar maybe has this function.
              Because I saw all of the progress bars from other software will not be frozen while it's running other operation, like copying progress bar when I'm copying some files from one folder to another.
              It seems that I must use another thread to do it.

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

                QProgressBar can't have this function. How could it know you are doing anything ? You have to provide it with this information. Also you must not block the GUI thread with your long lasting operation. To handle this you have two options: move that lengthy operation in another thread or periodically call processEvents(). Both have their pros & cons. It's up to you to decide what's the best for your application.

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

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  ausn_63
                  wrote on last edited by
                  #8

                  I got it!
                  Thank you!!

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

                    You're welcome !

                    If you have it working now, can you please update the thread title prepending [solved] ? So other forum users may know a solution has been found :)

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

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      ausn_63
                      wrote on last edited by
                      #10

                      Ok, bro.

                      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