MoodbarProxyStyle: Stop timeline if already running

This commit is contained in:
Jonas Kvinge 2024-11-09 19:18:38 +01:00
parent b16fbb3040
commit 0d2e933ed1
1 changed files with 4 additions and 1 deletions

View File

@ -139,11 +139,14 @@ void MoodbarProxyStyle::NextState() {
return; return;
} }
const QTimeLine::Direction direction = visible ? QTimeLine::Forward : QTimeLine::Backward; const QTimeLine::Direction direction = visible ? QTimeLine::Direction::Forward : QTimeLine::Direction::Backward;
if (state_ == State::MoodbarOn || state_ == State::MoodbarOff) { if (state_ == State::MoodbarOn || state_ == State::MoodbarOff) {
// Start the fade from the beginning. // Start the fade from the beginning.
fade_timeline_->setDirection(direction); fade_timeline_->setDirection(direction);
if (fade_timeline_->state() != QTimeLine::State::NotRunning) {
fade_timeline_->stop();
}
fade_timeline_->start(); fade_timeline_->start();
fade_source_ = QPixmap(); fade_source_ = QPixmap();