|
|
|
@ -209,13 +209,11 @@ void QProgressBar::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;
|
|
|
|
|
}
|
|
|
|
@ -349,10 +347,9 @@ void QProgressBar::styleChange( QStyle& old )
|
|
|
|
|
would require a repaint of the progress bar. This allows efficient
|
|
|
|
|
repainting.
|
|
|
|
|
*/
|
|
|
|
|
bool QProgressBar::requireRepaint( int newProgress ) const
|
|
|
|
|
bool QProgressBar::repaintRequired() const
|
|
|
|
|
{
|
|
|
|
|
if ( newProgress == progress_val ||
|
|
|
|
|
newProgress == d->last_painted_progress ) {
|
|
|
|
|
if ( progress_val == d->last_painted_progress ) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -366,7 +363,7 @@ bool QProgressBar::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 QABS( delta ) >= progressPerPixel;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|