diff --git a/src/qt/modaloverlay.h b/src/qt/modaloverlay.h --- a/src/qt/modaloverlay.h +++ b/src/qt/modaloverlay.h @@ -6,6 +6,7 @@ #define BITCOIN_QT_MODALOVERLAY_H #include +#include #include //! The required delta of headers to the estimated number of available headers @@ -46,6 +47,7 @@ QVector> blockProcessTime; bool layerIsVisible; bool userClosed; + QPropertyAnimation m_animation; void UpdateHeaderSyncLabel(); }; diff --git a/src/qt/modaloverlay.cpp b/src/qt/modaloverlay.cpp --- a/src/qt/modaloverlay.cpp +++ b/src/qt/modaloverlay.cpp @@ -8,6 +8,7 @@ #include #include +#include #include #include @@ -32,6 +33,11 @@ "of the block chain.") .arg(PACKAGE_NAME)); } + + m_animation.setTargetObject(this); + m_animation.setPropertyName("pos"); + m_animation.setDuration(300 /* ms */); + m_animation.setEasingCurve(QEasingCurve::OutQuad); } ModalOverlay::~ModalOverlay() { @@ -47,6 +53,9 @@ setGeometry(0, height(), width(), height()); } + if (m_animation.endValue().toPoint().y() > 0) { + m_animation.setEndValue(QPoint(0, height())); + } } else if (ev->type() == QEvent::ChildAdded) { raise(); } @@ -185,14 +194,11 @@ setVisible(true); } - setGeometry(0, hide ? 0 : height(), width(), height()); - - QPropertyAnimation *animation = new QPropertyAnimation(this, "pos"); - animation->setDuration(300); - animation->setStartValue(QPoint(0, hide ? 0 : this->height())); - animation->setEndValue(QPoint(0, hide ? this->height() : 0)); - animation->setEasingCurve(QEasingCurve::OutQuad); - animation->start(QAbstractAnimation::DeleteWhenStopped); + m_animation.setStartValue(QPoint(0, hide ? 0 : height())); + // The eventFilter() updates the endValue if it is required for + // QEvent::Resize. + m_animation.setEndValue(QPoint(0, hide ? height() : 0)); + m_animation.start(QAbstractAnimation::KeepWhenStopped); layerIsVisible = !hide; }