Line | Source | Count |
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | QWidgetAnimator::QWidgetAnimator(QMainWindowLayout *layout) : m_mainWindowLayout(layout) | - |
6 | { | - |
7 | } never executed: end of block | 0 |
8 | | - |
9 | void QWidgetAnimator::abort(QWidget *w) | - |
10 | { | - |
11 | | - |
12 | const auto it = m_animation_map.constFind(w); | - |
13 | if (it == m_animation_map.cend()TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
14 | return; never executed: return; | 0 |
15 | QPropertyAnimation *anim = *it; | - |
16 | m_animation_map.erase(it); | - |
17 | if (animTRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
18 | anim->stop(); | - |
19 | } never executed: end of block | 0 |
20 | | - |
21 | m_mainWindowLayout->animationFinished(w); | - |
22 | | - |
23 | | - |
24 | | - |
25 | | - |
26 | } never executed: end of block | 0 |
27 | | - |
28 | | - |
29 | void QWidgetAnimator::animationFinished() | - |
30 | { | - |
31 | QPropertyAnimation *anim = qobject_cast<QPropertyAnimation*>(sender()); | - |
32 | abort(static_cast<QWidget*>(anim->targetObject())); never executed: abort(static_cast<QWidget*>(anim->targetObject())); | 0 |
33 | } | - |
34 | | - |
35 | | - |
36 | void QWidgetAnimator::animate(QWidget *widget, const QRect &_final_geometry, bool animate) | - |
37 | { | - |
38 | QRect r = widget->geometry(); | - |
39 | if (r.right() < 0TRUE | never evaluated | FALSE | never evaluated |
|| r.bottom() < 0TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
40 | r = QRect(); never executed: r = QRect(); | 0 |
41 | | - |
42 | animate = animateTRUE | never evaluated | FALSE | never evaluated |
&& !r.isNull()TRUE | never evaluated | FALSE | never evaluated |
&& !_final_geometry.isNull()TRUE | never evaluated | FALSE | never evaluated |
; | 0 |
43 | | - |
44 | | - |
45 | const QRect final_geometry = _final_geometry.isValid()TRUE | never evaluated | FALSE | never evaluated |
|| widget->isWindow()TRUE | never evaluated | FALSE | never evaluated |
? _final_geometry : | 0 |
46 | QRect(QPoint(-500 - widget->width(), -500 - widget->height()), widget->size()); | - |
47 | | - |
48 | | - |
49 | | - |
50 | if (widget->style()->styleHint(QStyle::SH_Widget_Animate, 0, widget)TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
51 | AnimationMap::const_iterator it = m_animation_map.constFind(widget); | - |
52 | if (it != m_animation_map.constEnd()TRUE | never evaluated | FALSE | never evaluated |
&& (*TRUE | never evaluated | FALSE | never evaluated |
it)->endValue().toRect() == final_geometryTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
53 | return; never executed: return; | 0 |
54 | | - |
55 | QPropertyAnimation *anim = new QPropertyAnimation(widget, "geometry", widget); | - |
56 | anim->setDuration(animate ? 200 : 0); | - |
57 | anim->setEasingCurve(QEasingCurve::InOutQuad); | - |
58 | anim->setEndValue(final_geometry); | - |
59 | m_animation_map[widget] = anim; | - |
60 | connect(anim, qFlagLocation("2""finished()" "\0" __FILE__ ":" "104"), qFlagLocation("1""animationFinished()" "\0" __FILE__ ":" "104")); | - |
61 | anim->start(QPropertyAnimation::DeleteWhenStopped); | - |
62 | } never executed: end of block else | 0 |
63 | | - |
64 | { | - |
65 | | - |
66 | widget->setGeometry(final_geometry); | - |
67 | | - |
68 | m_mainWindowLayout->animationFinished(widget); | - |
69 | | - |
70 | } never executed: end of block | 0 |
71 | } | - |
72 | | - |
73 | bool QWidgetAnimator::animating() const | - |
74 | { | - |
75 | return never executed: return !m_animation_map.isEmpty(); !m_animation_map.isEmpty();never executed: return !m_animation_map.isEmpty(); | 0 |
76 | } | - |
77 | | - |
78 | | - |
79 | | - |
| | |