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"
QtWS25 Last Chance

"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 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.

    Gojir4G JonBJ 2 Replies Last reply
    0
    • S StringTheory

      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.

      Gojir4G Offline
      Gojir4G Offline
      Gojir4
      wrote on 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
      0
      • S StringTheory

        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.

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on 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
        0
        • Gojir4G Gojir4

          @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 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
          • JonBJ JonB

            @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 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
            0
            • S StringTheory

              @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 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.

              JonBJ 1 Reply Last reply
              0
              • S StringTheory

                @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.

                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on 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
                1
                • JonBJ JonB

                  @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 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

                  • Login

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