Gui: Add animation interrupted signal

This commit is contained in:
Rexbas
2023-10-22 15:00:53 +02:00
committed by wwmayer
parent fdc07dba67
commit bb1815b80a
2 changed files with 10 additions and 0 deletions

View File

@@ -68,6 +68,10 @@ bool NavigationAnimator::startAndWait(const std::shared_ptr<NavigationAnimation>
bool finished = true;
QEventLoop loop;
connect(animation.get(), &NavigationAnimation::finished, &loop, &QEventLoop::quit);
connect(animation.get(), &NavigationAnimation::interrupted, &loop, [&finished, &loop]() {
finished = false;
loop.quit();
});
start(animation);
loop.exec();
return finished;
@@ -80,6 +84,7 @@ void NavigationAnimator::stop()
{
if (activeAnimation && activeAnimation->state() != QAbstractAnimation::State::Stopped) {
disconnect(activeAnimation.get(), &NavigationAnimation::finished, 0, 0);
Q_EMIT activeAnimation->interrupted();
activeAnimation->stop();
activeAnimation->onStop(false);
activeAnimation.reset();