| Line | Source | Count |
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | | - |
| 6 | | - |
| 7 | | - |
| 8 | | - |
| 9 | | - |
| 10 | | - |
| 11 | | - |
| 12 | | - |
| 13 | | - |
| 14 | | - |
| 15 | | - |
| 16 | | - |
| 17 | | - |
| 18 | | - |
| 19 | | - |
| 20 | | - |
| 21 | | - |
| 22 | | - |
| 23 | | - |
| 24 | | - |
| 25 | | - |
| 26 | | - |
| 27 | | - |
| 28 | | - |
| 29 | | - |
| 30 | | - |
| 31 | | - |
| 32 | | - |
| 33 | | - |
| 34 | | - |
| 35 | | - |
| 36 | | - |
| 37 | | - |
| 38 | | - |
| 39 | | - |
| 40 | #include <QtCore/qpropertyanimation.h> | - |
| 41 | #include <QtWidgets/qwidget.h> | - |
| 42 | #include <QtWidgets/qstyle.h> | - |
| 43 | #include <private/qmainwindowlayout_p.h> | - |
| 44 | | - |
| 45 | #include "qwidgetanimator_p.h" | - |
| 46 | | - |
| 47 | QT_BEGIN_NAMESPACE | - |
| 48 | | - |
| 49 | QWidgetAnimator::QWidgetAnimator(QMainWindowLayout *layout) : m_mainWindowLayout(layout) | - |
| 50 | { | - |
| 51 | } never executed: end of block | 0 |
| 52 | | - |
| 53 | void QWidgetAnimator::abort(QWidget *w) | - |
| 54 | { | - |
| 55 | #ifndef QT_NO_ANIMATION | - |
| 56 | const auto it = m_animation_map.constFind(w); | - |
| 57 | if (it == m_animation_map.cend())| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 58 | return; never executed: return; | 0 |
| 59 | QPropertyAnimation *anim = *it; | - |
| 60 | m_animation_map.erase(it); | - |
| 61 | if (anim) {| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 62 | anim->stop(); | - |
| 63 | } never executed: end of block | 0 |
| 64 | #ifndef QT_NO_MAINWINDOW | - |
| 65 | m_mainWindowLayout->animationFinished(w); | - |
| 66 | #endif | - |
| 67 | #else | - |
| 68 | Q_UNUSED(w); | - |
| 69 | #endif //QT_NO_ANIMATION | - |
| 70 | } never executed: end of block | 0 |
| 71 | | - |
| 72 | #ifndef QT_NO_ANIMATION | - |
| 73 | void QWidgetAnimator::animationFinished() | - |
| 74 | { | - |
| 75 | QPropertyAnimation *anim = qobject_cast<QPropertyAnimation*>(sender()); | - |
| 76 | abort(static_cast<QWidget*>(anim->targetObject())); never executed: abort(static_cast<QWidget*>(anim->targetObject())); | 0 |
| 77 | } | - |
| 78 | #endif //QT_NO_ANIMATION | - |
| 79 | | - |
| 80 | void QWidgetAnimator::animate(QWidget *widget, const QRect &_final_geometry, bool animate) | - |
| 81 | { | - |
| 82 | QRect r = widget->geometry(); | - |
| 83 | if (r.right() < 0 || r.bottom() < 0)| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 84 | r = QRect(); never executed: r = QRect(); | 0 |
| 85 | | - |
| 86 | animate = animate && !r.isNull() && !_final_geometry.isNull();| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 87 | | - |
| 88 | | - |
| 89 | const QRect final_geometry = _final_geometry.isValid() || widget->isWindow() ? _final_geometry :| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 90 | QRect(QPoint(-500 - widget->width(), -500 - widget->height()), widget->size()); | - |
| 91 | | - |
| 92 | #ifndef QT_NO_ANIMATION | - |
| 93 | | - |
| 94 | if (widget->style()->styleHint(QStyle::SH_Widget_Animate, 0, widget)) {| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 95 | AnimationMap::const_iterator it = m_animation_map.constFind(widget); | - |
| 96 | if (it != m_animation_map.constEnd() && (*it)->endValue().toRect() == final_geometry)| TRUE | never evaluated | | FALSE | never evaluated |
| TRUE | never evaluated | | FALSE | never evaluated |
| 0 |
| 97 | return; never executed: return; | 0 |
| 98 | | - |
| 99 | QPropertyAnimation *anim = new QPropertyAnimation(widget, "geometry", widget); | - |
| 100 | anim->setDuration(animate ? 200 : 0); | - |
| 101 | anim->setEasingCurve(QEasingCurve::InOutQuad); | - |
| 102 | anim->setEndValue(final_geometry); | - |
| 103 | m_animation_map[widget] = anim; | - |
| 104 | connect(anim, SIGNAL(finished()), SLOT(animationFinished())); | - |
| 105 | anim->start(QPropertyAnimation::DeleteWhenStopped); | - |
| 106 | } else never executed: end of block | 0 |
| 107 | #endif //QT_NO_ANIMATION | - |
| 108 | { | - |
| 109 | | - |
| 110 | widget->setGeometry(final_geometry); | - |
| 111 | #ifndef QT_NO_MAINWINDOW | - |
| 112 | m_mainWindowLayout->animationFinished(widget); | - |
| 113 | #endif //QT_NO_MAINWINDOW | - |
| 114 | } never executed: end of block | 0 |
| 115 | } | - |
| 116 | | - |
| 117 | bool QWidgetAnimator::animating() const | - |
| 118 | { | - |
| 119 | return !m_animation_map.isEmpty(); never executed: return !m_animation_map.isEmpty(); | 0 |
| 120 | } | - |
| 121 | | - |
| 122 | QT_END_NAMESPACE | - |
| 123 | | - |
| 124 | #include "moc_qwidgetanimator_p.cpp" | - |
| | |