Changeset View
Changeset View
Standalone View
Standalone View
lib/documentview/documentview.cpp
Context not available. | |||||
44 | #include <QStyleHints> | 44 | #include <QStyleHints> | ||
---|---|---|---|---|---|
45 | #include <QGestureEvent> | 45 | #include <QGestureEvent> | ||
46 | #include <QLibraryInfo> | 46 | #include <QLibraryInfo> | ||
47 | #include <QStyle> | ||||
47 | 48 | | |||
48 | // KDE | 49 | // KDE | ||
49 | #include <KLocalizedString> | 50 | #include <KLocalizedString> | ||
Context not available. | |||||
93 | static const int COMPARE_MARGIN = 4; | 94 | static const int COMPARE_MARGIN = 4; | ||
94 | 95 | | |||
95 | const int DocumentView::MaximumZoom = 16; | 96 | const int DocumentView::MaximumZoom = 16; | ||
96 | const int DocumentView::AnimDuration = 250; | | |||
97 | 97 | | |||
98 | struct DocumentViewPrivate | 98 | struct DocumentViewPrivate | ||
99 | { | 99 | { | ||
Context not available. | |||||
340 | return; | 340 | return; | ||
341 | } | 341 | } | ||
342 | } | 342 | } | ||
343 | int animDuration = q->style()->styleHint(QStyle::SH_Widget_Animation_Duration, nullptr, nullptr); | ||||
344 | if (!QApplication::isEffectEnabled(Qt::UI_FadeTooltip) || animDuration <= 0) { | ||||
345 | mOpacityEffect->setOpacity(value); | ||||
346 | if (qFuzzyCompare(value, 1)) { | ||||
347 | emit q->fadeInFinished(q); | ||||
348 | } | ||||
349 | return; | ||||
350 | } | ||||
343 | // Create a new fade animation | 351 | // Create a new fade animation | ||
344 | QPropertyAnimation* anim = new QPropertyAnimation(mOpacityEffect, "opacity"); | 352 | QPropertyAnimation* anim = new QPropertyAnimation(mOpacityEffect, "opacity"); | ||
345 | anim->setStartValue(mOpacityEffect->opacity()); | 353 | anim->setStartValue(mOpacityEffect->opacity()); | ||
Context not available. | |||||
349 | q, &DocumentView::slotFadeInFinished); | 357 | q, &DocumentView::slotFadeInFinished); | ||
350 | } | 358 | } | ||
351 | QObject::connect(anim, &QAbstractAnimation::finished, q, &DocumentView::isAnimatedChanged); | 359 | QObject::connect(anim, &QAbstractAnimation::finished, q, &DocumentView::isAnimatedChanged); | ||
352 | anim->setDuration(DocumentView::AnimDuration); | 360 | anim->setDuration(animDuration); | ||
353 | mFadeAnimation = anim; | 361 | mFadeAnimation = anim; | ||
354 | emit q->isAnimatedChanged(); | 362 | emit q->isAnimatedChanged(); | ||
355 | anim->start(QAbstractAnimation::DeleteWhenStopped); | 363 | anim->start(QAbstractAnimation::DeleteWhenStopped); | ||
Context not available. | |||||
982 | 990 | | |||
983 | void DocumentView::moveToAnimated(const QRect& rect) | 991 | void DocumentView::moveToAnimated(const QRect& rect) | ||
984 | { | 992 | { | ||
993 | int animDuration = style()->styleHint(QStyle::SH_Widget_Animation_Duration, nullptr, nullptr); | ||||
994 | if (!QApplication::isEffectEnabled(Qt::UI_AnimateTooltip) || animDuration <= 0) { | ||||
995 | setGeometry(rect); | ||||
996 | return; | ||||
997 | } | ||||
985 | QPropertyAnimation* anim = new QPropertyAnimation(this, "geometry"); | 998 | QPropertyAnimation* anim = new QPropertyAnimation(this, "geometry"); | ||
986 | anim->setStartValue(geometry()); | 999 | anim->setStartValue(geometry()); | ||
987 | anim->setEndValue(rect); | 1000 | anim->setEndValue(rect); | ||
988 | anim->setDuration(DocumentView::AnimDuration); | 1001 | anim->setDuration(animDuration); | ||
989 | connect(anim, &QAbstractAnimation::finished, this, &DocumentView::isAnimatedChanged); | 1002 | connect(anim, &QAbstractAnimation::finished, this, &DocumentView::isAnimatedChanged); | ||
990 | d->mMoveAnimation = anim; | 1003 | d->mMoveAnimation = anim; | ||
991 | emit isAnimatedChanged(); | 1004 | emit isAnimatedChanged(); | ||
Context not available. |