| 26 | |
| 27 | |
| 28 | SlideAnimator::SlideAnimator(QWidget* _widgetForSlide) : |
| 29 | AbstractAnimator(_widgetForSlide), |
| 30 | m_direction(WAF::FromLeftToRight), |
| 31 | m_isFixBackground(true), |
| 32 | m_isFixStartSize(false), |
| 33 | m_animation(new QPropertyAnimation(_widgetForSlide, "maximumWidth")), |
| 34 | m_decorator(new SlideForegroundDecorator(_widgetForSlide)) |
| 35 | { |
| 36 | Q_ASSERT(_widgetForSlide); |
| 37 | |
| 38 | _widgetForSlide->installEventFilter(this); |
| 39 | |
| 40 | m_animation->setDuration(300); |
| 41 | |
| 42 | m_decorator->hide(); |
| 43 | |
| 44 | // |
| 45 | // Синхронизируем изменение минимальных границ с максимальными |
| 46 | // |
| 47 | connect(m_animation, &QPropertyAnimation::valueChanged, [this] { |
| 48 | if (isWidth()) { |
| 49 | widgetForSlide()->setMinimumWidth(widgetForSlide()->maximumWidth()); |
| 50 | } else { |
| 51 | widgetForSlide()->setMinimumHeight(widgetForSlide()->maximumHeight()); |
| 52 | } |
| 53 | }); |
| 54 | |
| 55 | // |
| 56 | // Корректировки размера по завершению |
| 57 | // |
| 58 | connect(m_animation, &QPropertyAnimation::finished, [this] { |
| 59 | setAnimatedStopped(); |
| 60 | m_decorator->hide(); |
| 61 | }); |
| 62 | } |
| 63 | |
| 64 | void SlideAnimator::setAnimationDirection(WAF::AnimationDirection _direction) |
| 65 | { |
nothing calls this directly
no test coverage detected