55#include <QtCore/QMutex>
56#include <QtCore/QHash>
57#include <QtCore/private/qlocking_p.h>
63 const QObject *
target = targetObject.valueBypassingBindings();
64 if (!
target || propertyName.value().isEmpty()) {
80 if (!
target->dynamicPropertyNames().contains(propertyName))
81 qWarning(
"QPropertyAnimation: you're trying to animate a non-existing property %s of "
83 propertyName.value().constData());
85 qWarning(
"QPropertyAnimation: you're trying to animate the non-writable property %s of "
87 propertyName.value().constData());
91void QPropertyAnimationPrivate::updateProperty(
const QVariant &newValue)
104 void *argv[] = {
const_cast<void *
>(newValue.
constData()),
const_cast<QVariant *
>(&newValue), &status, &
flags };
107 targetObject->setProperty(propertyName.value().constData(), newValue);
150 return d_func()->targetObject;
155 return &d_func()->targetObject;
162 qWarning(
"QPropertyAnimation::setTargetObject: you can't change the target of a running animation");
166 d->targetObject.removeBindingUnlessInWrapper();
167 const QObject *oldTarget =
d->targetObject.valueBypassingBindings();
171 if (oldTarget !=
nullptr)
173 d->targetObject.setValueBypassingBindings(
target);
177 [
d] {
d->targetObjectDestroyed(); });
179 d->updateMetaProperty();
180 d->targetObject.notify();
193 return d->propertyName;
200 qWarning(
"QPropertyAnimation::setPropertyName: you can't change the property name of a running animation");
204 d->propertyName.removeBindingUnlessInWrapper();
206 if (
d->propertyName.valueBypassingBindings() ==
propertyName)
210 d->updateMetaProperty();
211 d->propertyName.notify();
216 return &d_func()->propertyName;
251 if (!
d->targetObject && oldState ==
Stopped) {
252 qWarning(
"QPropertyAnimation::updateState (%s): Changing state of an animation without "
254 d->propertyName.value().constData());
263 auto locker = qt_unique_lock(
mutex);
264 using QPropertyAnimationPair = std::pair<QObject *, QByteArray>;
265 typedef QHash<QPropertyAnimationPair, QPropertyAnimation*> QPropertyAnimationHash;
266 Q_CONSTINIT
static QPropertyAnimationHash
hash;
276 QPropertyAnimationPair
key(
d->targetObject,
d->propertyName);
278 d->updateMetaProperty();
279 animToStop =
hash.value(
key,
nullptr);
284 d->setDefaultStartEndValue(
285 d->targetObject->property(
d->propertyName.value().constData()));
287 const char *what =
nullptr;
288 if (!
startValue().isValid() && (
d->direction ==
Backward || !
d->defaultStartEndValue.isValid())) {
291 if (!
endValue().isValid() && (
d->direction ==
Forward || !
d->defaultStartEndValue.isValid())) {
293 what =
"start and end";
298 qWarning(
"QPropertyAnimation::updateState (%s, %s, %ls): starting an animation "
300 d->propertyName.value().constData(),
301 d->targetObject->metaObject()->className(),
305 }
else if (
hash.value(
key) ==
this) {
315 current = current->
group();
322#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
QVariant property(const char *name) const
Returns the value of the object's name property.
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.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
#define qUtf16Printable(string)