From abf4314eafefa250476566863f2d384b5db6913c Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Fri, 7 Jun 2013 09:12:31 +0200 Subject: [PATCH] * Don't try animating with bogus values. --- src/libtomahawk/widgets/StatsGauge.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libtomahawk/widgets/StatsGauge.cpp b/src/libtomahawk/widgets/StatsGauge.cpp index 9d52a7655..499fba9f0 100644 --- a/src/libtomahawk/widgets/StatsGauge.cpp +++ b/src/libtomahawk/widgets/StatsGauge.cpp @@ -28,6 +28,7 @@ #include #include #include +#include StatsGauge::StatsGauge( QWidget* parent ) @@ -110,8 +111,11 @@ StatsGauge::paintEvent( QPaintEvent* event ) void StatsGauge::setValue( int v ) { + if ( maximum() == 0 ) + return; + QPropertyAnimation* a = new QPropertyAnimation( (QProgressBar*)this, "value" ); - a->setEasingCurve( QEasingCurve( QEasingCurve::InOutQuad ) ); + a->setEasingCurve( QEasingCurve( QEasingCurve::OutQuad ) ); a->setStartValue( value() > 0 ? value() : 1 ); a->setEndValue( v ); a->setDuration( 2000 );