55#include <QtCore/QMutex>
56#include <QtCore/QHash>
57#include <QtCore/private/qlocking_p.h>
63 if (!targetObject || propertyName.value().isEmpty()) {
71 propertyType = targetObject->property(propertyName.value()).userType();
72 propertyIndex = targetObject->metaObject()->indexOfProperty(propertyName.value());
79 if (!targetObject->dynamicPropertyNames().contains(propertyName))
80 qWarning(
"QPropertyAnimation: you're trying to animate a non-existing property %s of "
82 propertyName.value().constData());
83 }
else if (!targetObject->metaObject()->property(
propertyIndex).isWritable()) {
84 qWarning(
"QPropertyAnimation: you're trying to animate the non-writable property %s of "
86 propertyName.value().constData());
90void QPropertyAnimationPrivate::updateProperty(
const QVariant &newValue)
103 void *argv[] = {
const_cast<void *
>(newValue.
constData()),
const_cast<QVariant *
>(&newValue), &status, &
flags };
106 targetObject->setProperty(propertyName.value().constData(), newValue);
149 return d_func()->targetObject;
154 return &d_func()->targetObject;
161 qWarning(
"QPropertyAnimation::setTargetObject: you can't change the target of a running animation");
165 d->targetObject.removeBindingUnlessInWrapper();
169 if (
d->targetObject !=
nullptr)
171 d->targetObject.setValueBypassingBindings(
target);
173 if (
d->targetObject !=
nullptr) {
175 [
d] { d->targetObjectDestroyed(); });
177 d->updateMetaProperty();
178 d->targetObject.notify();
191 return d->propertyName;
198 qWarning(
"QPropertyAnimation::setPropertyName: you can't change the property name of a running animation");
202 d->propertyName.removeBindingUnlessInWrapper();
208 d->updateMetaProperty();
209 d->propertyName.notify();
214 return &d_func()->propertyName;
249 if (!
d->targetObject && oldState ==
Stopped) {
250 qWarning(
"QPropertyAnimation::updateState (%s): Changing state of an animation without "
252 d->propertyName.value().constData());
261 auto locker = qt_unique_lock(
mutex);
264 Q_CONSTINIT
static QPropertyAnimationHash
hash;
274 QPropertyAnimationPair
key(
d->targetObject,
d->propertyName);
276 d->updateMetaProperty();
277 animToStop =
hash.value(
key,
nullptr);
282 d->setDefaultStartEndValue(
283 d->targetObject->property(
d->propertyName.value().constData()));
285 const char *what =
nullptr;
286 if (!
startValue().isValid() && (
d->direction ==
Backward || !
d->defaultStartEndValue.isValid())) {
289 if (!
endValue().isValid() && (
d->direction ==
Forward || !
d->defaultStartEndValue.isValid())) {
291 what =
"start and end";
296 qWarning(
"QPropertyAnimation::updateState (%s, %s, %ls): starting an animation "
298 d->propertyName.value().constData(),
299 d->targetObject->metaObject()->className(),
303 }
else if (
hash.value(
key) ==
this) {
313 current = current->
group();
320#include "moc_qpropertyanimation.cpp"
State state
state of the animation.
State
This enum describes the state of the animation.
void stop()
Stops the animation.
QAnimationGroup * group() const
If this animation is part of a QAnimationGroup, this function returns a pointer to the group; otherwi...
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
\threadsafe
void destroyed(QObject *=nullptr)
This signal is emitted immediately before the object obj is destroyed, after any instances of QPointe...
void updateMetaProperty()
void setTargetObject(QObject *target)
void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState) override
\reimp
bool event(QEvent *event) override
\reimp
void setPropertyName(const QByteArray &propertyName)
~QPropertyAnimation()
Destroys the QPropertyAnimation instance.
void updateCurrentValue(const QVariant &value) override
This virtual function is called by QVariantAnimation whenever the current value changes.
QByteArray propertyName
the target property name for this animation
QPropertyAnimation(QObject *parent=nullptr)
Construct a QPropertyAnimation object.
QBindable< QObject * > bindableTargetObject()
QObject * targetObject
the target QObject for this animation.
QBindable< QByteArray > bindablePropertyName()
void convertValues(int t)
void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState) override
\reimp
QVariant startValue
the optional start value of the animation
QVariant endValue
the end value of the animation
bool event(QEvent *event) override
\reimp
const void * constData() const
QHash< int, QWidget * > hash
[35multi]
void newState(QList< State > &states, const char *token, const char *lexem, bool pre)
Combined button and popup list for selecting options.
std::pair< T1, T2 > QPair
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
#define qUtf16Printable(string)
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent