Changeset View
Changeset View
Standalone View
Standalone View
lib/documentview/documentview.cpp
Context not available. | |||||
42 | #include <QDrag> | 42 | #include <QDrag> | ||
---|---|---|---|---|---|
43 | #include <QMimeData> | 43 | #include <QMimeData> | ||
44 | #include <QStyleHints> | 44 | #include <QStyleHints> | ||
45 | #include <QStyle> | ||||
45 | 46 | | |||
46 | // KDE | 47 | // KDE | ||
47 | #include <KLocalizedString> | 48 | #include <KLocalizedString> | ||
Context not available. | |||||
89 | static const int COMPARE_MARGIN = 4; | 90 | static const int COMPARE_MARGIN = 4; | ||
90 | 91 | | |||
91 | const int DocumentView::MaximumZoom = 16; | 92 | const int DocumentView::MaximumZoom = 16; | ||
92 | const int DocumentView::AnimDuration = 250; | | |||
93 | 93 | | |||
94 | struct DocumentViewPrivate | 94 | struct DocumentViewPrivate | ||
95 | { | 95 | { | ||
Context not available. | |||||
334 | return; | 334 | return; | ||
335 | } | 335 | } | ||
336 | } | 336 | } | ||
337 | int animDuration = q->style()->styleHint(QStyle::SH_Widget_Animation_Duration, nullptr, nullptr); | ||||
338 | if (!QApplication::isEffectEnabled(Qt::UI_FadeTooltip) || animDuration <= 0) { | ||||
339 | mOpacityEffect->setOpacity(value); | ||||
340 | if (qFuzzyCompare(value, 1)) { | ||||
341 | emit q->fadeInFinished(q); | ||||
342 | } | ||||
343 | return; | ||||
344 | } | ||||
337 | // Create a new fade animation | 345 | // Create a new fade animation | ||
338 | QPropertyAnimation* anim = new QPropertyAnimation(mOpacityEffect, "opacity"); | 346 | QPropertyAnimation* anim = new QPropertyAnimation(mOpacityEffect, "opacity"); | ||
339 | anim->setStartValue(mOpacityEffect->opacity()); | 347 | anim->setStartValue(mOpacityEffect->opacity()); | ||
Context not available. | |||||
343 | q, SLOT(slotFadeInFinished())); | 351 | q, SLOT(slotFadeInFinished())); | ||
344 | } | 352 | } | ||
345 | QObject::connect(anim, SIGNAL(finished()), q, SIGNAL(isAnimatedChanged())); | 353 | QObject::connect(anim, SIGNAL(finished()), q, SIGNAL(isAnimatedChanged())); | ||
346 | anim->setDuration(DocumentView::AnimDuration); | 354 | anim->setDuration(animDuration); | ||
347 | mFadeAnimation = anim; | 355 | mFadeAnimation = anim; | ||
348 | emit q->isAnimatedChanged(); | 356 | emit q->isAnimatedChanged(); | ||
349 | anim->start(QAbstractAnimation::DeleteWhenStopped); | 357 | anim->start(QAbstractAnimation::DeleteWhenStopped); | ||
Context not available. | |||||
901 | 909 | | |||
902 | void DocumentView::moveToAnimated(const QRect& rect) | 910 | void DocumentView::moveToAnimated(const QRect& rect) | ||
903 | { | 911 | { | ||
912 | int animDuration = style()->styleHint(QStyle::SH_Widget_Animation_Duration, nullptr, nullptr); | ||||
913 | if (!QApplication::isEffectEnabled(Qt::UI_AnimateTooltip) || animDuration <= 0) { | ||||
914 | setGeometry(rect); | ||||
915 | return; | ||||
916 | } | ||||
904 | QPropertyAnimation* anim = new QPropertyAnimation(this, "geometry"); | 917 | QPropertyAnimation* anim = new QPropertyAnimation(this, "geometry"); | ||
905 | anim->setStartValue(geometry()); | 918 | anim->setStartValue(geometry()); | ||
906 | anim->setEndValue(rect); | 919 | anim->setEndValue(rect); | ||
907 | anim->setDuration(DocumentView::AnimDuration); | 920 | anim->setDuration(animDuration); | ||
908 | connect(anim, SIGNAL(finished()), SIGNAL(isAnimatedChanged())); | 921 | connect(anim, SIGNAL(finished()), SIGNAL(isAnimatedChanged())); | ||
909 | d->mMoveAnimation = anim; | 922 | d->mMoveAnimation = anim; | ||
910 | emit isAnimatedChanged(); | 923 | emit isAnimatedChanged(); | ||
Context not available. |