-void TopBar::setVisible(bool visible, Animated animated)
-{
- Q_ASSERT_X(animated == WithAnimation, "SelectionModeTopBar::setVisible", "This wasn't implemented.");
-
- if (m_heightAnimation) {
- m_heightAnimation->stop(); // deletes because of QAbstractAnimation::DeleteWhenStopped.
- }
- m_heightAnimation = new QPropertyAnimation(this, "maximumHeight");
- m_heightAnimation->setDuration(2 * style()->styleHint(QStyle::SH_Widget_Animation_Duration, nullptr, this) * GlobalConfig::animationDurationFactor());
-
- m_heightAnimation->setStartValue(height());
- m_heightAnimation->setEasingCurve(QEasingCurve::OutCubic);
- if (visible) {
- show();
- m_heightAnimation->setEndValue(m_preferredHeight);
- } else {
- m_heightAnimation->setEndValue(0);
- connect(m_heightAnimation, &QAbstractAnimation::finished, this, &QWidget::hide);
- }
-
- m_heightAnimation->start(QAbstractAnimation::DeleteWhenStopped);
-}
-