diff options
author | Joaquim Rocha <jrocha@igalia.com> | 2011-01-24 13:19:08 +0100 |
---|---|---|
committer | Holger Schröder <holger.schroeder.ext@basyskom.de> | 2011-01-25 17:17:03 +0100 |
commit | 6c961cc994a0330fe83bf943fc9638a77213c9d9 (patch) | |
tree | 1c8cf21fc23757a7a17f6e3d7ce5d633a18eb2c0 | |
parent | b5231ff074f7cc3e7f16dd0636e124d5ceb7c043 (diff) |
Fixes: NB#219747 - music-suite rendering ~10 frames per second while playing music
RevBy: Holger Schroeder
Details:
There was an animation being performed every time the slider's value
was set. This was damaging performance. These changes remove the
animation when the value is set programatically.
-rw-r--r-- | src/views/msliderview.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/views/msliderview.cpp b/src/views/msliderview.cpp index a4608ff1..79027ad3 100644 --- a/src/views/msliderview.cpp +++ b/src/views/msliderview.cpp @@ -1492,15 +1492,16 @@ int MSliderViewPrivate::updateValue(QGraphicsSceneMouseEvent *event) //event position (for example when user clicks to slider groove //once it is called at mouse press and once at mouse release) if (newValue != q->model()->value()) { - controller->setValue(newValue); if (needAnimation) { if (!positionAnimation) { positionAnimation = createPositionAnimation(); } positionAnimation->setEndValue(newValue); positionAnimation->start(); - } else + } else { position = newValue; + } + controller->setValue(newValue); } return newValue; @@ -1583,15 +1584,14 @@ void MSliderView::updateData(const QList<const char *>& modifications) else if (member == MSliderModel::Maximum) d->updateSliderGroove(); else if (member == MSliderModel::Value) { - if (!(d->controller->isVisible() && d->controller->isOnDisplay())) { + // The position should not be set here if the position animation + // is running or else it would not let the animation play correctly + if (!(d->controller->isVisible() && d->controller->isOnDisplay()) || + !d->positionAnimation || + (d->positionAnimation->state() != QAbstractAnimation::Running)) { setPosition(model()->value()); continue; } - if (!d->positionAnimation) { - d->positionAnimation = d->createPositionAnimation(); - } - d->positionAnimation->setEndValue(model()->value()); - d->positionAnimation->start(); } else if (member == MSliderModel::Steps) d->updateSliderGroove(); |