Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | QWidgetAnimator::QWidgetAnimator(QMainWindowLayout *layout) : m_mainWindowLayout(layout) | - |
6 | { | - |
7 | } executed: } Execution Count:44 | 44 |
8 | | - |
9 | void QWidgetAnimator::abort(QWidget *w) | - |
10 | { | - |
11 | | - |
12 | AnimationMap::iterator it = m_animation_map.find(w); | - |
13 | if (it == m_animation_map.end()) evaluated: it == m_animation_map.end() yes Evaluation Count:22 | yes Evaluation Count:220 |
| 22-220 |
14 | return; executed: return; Execution Count:22 | 22 |
15 | QPropertyAnimation *anim = *it; | - |
16 | m_animation_map.erase(it); | - |
17 | if (anim) { partially evaluated: anim yes Evaluation Count:220 | no Evaluation Count:0 |
| 0-220 |
18 | anim->stop(); | - |
19 | } executed: } Execution Count:220 | 220 |
20 | | - |
21 | m_mainWindowLayout->animationFinished(w); | - |
22 | | - |
23 | | - |
24 | | - |
25 | | - |
26 | } executed: } Execution Count:220 | 220 |
27 | | - |
28 | | - |
29 | void QWidgetAnimator::animationFinished() | - |
30 | { | - |
31 | QPropertyAnimation *anim = qobject_cast<QPropertyAnimation*>(sender()); | - |
32 | abort(static_cast<QWidget*>(anim->targetObject())); executed: abort(static_cast<QWidget*>(anim->targetObject())); Execution Count:220 | 220 |
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() < 0 || r.bottom() < 0) evaluated: r.right() < 0 yes Evaluation Count:19 | yes Evaluation Count:201 |
partially evaluated: r.bottom() < 0 no Evaluation Count:0 | yes Evaluation Count:201 |
| 0-201 |
40 | r = QRect(); executed: r = QRect(); Execution Count:19 | 19 |
41 | | - |
42 | animate = animate && !r.isNull() && !_final_geometry.isNull(); partially evaluated: animate no Evaluation Count:0 | yes Evaluation Count:220 |
never evaluated: !r.isNull() never evaluated: !_final_geometry.isNull() | 0-220 |
43 | | - |
44 | | - |
45 | const QRect final_geometry = _final_geometry.isValid() || widget->isWindow() ? _final_geometry : evaluated: _final_geometry.isValid() yes Evaluation Count:197 | yes Evaluation Count:23 |
partially evaluated: widget->isWindow() no Evaluation Count:0 | yes Evaluation Count:23 |
| 0-197 |
46 | QRect(QPoint(-500 - widget->width(), -500 - widget->height()), widget->size()); | - |
47 | | - |
48 | | - |
49 | AnimationMap::const_iterator it = m_animation_map.constFind(widget); | - |
50 | if (it != m_animation_map.constEnd() && (*it)->endValue().toRect() == final_geometry) partially evaluated: it != m_animation_map.constEnd() no Evaluation Count:0 | yes Evaluation Count:220 |
never evaluated: (*it)->endValue().toRect() == final_geometry | 0-220 |
51 | return; | 0 |
52 | | - |
53 | QPropertyAnimation *anim = new QPropertyAnimation(widget, "geometry", widget); | - |
54 | anim->setDuration(animate ? 200 : 0); | - |
55 | anim->setEasingCurve(QEasingCurve::InOutQuad); | - |
56 | anim->setEndValue(final_geometry); | - |
57 | m_animation_map[widget] = anim; | - |
58 | connect(anim, "2""finished()", "1""animationFinished()"); | - |
59 | anim->start(QPropertyAnimation::DeleteWhenStopped); | - |
60 | | - |
61 | | - |
62 | | - |
63 | | - |
64 | | - |
65 | | - |
66 | | - |
67 | } executed: } Execution Count:220 | 220 |
68 | | - |
69 | bool QWidgetAnimator::animating() const | - |
70 | { | - |
71 | return !m_animation_map.isEmpty(); executed: return !m_animation_map.isEmpty(); Execution Count:440 | 440 |
72 | } | - |
73 | | - |
74 | | - |
75 | | - |
| | |