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 bar updating
QtWS25 Last Chance

Progress bar updating

Scheduled Pinned Locked Moved Unsolved General and Desktop
qt5progress barupdate
13 Posts 4 Posters 3.7k 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.
  • D Offline
    D Offline
    deleted286
    wrote on last edited by
    #1

    Hello everyone.
    What is the difference between setting a value to a progress bar and updating the progress bar?
    When I say set, isn't it actually updated? I have 8 progress bar and in some conditions im setting a value and im updating. Doesn't this tire my operating system?

        ```
        ui->progressBarAxEksi->setValue(0);
        ui->progressBarAx->update();
        ```
    
    JonBJ 1 Reply Last reply
    0
    • D deleted286

      Hello everyone.
      What is the difference between setting a value to a progress bar and updating the progress bar?
      When I say set, isn't it actually updated? I have 8 progress bar and in some conditions im setting a value and im updating. Doesn't this tire my operating system?

          ```
          ui->progressBarAxEksi->setValue(0);
          ui->progressBarAx->update();
          ```
      
      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @suslucoder
      update() (with or without, you could remove it here and it would make no difference) only schedules the progress bar to be updated the next time your code enters the Qt event loop. If you're not seeing it update, you are blocking/not entering the main event loop.

      D 1 Reply Last reply
      1
      • JonBJ JonB

        @suslucoder
        update() (with or without, you could remove it here and it would make no difference) only schedules the progress bar to be updated the next time your code enters the Qt event loop. If you're not seeing it update, you are blocking/not entering the main event loop.

        D Offline
        D Offline
        deleted286
        wrote on last edited by
        #3

        @JonB Yes when i delete update, i couldnt see its updated

        JonBJ mrjjM 2 Replies Last reply
        0
        • D deleted286

          @JonB Yes when i delete update, i couldnt see its updated

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by JonB
          #4

          @suslucoder said in Progress bar updating:

          @JonB Yes when i delete update, i couldnt see its updated

          I am surprised at your claim.

          It doesn't help that your code sets the value on one progress bar yet updates a completely different progress bar! So goodness knows what situation you are actually in....

          1 Reply Last reply
          1
          • D deleted286

            @JonB Yes when i delete update, i couldnt see its updated

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @suslucoder

            Hi
            setValue will also call update().

            Update post to event queue so its not extra stressing to the Os even if you manually call it.
            But its never really needed for standard widget and their methods.

            JonBJ 1 Reply Last reply
            2
            • mrjjM mrjj

              @suslucoder

              Hi
              setValue will also call update().

              Update post to event queue so its not extra stressing to the Os even if you manually call it.
              But its never really needed for standard widget and their methods.

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by
              #6

              @mrjj
              ...which is what I said to @suslucoder, yet he claims otherwise...

              mrjjM 1 Reply Last reply
              0
              • JonBJ JonB

                @mrjj
                ...which is what I said to @suslucoder, yet he claims otherwise...

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by mrjj
                #7

                @JonB
                hi. yes i was too slow and didnt see your post :)

                well its related to the other post
                https://forum.qt.io/topic/124234/ui-doesnt-refresh-correctly

                Its very unclear to me what actual issue is but i guess on the data as
                widgets dont go around not drawing unless he uses heavy loops or something like that.

                D 1 Reply Last reply
                0
                • mrjjM mrjj

                  @JonB
                  hi. yes i was too slow and didnt see your post :)

                  well its related to the other post
                  https://forum.qt.io/topic/124234/ui-doesnt-refresh-correctly

                  Its very unclear to me what actual issue is but i guess on the data as
                  widgets dont go around not drawing unless he uses heavy loops or something like that.

                  D Offline
                  D Offline
                  deleted286
                  wrote on last edited by
                  #8

                  @mrjj actually it doesnt update just in negative values. I have positive and negative values. My progress bar doesnt update the negative one.
                  And can you say me she.....

                  mrjjM 1 Reply Last reply
                  0
                  • D deleted286

                    @mrjj actually it doesnt update just in negative values. I have positive and negative values. My progress bar doesnt update the negative one.
                    And can you say me she.....

                    mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    @suslucoder

                    Sorry Miss :)

                    Wait!
                    Its only with negative values that it don't update?

                    In your other code you have
                    if(dizi[2] > 0 && dizi[2] < 600)

                    for all of them so any negative value will never go inside the if.

                    D 1 Reply Last reply
                    3
                    • mrjjM mrjj

                      @suslucoder

                      Sorry Miss :)

                      Wait!
                      Its only with negative values that it don't update?

                      In your other code you have
                      if(dizi[2] > 0 && dizi[2] < 600)

                      for all of them so any negative value will never go inside the if.

                      D Offline
                      D Offline
                      deleted286
                      wrote on last edited by
                      #10

                      @mrjj I've changed it like:

                      if(dizi[1] <= 0 )
                       {
                           ui->progressBarAxEksi->setValue(qAbs(dizi[1]));
                           ui->progressBarAx->setValue(0);
                           ui->progressBarAxEksi->update();
                       }
                      

                      When i delete update() it does not update the progress bar

                      JoeCFDJ mrjjM 2 Replies Last reply
                      0
                      • D deleted286

                        @mrjj I've changed it like:

                        if(dizi[1] <= 0 )
                         {
                             ui->progressBarAxEksi->setValue(qAbs(dizi[1]));
                             ui->progressBarAx->setValue(0);
                             ui->progressBarAxEksi->update();
                         }
                        

                        When i delete update() it does not update the progress bar

                        JoeCFDJ Offline
                        JoeCFDJ Offline
                        JoeCFD
                        wrote on last edited by
                        #11

                        @suslucoder display the values
                        qDebug() << ui->progressBarAxEksi->value() << " " << qAbs(dizi[1]) ;
                        qDebug() << ui->progressBarAx->value() << " = 0 ?" ;
                        to make sure these values change.

                        1 Reply Last reply
                        0
                        • D deleted286

                          @mrjj I've changed it like:

                          if(dizi[1] <= 0 )
                           {
                               ui->progressBarAxEksi->setValue(qAbs(dizi[1]));
                               ui->progressBarAx->setValue(0);
                               ui->progressBarAxEksi->update();
                           }
                          

                          When i delete update() it does not update the progress bar

                          mrjjM Offline
                          mrjjM Offline
                          mrjj
                          Lifetime Qt Champion
                          wrote on last edited by
                          #12

                          @suslucoder
                          Ok, i can't explain that. Never seen it.
                          Should not be like that but update()
                          won't hurt you so leave it at that then.

                          D 1 Reply Last reply
                          0
                          • mrjjM mrjj

                            @suslucoder
                            Ok, i can't explain that. Never seen it.
                            Should not be like that but update()
                            won't hurt you so leave it at that then.

                            D Offline
                            D Offline
                            deleted286
                            wrote on last edited by
                            #13

                            @mrjj okey

                            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