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
Forum Updated to NodeBB v4.3 + New Features

Progress bar updating

Scheduled Pinned Locked Moved Unsolved General and Desktop
qt5progress barupdate
13 Posts 4 Posters 4.0k 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.
  • D deleted286
    1 Mar 2021, 11:43

    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();
        ```
    
    J Offline
    J Offline
    JonB
    wrote on 1 Mar 2021, 11:45 last edited by JonB 3 Jan 2021, 11:46
    #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 Mar 2021, 11:51
    1
    • J JonB
      1 Mar 2021, 11:45

      @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 1 Mar 2021, 11:51 last edited by
      #3

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

      J M 2 Replies Last reply 1 Mar 2021, 12:13
      0
      • D deleted286
        1 Mar 2021, 11:51

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

        J Offline
        J Offline
        JonB
        wrote on 1 Mar 2021, 12:13 last edited by JonB 3 Jan 2021, 12:17
        #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
          1 Mar 2021, 11:51

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

          M Offline
          M Offline
          mrjj
          Lifetime Qt Champion
          wrote on 1 Mar 2021, 12:14 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.

          J 1 Reply Last reply 1 Mar 2021, 12:17
          2
          • M mrjj
            1 Mar 2021, 12:14

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

            J Offline
            J Offline
            JonB
            wrote on 1 Mar 2021, 12:17 last edited by
            #6

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

            M 1 Reply Last reply 1 Mar 2021, 12:22
            0
            • J JonB
              1 Mar 2021, 12:17

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

              M Offline
              M Offline
              mrjj
              Lifetime Qt Champion
              wrote on 1 Mar 2021, 12:22 last edited by mrjj 3 Jan 2021, 12:24
              #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 1 Mar 2021, 12:32
              0
              • M mrjj
                1 Mar 2021, 12:22

                @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 1 Mar 2021, 12:32 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.....

                M 1 Reply Last reply 1 Mar 2021, 12:39
                0
                • D deleted286
                  1 Mar 2021, 12:32

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

                  M Offline
                  M Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on 1 Mar 2021, 12:39 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 1 Mar 2021, 13:59
                  3
                  • M mrjj
                    1 Mar 2021, 12:39

                    @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 1 Mar 2021, 13:59 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

                    J M 2 Replies Last reply 1 Mar 2021, 19:14
                    0
                    • D deleted286
                      1 Mar 2021, 13:59

                      @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

                      J Offline
                      J Offline
                      JoeCFD
                      wrote on 1 Mar 2021, 19:14 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
                        1 Mar 2021, 13:59

                        @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

                        M Offline
                        M Offline
                        mrjj
                        Lifetime Qt Champion
                        wrote on 2 Mar 2021, 11:37 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 2 Mar 2021, 11:41
                        0
                        • M mrjj
                          2 Mar 2021, 11:37

                          @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 2 Mar 2021, 11:41 last edited by
                          #13

                          @mrjj okey

                          1 Reply Last reply
                          0

                          11/13

                          1 Mar 2021, 19:14

                          • Login

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