Changeset View
Changeset View
Standalone View
Standalone View
lib/slidecontainer.cpp
Context not available. | |||||
26 | #include <QEvent> | 26 | #include <QEvent> | ||
---|---|---|---|---|---|
27 | #include <QPropertyAnimation> | 27 | #include <QPropertyAnimation> | ||
28 | #include <QResizeEvent> | 28 | #include <QResizeEvent> | ||
29 | #include <QStyle> | ||||
30 | #include <QApplication> | ||||
29 | 31 | | |||
30 | namespace Gwenview | 32 | namespace Gwenview | ||
31 | { | 33 | { | ||
32 | 34 | | |||
33 | static const int SLIDE_DURATION = 250; | | |||
34 | | ||||
35 | SlideContainer::SlideContainer(QWidget* parent) | 35 | SlideContainer::SlideContainer(QWidget* parent) | ||
36 | : QFrame(parent) | 36 | : QFrame(parent) | ||
37 | { | 37 | { | ||
Context not available. | |||||
61 | 61 | | |||
62 | void SlideContainer::animTo(int newHeight) | 62 | void SlideContainer::animTo(int newHeight) | ||
63 | { | 63 | { | ||
64 | int animDuration = style()->styleHint(QStyle::SH_Widget_Animation_Duration, nullptr, this); | ||||
65 | if (!QApplication::isEffectEnabled(Qt::UI_AnimateMenu) || animDuration <= 0) { | ||||
66 | setSlideHeight(newHeight); | ||||
67 | return; | ||||
68 | } | ||||
69 | | ||||
64 | delete mAnim.data(); | 70 | delete mAnim.data(); | ||
65 | QPropertyAnimation* anim = new QPropertyAnimation(this, "slideHeight", this); | 71 | QPropertyAnimation* anim = new QPropertyAnimation(this, "slideHeight", this); | ||
66 | anim->setDuration(SLIDE_DURATION); | 72 | anim->setDuration(animDuration); | ||
67 | anim->setStartValue(slideHeight()); | 73 | anim->setStartValue(slideHeight()); | ||
68 | anim->setEndValue(newHeight); | 74 | anim->setEndValue(newHeight); | ||
69 | anim->start(QAbstractAnimation::DeleteWhenStopped); | 75 | anim->start(QAbstractAnimation::DeleteWhenStopped); | ||
Context not available. |