OpenCoverage

qpropertyanimation.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/animation/qpropertyanimation.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Contact: https://www.qt.io/licensing/-
5**-
6** This file is part of the QtCore module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39-
40/*!-
41 \class QPropertyAnimation-
42 \inmodule QtCore-
43 \brief The QPropertyAnimation class animates Qt properties-
44 \since 4.6-
45-
46 \ingroup animation-
47-
48 QPropertyAnimation interpolates over \l{Qt's Property System}{Qt-
49 properties}. As property values are stored in \l{QVariant}s, the-
50 class inherits QVariantAnimation, and supports animation of the-
51 same \l{QMetaType::Type}{meta types} as its super class.-
52-
53 A class declaring properties must be a QObject. To make it-
54 possible to animate a property, it must provide a setter (so that-
55 QPropertyAnimation can set the property's value). Note that this-
56 makes it possible to animate many of Qt's widgets. Let's look at-
57 an example:-
58-
59 \code-
60 QPropertyAnimation *animation = new QPropertyAnimation(myWidget, "geometry");-
61 animation->setDuration(10000);-
62 animation->setStartValue(QRect(0, 0, 100, 30));-
63 animation->setEndValue(QRect(250, 250, 100, 30));-
64-
65 animation->start();-
66 \endcode-
67-
68 The property name and the QObject instance of which property-
69 should be animated are passed to the constructor. You can then-
70 specify the start and end value of the property. The procedure is-
71 equal for properties in classes you have implemented-
72 yourself--just check with QVariantAnimation that your QVariant-
73 type is supported.-
74-
75 The QVariantAnimation class description explains how to set up the-
76 animation in detail. Note, however, that if a start value is not-
77 set, the property will start at the value it had when the-
78 QPropertyAnimation instance was created.-
79-
80 QPropertyAnimation works like a charm on its own. For complex-
81 animations that, for instance, contain several objects,-
82 QAnimationGroup is provided. An animation group is an animation-
83 that can contain other animations, and that can manage when its-
84 animations are played. Look at QParallelAnimationGroup for an-
85 example.-
86-
87 \sa QVariantAnimation, QAnimationGroup, {The Animation Framework}-
88*/-
89-
90#include "qpropertyanimation.h"-
91#include "qanimationgroup.h"-
92#include "qpropertyanimation_p.h"-
93-
94#include <QtCore/QMutex>-
95-
96#ifndef QT_NO_ANIMATION-
97-
98QT_BEGIN_NAMESPACE-
99-
100void QPropertyAnimationPrivate::updateMetaProperty()-
101{-
102 if (!target || propertyName.isEmpty()) {
!targetDescription
TRUEnever evaluated
FALSEevaluated 3145 times by 23 tests
Evaluated by:
  • tst_Gestures
  • tst_QAccessibility
  • tst_QAnimationGroup
  • tst_QColumnView
  • tst_QDockWidget
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QParallelAnimationGroup
  • tst_QPauseAnimation
  • tst_QPrinter
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QShortcut
  • tst_QStateMachine
  • tst_QStyleSheetStyle
  • tst_QToolBar
  • tst_QWidget
  • tst_QWidget_window
  • tst_QWindowContainer
propertyName.isEmpty()Description
TRUEevaluated 1035 times by 23 tests
Evaluated by:
  • tst_Gestures
  • tst_QAccessibility
  • tst_QAnimationGroup
  • tst_QColumnView
  • tst_QDockWidget
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QParallelAnimationGroup
  • tst_QPauseAnimation
  • tst_QPrinter
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QShortcut
  • tst_QStateMachine
  • tst_QStyleSheetStyle
  • tst_QToolBar
  • tst_QWidget
  • tst_QWidget_window
  • tst_QWindowContainer
FALSEevaluated 2110 times by 23 tests
Evaluated by:
  • tst_Gestures
  • tst_QAccessibility
  • tst_QAnimationGroup
  • tst_QColumnView
  • tst_QDockWidget
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QParallelAnimationGroup
  • tst_QPauseAnimation
  • tst_QPrinter
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QShortcut
  • tst_QStateMachine
  • tst_QStyleSheetStyle
  • tst_QToolBar
  • tst_QWidget
  • tst_QWidget_window
  • tst_QWindowContainer
0-3145
103 propertyType = QVariant::Invalid;-
104 propertyIndex = -1;-
105 return;
executed 1035 times by 23 tests: return;
Executed by:
  • tst_Gestures
  • tst_QAccessibility
  • tst_QAnimationGroup
  • tst_QColumnView
  • tst_QDockWidget
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QParallelAnimationGroup
  • tst_QPauseAnimation
  • tst_QPrinter
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QShortcut
  • tst_QStateMachine
  • tst_QStyleSheetStyle
  • tst_QToolBar
  • tst_QWidget
  • tst_QWidget_window
  • tst_QWindowContainer
1035
106 }-
107-
108 //propertyType will be set to a valid type only if there is a Q_PROPERTY-
109 //otherwise it will be set to QVariant::Invalid at the end of this function-
110 propertyType = targetValue->property(propertyName).userType();-
111 propertyIndex = targetValue->metaObject()->indexOfProperty(propertyName);-
112-
113 if (propertyType != QVariant::Invalid)
propertyType !...riant::InvalidDescription
TRUEevaluated 2110 times by 23 tests
Evaluated by:
  • tst_Gestures
  • tst_QAccessibility
  • tst_QAnimationGroup
  • tst_QColumnView
  • tst_QDockWidget
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QParallelAnimationGroup
  • tst_QPauseAnimation
  • tst_QPrinter
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QShortcut
  • tst_QStateMachine
  • tst_QStyleSheetStyle
  • tst_QToolBar
  • tst_QWidget
  • tst_QWidget_window
  • tst_QWindowContainer
FALSEnever evaluated
0-2110
114 convertValues(propertyType);
executed 2110 times by 23 tests: convertValues(propertyType);
Executed by:
  • tst_Gestures
  • tst_QAccessibility
  • tst_QAnimationGroup
  • tst_QColumnView
  • tst_QDockWidget
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QParallelAnimationGroup
  • tst_QPauseAnimation
  • tst_QPrinter
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QShortcut
  • tst_QStateMachine
  • tst_QStyleSheetStyle
  • tst_QToolBar
  • tst_QWidget
  • tst_QWidget_window
  • tst_QWindowContainer
2110
115 if (propertyIndex == -1) {
propertyIndex == -1Description
TRUEevaluated 181 times by 6 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QParallelAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
FALSEevaluated 1929 times by 21 tests
Evaluated by:
  • tst_Gestures
  • tst_QAccessibility
  • tst_QAnimationGroup
  • tst_QColumnView
  • tst_QDockWidget
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QParallelAnimationGroup
  • tst_QPrinter
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QShortcut
  • tst_QStyleSheetStyle
  • tst_QToolBar
  • tst_QWidget
  • tst_QWidget_window
  • tst_QWindowContainer
181-1929
116 //there is no Q_PROPERTY on the object-
117 propertyType = QVariant::Invalid;-
118 if (!targetValue->dynamicPropertyNames().contains(propertyName))
!targetValue->...(propertyName)Description
TRUEnever evaluated
FALSEevaluated 181 times by 6 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QParallelAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
0-181
119 qWarning("QPropertyAnimation: you're trying to animate a non-existing property %s of your QObject", propertyName.constData());
never executed: QMessageLogger(__FILE__, 119, __PRETTY_FUNCTION__).warning("QPropertyAnimation: you're trying to animate a non-existing property %s of your QObject", propertyName.constData());
0
120 } else if (!targetValue->metaObject()->property(propertyIndex).isWritable()) {
executed 181 times by 6 tests: end of block
Executed by:
  • tst_QAnimationGroup
  • tst_QParallelAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
!targetValue->...).isWritable()Description
TRUEnever evaluated
FALSEevaluated 1929 times by 21 tests
Evaluated by:
  • tst_Gestures
  • tst_QAccessibility
  • tst_QAnimationGroup
  • tst_QColumnView
  • tst_QDockWidget
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QParallelAnimationGroup
  • tst_QPrinter
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QShortcut
  • tst_QStyleSheetStyle
  • tst_QToolBar
  • tst_QWidget
  • tst_QWidget_window
  • tst_QWindowContainer
0-1929
121 qWarning("QPropertyAnimation: you're trying to animate the non-writable property %s of your QObject", propertyName.constData());-
122 }
never executed: end of block
0
123}
executed 2110 times by 23 tests: end of block
Executed by:
  • tst_Gestures
  • tst_QAccessibility
  • tst_QAnimationGroup
  • tst_QColumnView
  • tst_QDockWidget
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QParallelAnimationGroup
  • tst_QPauseAnimation
  • tst_QPrinter
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QShortcut
  • tst_QStateMachine
  • tst_QStyleSheetStyle
  • tst_QToolBar
  • tst_QWidget
  • tst_QWidget_window
  • tst_QWindowContainer
2110
124-
125void QPropertyAnimationPrivate::updateProperty(const QVariant &newValue)-
126{-
127 if (state == QAbstractAnimation::Stopped)
state == QAbst...ation::StoppedDescription
TRUEevaluated 101 times by 4 tests
Evaluated by:
  • tst_QColumnView
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
FALSEevaluated 4023 times by 23 tests
Evaluated by:
  • tst_Gestures
  • tst_QAccessibility
  • tst_QAnimationGroup
  • tst_QColumnView
  • tst_QDockWidget
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QParallelAnimationGroup
  • tst_QPauseAnimation
  • tst_QPrinter
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QShortcut
  • tst_QStateMachine
  • tst_QStyleSheetStyle
  • tst_QToolBar
  • tst_QWidget
  • tst_QWidget_window
  • tst_QWindowContainer
101-4023
128 return;
executed 101 times by 4 tests: return;
Executed by:
  • tst_QColumnView
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
101
129-
130 if (!target) {
!targetDescription
TRUEevaluated 2 times by 2 tests
Evaluated by:
  • tst_QLineEdit
  • tst_QPropertyAnimation
FALSEevaluated 4021 times by 23 tests
Evaluated by:
  • tst_Gestures
  • tst_QAccessibility
  • tst_QAnimationGroup
  • tst_QColumnView
  • tst_QDockWidget
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QParallelAnimationGroup
  • tst_QPauseAnimation
  • tst_QPrinter
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QShortcut
  • tst_QStateMachine
  • tst_QStyleSheetStyle
  • tst_QToolBar
  • tst_QWidget
  • tst_QWidget_window
  • tst_QWindowContainer
2-4021
131 q_func()->stop(); //the target was destroyed we need to stop the animation-
132 return;
executed 2 times by 2 tests: return;
Executed by:
  • tst_QLineEdit
  • tst_QPropertyAnimation
2
133 }-
134-
135 if (newValue.userType() == propertyType) {
newValue.userT...= propertyTypeDescription
TRUEevaluated 2929 times by 20 tests
Evaluated by:
  • tst_Gestures
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QDockWidget
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QParallelAnimationGroup
  • tst_QPrinter
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QShortcut
  • tst_QStyleSheetStyle
  • tst_QToolBar
  • tst_QWidget
  • tst_QWidget_window
  • tst_QWindowContainer
FALSEevaluated 1092 times by 6 tests
Evaluated by:
  • tst_QAnimationGroup
  • tst_QParallelAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
1092-2929
136 //no conversion is needed, we directly call the QMetaObject::metacall-
137 //check QMetaProperty::write for an explanation of these-
138 int status = -1;-
139 int flags = 0;-
140 void *argv[] = { const_cast<void *>(newValue.constData()), const_cast<QVariant *>(&newValue), &status, &flags };-
141 QMetaObject::metacall(targetValue, QMetaObject::WriteProperty, propertyIndex, argv);-
142 } else {
executed 2929 times by 20 tests: end of block
Executed by:
  • tst_Gestures
  • tst_QAccessibility
  • tst_QColumnView
  • tst_QDockWidget
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QParallelAnimationGroup
  • tst_QPrinter
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QShortcut
  • tst_QStyleSheetStyle
  • tst_QToolBar
  • tst_QWidget
  • tst_QWidget_window
  • tst_QWindowContainer
2929
143 targetValue->setProperty(propertyName.constData(), newValue);-
144 }
executed 1092 times by 6 tests: end of block
Executed by:
  • tst_QAnimationGroup
  • tst_QParallelAnimationGroup
  • tst_QPauseAnimation
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
1092
145}-
146-
147/*!-
148 Construct a QPropertyAnimation object. \a parent is passed to QObject's-
149 constructor.-
150*/-
151QPropertyAnimation::QPropertyAnimation(QObject *parent)-
152 : QVariantAnimation(*new QPropertyAnimationPrivate, parent)-
153{-
154}
executed 111 times by 4 tests: end of block
Executed by:
  • tst_QAnimationGroup
  • tst_QColumnView
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
111
155-
156/*!-
157 Construct a QPropertyAnimation object. \a parent is passed to QObject's-
158 constructor. The animation changes the property \a propertyName on \a-
159 target. The default duration is 250ms.-
160-
161 \sa targetObject, propertyName-
162*/-
163QPropertyAnimation::QPropertyAnimation(QObject *target, const QByteArray &propertyName, QObject *parent)-
164 : QVariantAnimation(*new QPropertyAnimationPrivate, parent)-
165{-
166 setTargetObject(target);-
167 setPropertyName(propertyName);-
168}
executed 964 times by 22 tests: end of block
Executed by:
  • tst_Gestures
  • tst_QAccessibility
  • tst_QAnimationGroup
  • tst_QDockWidget
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QParallelAnimationGroup
  • tst_QPauseAnimation
  • tst_QPrinter
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QShortcut
  • tst_QStateMachine
  • tst_QStyleSheetStyle
  • tst_QToolBar
  • tst_QWidget
  • tst_QWidget_window
  • tst_QWindowContainer
964
169-
170/*!-
171 Destroys the QPropertyAnimation instance.-
172 */-
173QPropertyAnimation::~QPropertyAnimation()-
174{-
175 stop();-
176}
executed 1071 times by 23 tests: end of block
Executed by:
  • tst_Gestures
  • tst_QAccessibility
  • tst_QAnimationGroup
  • tst_QColumnView
  • tst_QDockWidget
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QParallelAnimationGroup
  • tst_QPauseAnimation
  • tst_QPrinter
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QShortcut
  • tst_QStateMachine
  • tst_QStyleSheetStyle
  • tst_QToolBar
  • tst_QWidget
  • tst_QWidget_window
  • tst_QWindowContainer
1071
177-
178/*!-
179 \property QPropertyAnimation::targetObject-
180 \brief the target QObject for this animation.-
181-
182 This property defines the target QObject for this animation.-
183 */-
184QObject *QPropertyAnimation::targetObject() const-
185{-
186 return d_func()->target.data();
executed 898 times by 17 tests: return d_func()->target.data();
Executed by:
  • tst_Gestures
  • tst_QAccessibility
  • tst_QDockWidget
  • tst_QGraphicsProxyWidget
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QPrinter
  • tst_QPropertyAnimation
  • tst_QShortcut
  • tst_QStateMachine
  • tst_QStyleSheetStyle
  • tst_QToolBar
  • tst_QWidget
  • tst_QWidget_window
  • tst_QWindowContainer
898
187}-
188-
189void QPropertyAnimation::setTargetObject(QObject *target)-
190{-
191 Q_D(QPropertyAnimation);-
192 if (d->target.data() == target)
d->target.data() == targetDescription
TRUEnever evaluated
FALSEevaluated 1035 times by 23 tests
Evaluated by:
  • tst_Gestures
  • tst_QAccessibility
  • tst_QAnimationGroup
  • tst_QColumnView
  • tst_QDockWidget
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QParallelAnimationGroup
  • tst_QPauseAnimation
  • tst_QPrinter
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QShortcut
  • tst_QStateMachine
  • tst_QStyleSheetStyle
  • tst_QToolBar
  • tst_QWidget
  • tst_QWidget_window
  • tst_QWindowContainer
0-1035
193 return;
never executed: return;
0
194-
195 if (d->state != QAbstractAnimation::Stopped) {
d->state != QA...ation::StoppedDescription
TRUEnever evaluated
FALSEevaluated 1035 times by 23 tests
Evaluated by:
  • tst_Gestures
  • tst_QAccessibility
  • tst_QAnimationGroup
  • tst_QColumnView
  • tst_QDockWidget
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QParallelAnimationGroup
  • tst_QPauseAnimation
  • tst_QPrinter
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QShortcut
  • tst_QStateMachine
  • tst_QStyleSheetStyle
  • tst_QToolBar
  • tst_QWidget
  • tst_QWidget_window
  • tst_QWindowContainer
0-1035
196 qWarning("QPropertyAnimation::setTargetObject: you can't change the target of a running animation");-
197 return;
never executed: return;
0
198 }-
199-
200 d->target = d->targetValue = target;-
201 d->updateMetaProperty();-
202}
executed 1035 times by 23 tests: end of block
Executed by:
  • tst_Gestures
  • tst_QAccessibility
  • tst_QAnimationGroup
  • tst_QColumnView
  • tst_QDockWidget
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QParallelAnimationGroup
  • tst_QPauseAnimation
  • tst_QPrinter
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QShortcut
  • tst_QStateMachine
  • tst_QStyleSheetStyle
  • tst_QToolBar
  • tst_QWidget
  • tst_QWidget_window
  • tst_QWindowContainer
1035
203-
204/*!-
205 \property QPropertyAnimation::propertyName-
206 \brief the target property name for this animation-
207-
208 This property defines the target property name for this animation. The-
209 property name is required for the animation to operate.-
210 */-
211QByteArray QPropertyAnimation::propertyName() const-
212{-
213 Q_D(const QPropertyAnimation);-
214 return d->propertyName;
executed 46 times by 1 test: return d->propertyName;
Executed by:
  • tst_QStateMachine
46
215}-
216-
217void QPropertyAnimation::setPropertyName(const QByteArray &propertyName)-
218{-
219 Q_D(QPropertyAnimation);-
220 if (d->state != QAbstractAnimation::Stopped) {
d->state != QA...ation::StoppedDescription
TRUEnever evaluated
FALSEevaluated 1035 times by 23 tests
Evaluated by:
  • tst_Gestures
  • tst_QAccessibility
  • tst_QAnimationGroup
  • tst_QColumnView
  • tst_QDockWidget
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QParallelAnimationGroup
  • tst_QPauseAnimation
  • tst_QPrinter
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QShortcut
  • tst_QStateMachine
  • tst_QStyleSheetStyle
  • tst_QToolBar
  • tst_QWidget
  • tst_QWidget_window
  • tst_QWindowContainer
0-1035
221 qWarning("QPropertyAnimation::setPropertyName: you can't change the property name of a running animation");-
222 return;
never executed: return;
0
223 }-
224-
225 d->propertyName = propertyName;-
226 d->updateMetaProperty();-
227}
executed 1035 times by 23 tests: end of block
Executed by:
  • tst_Gestures
  • tst_QAccessibility
  • tst_QAnimationGroup
  • tst_QColumnView
  • tst_QDockWidget
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QParallelAnimationGroup
  • tst_QPauseAnimation
  • tst_QPrinter
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QShortcut
  • tst_QStateMachine
  • tst_QStyleSheetStyle
  • tst_QToolBar
  • tst_QWidget
  • tst_QWidget_window
  • tst_QWindowContainer
1035
228-
229-
230/*!-
231 \reimp-
232 */-
233bool QPropertyAnimation::event(QEvent *event)-
234{-
235 return QVariantAnimation::event(event);
executed 448 times by 17 tests: return QVariantAnimation::event(event);
Executed by:
  • tst_Gestures
  • tst_QAccessibility
  • tst_QDockWidget
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QPrinter
  • tst_QPropertyAnimation
  • tst_QShortcut
  • tst_QStyleSheetStyle
  • tst_QToolBar
  • tst_QWidget
  • tst_QWidget_window
  • tst_QWindowContainer
448
236}-
237-
238/*!-
239 This virtual function is called by QVariantAnimation whenever the current value-
240 changes. \a value is the new, updated value. It updates the current value-
241 of the property on the target object.-
242-
243 \sa currentValue, currentTime-
244 */-
245void QPropertyAnimation::updateCurrentValue(const QVariant &value)-
246{-
247 Q_D(QPropertyAnimation);-
248 d->updateProperty(value);-
249}
executed 4124 times by 23 tests: end of block
Executed by:
  • tst_Gestures
  • tst_QAccessibility
  • tst_QAnimationGroup
  • tst_QColumnView
  • tst_QDockWidget
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QParallelAnimationGroup
  • tst_QPauseAnimation
  • tst_QPrinter
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QShortcut
  • tst_QStateMachine
  • tst_QStyleSheetStyle
  • tst_QToolBar
  • tst_QWidget
  • tst_QWidget_window
  • tst_QWindowContainer
4124
250-
251/*!-
252 \reimp-
253-
254 If the startValue is not defined when the state of the animation changes from Stopped to Running,-
255 the current property value is used as the initial value for the animation.-
256*/-
257void QPropertyAnimation::updateState(QAbstractAnimation::State newState,-
258 QAbstractAnimation::State oldState)-
259{-
260 Q_D(QPropertyAnimation);-
261-
262 if (!d->target && oldState == Stopped) {
!d->targetDescription
TRUEevaluated 7 times by 4 tests
Evaluated by:
  • tst_QLineEdit
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
FALSEevaluated 2168 times by 23 tests
Evaluated by:
  • tst_Gestures
  • tst_QAccessibility
  • tst_QAnimationGroup
  • tst_QColumnView
  • tst_QDockWidget
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QParallelAnimationGroup
  • tst_QPauseAnimation
  • tst_QPrinter
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QShortcut
  • tst_QStateMachine
  • tst_QStyleSheetStyle
  • tst_QToolBar
  • tst_QWidget
  • tst_QWidget_window
  • tst_QWindowContainer
oldState == StoppedDescription
TRUEnever evaluated
FALSEevaluated 7 times by 4 tests
Evaluated by:
  • tst_QLineEdit
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QStateMachine
0-2168
263 qWarning("QPropertyAnimation::updateState (%s): Changing state of an animation without target",-
264 d->propertyName.constData());-
265 return;
never executed: return;
0
266 }-
267-
268 QVariantAnimation::updateState(newState, oldState);-
269-
270 QPropertyAnimation *animToStop = 0;-
271 {-
272#ifndef QT_NO_THREAD-
273 static QBasicMutex mutex;-
274 QMutexLocker locker(&mutex);-
275#endif-
276 typedef QPair<QObject *, QByteArray> QPropertyAnimationPair;-
277 typedef QHash<QPropertyAnimationPair, QPropertyAnimation*> QPropertyAnimationHash;-
278 static QPropertyAnimationHash hash;-
279 //here we need to use value because we need to know to which pointer-
280 //the animation was referring in case stopped because the target was destroyed-
281 QPropertyAnimationPair key(d->targetValue, d->propertyName);-
282 if (newState == Running) {
newState == RunningDescription
TRUEevaluated 1075 times by 23 tests
Evaluated by:
  • tst_Gestures
  • tst_QAccessibility
  • tst_QAnimationGroup
  • tst_QColumnView
  • tst_QDockWidget
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QParallelAnimationGroup
  • tst_QPauseAnimation
  • tst_QPrinter
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QShortcut
  • tst_QStateMachine
  • tst_QStyleSheetStyle
  • tst_QToolBar
  • tst_QWidget
  • tst_QWidget_window
  • tst_QWindowContainer
FALSEevaluated 1100 times by 23 tests
Evaluated by:
  • tst_Gestures
  • tst_QAccessibility
  • tst_QAnimationGroup
  • tst_QColumnView
  • tst_QDockWidget
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QParallelAnimationGroup
  • tst_QPauseAnimation
  • tst_QPrinter
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QShortcut
  • tst_QStateMachine
  • tst_QStyleSheetStyle
  • tst_QToolBar
  • tst_QWidget
  • tst_QWidget_window
  • tst_QWindowContainer
1075-1100
283 d->updateMetaProperty();-
284 animToStop = hash.value(key, 0);-
285 hash.insert(key, this);-
286 locker.unlock();-
287 // update the default start value-
288 if (oldState == Stopped) {
oldState == StoppedDescription
TRUEevaluated 1071 times by 23 tests
Evaluated by:
  • tst_Gestures
  • tst_QAccessibility
  • tst_QAnimationGroup
  • tst_QColumnView
  • tst_QDockWidget
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QParallelAnimationGroup
  • tst_QPauseAnimation
  • tst_QPrinter
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QShortcut
  • tst_QStateMachine
  • tst_QStyleSheetStyle
  • tst_QToolBar
  • tst_QWidget
  • tst_QWidget_window
  • tst_QWindowContainer
FALSEevaluated 4 times by 2 tests
Evaluated by:
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
4-1071
289 d->setDefaultStartEndValue(d->targetValue->property(d->propertyName.constData()));-
290 //let's check if we have a start value and an end value-
291 if (!startValue().isValid() && (d->direction == Backward || !d->defaultStartEndValue.isValid())) {
!startValue().isValid()Description
TRUEevaluated 1035 times by 23 tests
Evaluated by:
  • tst_Gestures
  • tst_QAccessibility
  • tst_QAnimationGroup
  • tst_QColumnView
  • tst_QDockWidget
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QParallelAnimationGroup
  • tst_QPauseAnimation
  • tst_QPrinter
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QShortcut
  • tst_QStateMachine
  • tst_QStyleSheetStyle
  • tst_QToolBar
  • tst_QWidget
  • tst_QWidget_window
  • tst_QWindowContainer
FALSEevaluated 36 times by 1 test
Evaluated by:
  • tst_QPropertyAnimation
d->direction == BackwardDescription
TRUEnever evaluated
FALSEevaluated 1035 times by 23 tests
Evaluated by:
  • tst_Gestures
  • tst_QAccessibility
  • tst_QAnimationGroup
  • tst_QColumnView
  • tst_QDockWidget
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QParallelAnimationGroup
  • tst_QPauseAnimation
  • tst_QPrinter
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QShortcut
  • tst_QStateMachine
  • tst_QStyleSheetStyle
  • tst_QToolBar
  • tst_QWidget
  • tst_QWidget_window
  • tst_QWindowContainer
!d->defaultSta...alue.isValid()Description
TRUEnever evaluated
FALSEevaluated 1035 times by 23 tests
Evaluated by:
  • tst_Gestures
  • tst_QAccessibility
  • tst_QAnimationGroup
  • tst_QColumnView
  • tst_QDockWidget
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QParallelAnimationGroup
  • tst_QPauseAnimation
  • tst_QPrinter
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QShortcut
  • tst_QStateMachine
  • tst_QStyleSheetStyle
  • tst_QToolBar
  • tst_QWidget
  • tst_QWidget_window
  • tst_QWindowContainer
0-1035
292 qWarning("QPropertyAnimation::updateState (%s, %s, %s): starting an animation without start value",-
293 d->propertyName.constData(), d->target.data()->metaObject()->className(),-
294 qPrintable(d->target.data()->objectName()));-
295 }
never executed: end of block
0
296 if (!endValue().isValid() && (d->direction == Forward || !d->defaultStartEndValue.isValid())) {
!endValue().isValid()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QPropertyAnimation
FALSEevaluated 1069 times by 23 tests
Evaluated by:
  • tst_Gestures
  • tst_QAccessibility
  • tst_QAnimationGroup
  • tst_QColumnView
  • tst_QDockWidget
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QParallelAnimationGroup
  • tst_QPauseAnimation
  • tst_QPrinter
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QShortcut
  • tst_QStateMachine
  • tst_QStyleSheetStyle
  • tst_QToolBar
  • tst_QWidget
  • tst_QWidget_window
  • tst_QWindowContainer
d->direction == ForwardDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QPropertyAnimation
!d->defaultSta...alue.isValid()Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QPropertyAnimation
0-1069
297 qWarning("QPropertyAnimation::updateState (%s, %s, %s): starting an animation without end value",-
298 d->propertyName.constData(), d->target.data()->metaObject()->className(),-
299 qPrintable(d->target.data()->objectName()));-
300 }
never executed: end of block
0
301 }
executed 1071 times by 23 tests: end of block
Executed by:
  • tst_Gestures
  • tst_QAccessibility
  • tst_QAnimationGroup
  • tst_QColumnView
  • tst_QDockWidget
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QParallelAnimationGroup
  • tst_QPauseAnimation
  • tst_QPrinter
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QShortcut
  • tst_QStateMachine
  • tst_QStyleSheetStyle
  • tst_QToolBar
  • tst_QWidget
  • tst_QWidget_window
  • tst_QWindowContainer
1071
302 } else if (hash.value(key) == this) {
executed 1075 times by 23 tests: end of block
Executed by:
  • tst_Gestures
  • tst_QAccessibility
  • tst_QAnimationGroup
  • tst_QColumnView
  • tst_QDockWidget
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QParallelAnimationGroup
  • tst_QPauseAnimation
  • tst_QPrinter
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QShortcut
  • tst_QStateMachine
  • tst_QStyleSheetStyle
  • tst_QToolBar
  • tst_QWidget
  • tst_QWidget_window
  • tst_QWindowContainer
hash.value(key) == thisDescription
TRUEevaluated 1074 times by 23 tests
Evaluated by:
  • tst_Gestures
  • tst_QAccessibility
  • tst_QAnimationGroup
  • tst_QColumnView
  • tst_QDockWidget
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QParallelAnimationGroup
  • tst_QPauseAnimation
  • tst_QPrinter
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QShortcut
  • tst_QStateMachine
  • tst_QStyleSheetStyle
  • tst_QToolBar
  • tst_QWidget
  • tst_QWidget_window
  • tst_QWindowContainer
FALSEevaluated 26 times by 3 tests
Evaluated by:
  • tst_QParallelAnimationGroup
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
26-1075
303 hash.remove(key);-
304 }
executed 1074 times by 23 tests: end of block
Executed by:
  • tst_Gestures
  • tst_QAccessibility
  • tst_QAnimationGroup
  • tst_QColumnView
  • tst_QDockWidget
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QParallelAnimationGroup
  • tst_QPauseAnimation
  • tst_QPrinter
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QShortcut
  • tst_QStateMachine
  • tst_QStyleSheetStyle
  • tst_QToolBar
  • tst_QWidget
  • tst_QWidget_window
  • tst_QWindowContainer
1074
305 }-
306-
307 //we need to do that after the mutex was unlocked-
308 if (animToStop) {
animToStopDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPropertyAnimation
FALSEevaluated 2174 times by 23 tests
Evaluated by:
  • tst_Gestures
  • tst_QAccessibility
  • tst_QAnimationGroup
  • tst_QColumnView
  • tst_QDockWidget
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QParallelAnimationGroup
  • tst_QPauseAnimation
  • tst_QPrinter
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QShortcut
  • tst_QStateMachine
  • tst_QStyleSheetStyle
  • tst_QToolBar
  • tst_QWidget
  • tst_QWidget_window
  • tst_QWindowContainer
1-2174
309 // try to stop the top level group-
310 QAbstractAnimation *current = animToStop;-
311 while (current->group() && current->state() != Stopped)
current->group()Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPropertyAnimation
current->state() != StoppedDescription
TRUEnever evaluated
FALSEnever evaluated
0-1
312 current = current->group();
never executed: current = current->group();
0
313 current->stop();-
314 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPropertyAnimation
1
315}
executed 2175 times by 23 tests: end of block
Executed by:
  • tst_Gestures
  • tst_QAccessibility
  • tst_QAnimationGroup
  • tst_QColumnView
  • tst_QDockWidget
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMenu
  • tst_QParallelAnimationGroup
  • tst_QPauseAnimation
  • tst_QPrinter
  • tst_QPropertyAnimation
  • tst_QSequentialAnimationGroup
  • tst_QShortcut
  • tst_QStateMachine
  • tst_QStyleSheetStyle
  • tst_QToolBar
  • tst_QWidget
  • tst_QWidget_window
  • tst_QWindowContainer
2175
316-
317#include "moc_qpropertyanimation.cpp"-
318-
319QT_END_NAMESPACE-
320-
321#endif //QT_NO_ANIMATION-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9