|
|
@ -212,13 +212,11 @@ void TQProgressBar::setProgress( int progress )
|
|
|
|
progress < 0 || ( ( progress > total_steps ) && total_steps ) )
|
|
|
|
progress < 0 || ( ( progress > total_steps ) && total_steps ) )
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
const bool needRepaint = isVisible() && requireRepaint( progress );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
progress_val = progress;
|
|
|
|
progress_val = progress;
|
|
|
|
|
|
|
|
|
|
|
|
setIndicator( progress_str, progress_val, total_steps );
|
|
|
|
setIndicator( progress_str, progress_val, total_steps );
|
|
|
|
|
|
|
|
|
|
|
|
if ( needRepaint ) {
|
|
|
|
if ( isVisible() && repaintRequired() ) {
|
|
|
|
repaint( FALSE );
|
|
|
|
repaint( FALSE );
|
|
|
|
d->last_painted_progress = progress;
|
|
|
|
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
|
|
|
|
would require a repaint of the progress bar. This allows efficient
|
|
|
|
repainting.
|
|
|
|
repainting.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
bool TQProgressBar::requireRepaint( int newProgress ) const
|
|
|
|
bool TQProgressBar::repaintRequired() const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if ( newProgress == progress_val ||
|
|
|
|
if ( progress_val == d->last_painted_progress ) {
|
|
|
|
newProgress == d->last_painted_progress ) {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -375,7 +372,7 @@ bool TQProgressBar::requireRepaint( int newProgress ) const
|
|
|
|
progressPerPixel = float( total_steps ) / float( width );
|
|
|
|
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;
|
|
|
|
return TQABS( delta ) >= progressPerPixel;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|