Progress bar updating
-
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(); ```
-
@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. -
@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....
-
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. -
@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-correctlyIts 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. -
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.
-
@suslucoder display the values
qDebug() << ui->progressBarAxEksi->value() << " " << qAbs(dizi[1]) ;
qDebug() << ui->progressBarAx->value() << " = 0 ?" ;
to make sure these values change. -
@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.