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. "Progress MessageBox"
Forum Update on Monday, May 27th 2025

"Progress MessageBox"

Scheduled Pinned Locked Moved Unsolved General and Desktop
popupprogress barmodal dialog
8 Posts 3 Posters 4.4k Views
  • 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
    StringTheory
    wrote on 29 May 2018, 09:50 last edited by
    #1

    I'm looking for a popup like a MessageBox that will show an animation to the effect of "background task is working...please wait". Unfortunately a normal progress bar will not do, as there is no way to tell how long the task will take. A simple spinning icon or a clock's second hand would work..

    The 'MessageBox' would be modal, but with an abort button.

    This probably exists already, perhaps as a custom control or a separate project. But I have no idea what it's called in Qt terms, so I'm not sure what to search for.

    Ideas appreciated.

    G J 2 Replies Last reply 29 May 2018, 10:14
    0
    • S StringTheory
      29 May 2018, 09:50

      I'm looking for a popup like a MessageBox that will show an animation to the effect of "background task is working...please wait". Unfortunately a normal progress bar will not do, as there is no way to tell how long the task will take. A simple spinning icon or a clock's second hand would work..

      The 'MessageBox' would be modal, but with an abort button.

      This probably exists already, perhaps as a custom control or a separate project. But I have no idea what it's called in Qt terms, so I'm not sure what to search for.

      Ideas appreciated.

      G Offline
      G Offline
      Gojir4
      wrote on 29 May 2018, 10:14 last edited by
      #2

      @StringTheory Hi, you can make the progress bar "undeterminate" by putting both minimum and maxium values to 0. As specified in the doc of QProgressBar::setRange().

      Then you can check cancellation with QProgressDialog::wasCanceled() or connect to signal QProgressDialog::canceled() to be notified when cancel was clicked. This depends of the design of you application.

       QProgressDialog dlg;
      //Set progress dialog in undeterminate state: 
       dlg->setMaximum( 0 );
       dlg->setMinimum( 0 ); 
       
      
      S 1 Reply Last reply 29 May 2018, 12:18
      0
      • S StringTheory
        29 May 2018, 09:50

        I'm looking for a popup like a MessageBox that will show an animation to the effect of "background task is working...please wait". Unfortunately a normal progress bar will not do, as there is no way to tell how long the task will take. A simple spinning icon or a clock's second hand would work..

        The 'MessageBox' would be modal, but with an abort button.

        This probably exists already, perhaps as a custom control or a separate project. But I have no idea what it's called in Qt terms, so I'm not sure what to search for.

        Ideas appreciated.

        J Offline
        J Offline
        JonB
        wrote on 29 May 2018, 12:03 last edited by
        #3

        @StringTheory
        Are you actually running your "task" as another thread from thread from the GUI? If you are not, I think you need a modeless dialog, not a modal one...

        S 1 Reply Last reply 29 May 2018, 12:31
        0
        • G Gojir4
          29 May 2018, 10:14

          @StringTheory Hi, you can make the progress bar "undeterminate" by putting both minimum and maxium values to 0. As specified in the doc of QProgressBar::setRange().

          Then you can check cancellation with QProgressDialog::wasCanceled() or connect to signal QProgressDialog::canceled() to be notified when cancel was clicked. This depends of the design of you application.

           QProgressDialog dlg;
          //Set progress dialog in undeterminate state: 
           dlg->setMaximum( 0 );
           dlg->setMinimum( 0 ); 
           
          
          S Offline
          S Offline
          StringTheory
          wrote on 29 May 2018, 12:18 last edited by
          #4

          @Gojir4 said in "Progress MessageBox":

          QProgressDialog

          Very helpful! I'm new to Qt, so I hadn't seen QProgressDialog. I was thinking more in terms of a hovering hourglass or something, but this is way better. And a great bootstrap for web searches.

          I noticed that someone referred to the type of bar as a 'barberpole.' That's about right.

          1 Reply Last reply
          0
          • J JonB
            29 May 2018, 12:03

            @StringTheory
            Are you actually running your "task" as another thread from thread from the GUI? If you are not, I think you need a modeless dialog, not a modal one...

            S Offline
            S Offline
            StringTheory
            wrote on 29 May 2018, 12:31 last edited by
            #5

            @JonB said in "Progress MessageBox":

            Are you actually running your "task" as another thread from thread from the GUI? If you are not, I think you need a modeless dialog, not a modal one...

            The user has to wait for the operation to complete before being able to do anything else, so I was thinking in terms of modal, but with a cancel button. But you're probably right in terms of getting notification back to the 'progress dialog' that the task has finished. I was not looking forward to threading that operation.

            I've done things like this in C#, which has some lightweight ops like 'BackgroundWorker' that are designed for this type of thing, but I kind of doubt that Qt has anything similar.

            S 1 Reply Last reply 29 May 2018, 12:41
            0
            • S StringTheory
              29 May 2018, 12:31

              @JonB said in "Progress MessageBox":

              Are you actually running your "task" as another thread from thread from the GUI? If you are not, I think you need a modeless dialog, not a modal one...

              The user has to wait for the operation to complete before being able to do anything else, so I was thinking in terms of modal, but with a cancel button. But you're probably right in terms of getting notification back to the 'progress dialog' that the task has finished. I was not looking forward to threading that operation.

              I've done things like this in C#, which has some lightweight ops like 'BackgroundWorker' that are designed for this type of thing, but I kind of doubt that Qt has anything similar.

              S Offline
              S Offline
              StringTheory
              wrote on 29 May 2018, 12:41 last edited by
              #6

              @StringTheory said in "Progress MessageBox":

              @JonB said in "Progress MessageBox":

              Are you actually running your "task" as another thread from thread from the GUI? If you are not, I think you need a modeless dialog, not a modal one...

              The user has to wait for the operation to complete before being able to do anything else, so I was thinking in terms of modal, but with a cancel button. But you're probably right in terms of getting notification back to the 'progress dialog' that the task has finished. I was not looking forward to threading that operation.

              I've done things like this in C#, which has some lightweight ops like 'BackgroundWorker' that are designed for this type of thing, but I kind of doubt that Qt has anything similar.

              Now that I think about it, you're exactly right that the background task itself would be locked by a modal dialog unless I spun it off as a thread. Perhaps a modeless 'progress dialog' could just start up a timer and monitor progress of the background task. But then I'd need to lock all the controls on main windows while the progress dialog was active. What a pain.

              J 1 Reply Last reply 29 May 2018, 13:37
              0
              • S StringTheory
                29 May 2018, 12:41

                @StringTheory said in "Progress MessageBox":

                @JonB said in "Progress MessageBox":

                Are you actually running your "task" as another thread from thread from the GUI? If you are not, I think you need a modeless dialog, not a modal one...

                The user has to wait for the operation to complete before being able to do anything else, so I was thinking in terms of modal, but with a cancel button. But you're probably right in terms of getting notification back to the 'progress dialog' that the task has finished. I was not looking forward to threading that operation.

                I've done things like this in C#, which has some lightweight ops like 'BackgroundWorker' that are designed for this type of thing, but I kind of doubt that Qt has anything similar.

                Now that I think about it, you're exactly right that the background task itself would be locked by a modal dialog unless I spun it off as a thread. Perhaps a modeless 'progress dialog' could just start up a timer and monitor progress of the background task. But then I'd need to lock all the controls on main windows while the progress dialog was active. What a pain.

                J Offline
                J Offline
                JonB
                wrote on 29 May 2018, 13:37 last edited by JonB
                #7

                @StringTheory
                OK. Forget about modeless for a moment, if you don't want to deal with threads. Take a look at http://doc.qt.io/qt-5/qdialog.html#open, and start from there instead of the normal QDialog::exec(). I'm thinking that may be all you are looking for.

                I still don't know what it is you think you are going to "show the progress against", but that's another issue.....

                S 1 Reply Last reply 2 Jun 2018, 12:33
                1
                • J JonB
                  29 May 2018, 13:37

                  @StringTheory
                  OK. Forget about modeless for a moment, if you don't want to deal with threads. Take a look at http://doc.qt.io/qt-5/qdialog.html#open, and start from there instead of the normal QDialog::exec(). I'm thinking that may be all you are looking for.

                  I still don't know what it is you think you are going to "show the progress against", but that's another issue.....

                  S Offline
                  S Offline
                  StringTheory
                  wrote on 2 Jun 2018, 12:33 last edited by
                  #8

                  @JonB said in "Progress MessageBox":

                  OK. Forget about modeless for a moment, if you don't want to deal with threads. Take a look at http://doc.qt.io/qt-5/qdialog.html#open, and start from there instead of the normal QDialog::exec(). I'm thinking that may be all you are looking for.

                  I still don't know what it is you think you are going to "show the progress against", but that's another issue.....

                  Thanks for the recommendation. I will look into open(), etc. I will probably end up threading the heavy tasks, but I'm trying to avoid all the tedious synchronization for now.

                  As for 'progress against': I realized why that may not have made sense. Individual time-consuming tasks will not be able to report on their progress mid-stream (no way to gauge how long to complete), but there is a series of them. Basically a chain of image processes--filters, denoising, etc. and each can take from 5 seconds to almost a minute. Awkward to just sit there looking at the barberpole progress bar, so I thought of setting up a timer in the progress dialog in order to monitor a 'status variable' back at the ranch. As each filter stage completes, the status variable would be updated. When the variable changes from "filter 1" to "filter 2", appropriate text could be displayed in the progress dialog. Or so I hope. :-)

                  1 Reply Last reply
                  0

                  2/8

                  29 May 2018, 10:14

                  topic:navigator.unread, 6
                  • Login

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