summaryrefslogtreecommitdiffstats
path: root/src/widgets/qprogressbar.cpp
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2014-09-16 20:10:59 +0200
committerSlávek Banko <slavek.banko@axis.cz>2014-09-16 20:10:59 +0200
commitd9d3dd456aa9e90328255ce9f9ca0bcf77890574 (patch)
tree4e0d6c949e6f50ca3eaf36d7837cb20e436a383b /src/widgets/qprogressbar.cpp
parentbaea23ba1f144613c00fe64573a0f6c155a7dbcd (diff)
downloadtqt3-d9d3dd456aa9e90328255ce9f9ca0bcf77890574.tar.gz
tqt3-d9d3dd456aa9e90328255ce9f9ca0bcf77890574.zip
Improve TQProgressBar repaint optimization
Diffstat (limited to 'src/widgets/qprogressbar.cpp')
-rw-r--r--src/widgets/qprogressbar.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/widgets/qprogressbar.cpp b/src/widgets/qprogressbar.cpp
index 3eb0db0dc..ec5424c34 100644
--- a/src/widgets/qprogressbar.cpp
+++ b/src/widgets/qprogressbar.cpp
@@ -212,13 +212,11 @@ void TQProgressBar::setProgress( int progress )
progress < 0 || ( ( progress > total_steps ) && total_steps ) )
return;
- const bool needRepaint = isVisible() && requireRepaint( progress );
-
progress_val = progress;
setIndicator( progress_str, progress_val, total_steps );
- if ( needRepaint ) {
+ if ( isVisible() && repaintRequired() ) {
repaint( FALSE );
d->last_painted_progress = progress;
}
@@ -358,10 +356,9 @@ void TQProgressBar::styleChange( TQStyle& old )
would require a repaint of the progress bar. This allows efficient
repainting.
*/
-bool TQProgressBar::requireRepaint( int newProgress ) const
+bool TQProgressBar::repaintRequired() const
{
- if ( newProgress == progress_val ||
- newProgress == d->last_painted_progress ) {
+ if ( progress_val == d->last_painted_progress ) {
return false;
}
@@ -375,7 +372,7 @@ bool TQProgressBar::requireRepaint( int newProgress ) const
progressPerPixel = float( total_steps ) / float( width );
}
- const int delta = d->last_painted_progress - newProgress;
+ const int delta = d->last_painted_progress - progress_val;
return TQABS( delta ) >= progressPerPixel;
}