mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 13:47:26 +02:00
* Don't try animating with bogus values.
This commit is contained in:
@@ -28,6 +28,7 @@
|
|||||||
#include <QPropertyAnimation>
|
#include <QPropertyAnimation>
|
||||||
#include <QLayout>
|
#include <QLayout>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
#include <boost/concept_check.hpp>
|
||||||
|
|
||||||
|
|
||||||
StatsGauge::StatsGauge( QWidget* parent )
|
StatsGauge::StatsGauge( QWidget* parent )
|
||||||
@@ -110,8 +111,11 @@ StatsGauge::paintEvent( QPaintEvent* event )
|
|||||||
void
|
void
|
||||||
StatsGauge::setValue( int v )
|
StatsGauge::setValue( int v )
|
||||||
{
|
{
|
||||||
|
if ( maximum() == 0 )
|
||||||
|
return;
|
||||||
|
|
||||||
QPropertyAnimation* a = new QPropertyAnimation( (QProgressBar*)this, "value" );
|
QPropertyAnimation* a = new QPropertyAnimation( (QProgressBar*)this, "value" );
|
||||||
a->setEasingCurve( QEasingCurve( QEasingCurve::InOutQuad ) );
|
a->setEasingCurve( QEasingCurve( QEasingCurve::OutQuad ) );
|
||||||
a->setStartValue( value() > 0 ? value() : 1 );
|
a->setStartValue( value() > 0 ? value() : 1 );
|
||||||
a->setEndValue( v );
|
a->setEndValue( v );
|
||||||
a->setDuration( 2000 );
|
a->setDuration( 2000 );
|
||||||
|
Reference in New Issue
Block a user