An error occurs when using animation effects.
-
An error occurs when using animation effects.
- Error Message
QPropertyAnimation: you're trying to animate a non-existing property AnmOuterBoundary of your QObject
Q_OBJECT Q_PROPERTY(qreal AnmFrameAlpha READ AnmFrameAlpha WRITE SetAnmFrameAlpha) public: qreal AnmFrameAlpha() const; public slots: void SetAnmFrameAlpha(qreal rAlpha); qreal usrCntrListItem::AnmFrameAlpha() const { return this->windowOpacity(); } void usrCntrListItem::SetAnmFrameAlpha(qreal rAlpha) { this->setWindowOpacity(rAlpha); this->update(); } void usrCntrListItem::SetCheckVisible(bool bShow) { //this->ui.frame->setVisible(bShow); this->ui.chk_Enable->setVisible(bShow); auto anim = new QPropertyAnimation(this->ui.frame, "AnmFrameAlpha", this); anim->setDuration(1500); //anim->setStartValue(bShow ? 1.0 : 0.0); //anim->setEndValue(!bShow ? 1.0 : 0.0); anim->setStartValue(bShow ? 0.0 : 1.0); anim->setEndValue(bShow ? 1.0 : 0.0); anim->start(); }
- Error Message
-
QPropertyAnimation: you're trying to animate a non-existing property AnmFrameAlpha of your QObject
void usrCntrListItem::SetCheckVisible(bool bShow) { if (bShow) { QSize s = this->ui.frame->size(); auto anim = new QPropertyAnimation(this->ui.frame, "AnmFrameAlpha", this); anim->setDuration(1500); anim->setStartValue(0.0); anim->setEndValue(1.0); anim->start(QAbstractAnimation::DeleteWhenStopped); } else { auto anim = new QPropertyAnimation(this->ui.frame, "AnmFrameAlpha", this); anim->setDuration(500); anim->setStartValue(1.0); anim->setEndValue(0.0); anim->start(QAbstractAnimation::DeleteWhenStopped); } } qreal usrCntrListItem::AnmFrameAlpha() const { return this->windowOpacity(); } void usrCntrListItem::SetAnmFrameAlpha(qreal rAlpha) { this->setWindowOpacity(rAlpha); this->update(); } ## Header Q_OBJECT Q_PROPERTY(qreal AnmFrameAlpha READ AnmFrameAlpha WRITE SetAnmFrameAlpha) public: qreal AnmFrameAlpha() const; public slots: void SetAnmFrameAlpha(qreal rAlpha);
@IknowQT said in An error occurs when using animation effects.:
auto anim = new QPropertyAnimation(this->ui.frame, "AnmFrameAlpha", this);
This can't work: AnmFrameAlpha is a property of your usrCntrListItem class, not frame.
Should be:auto anim = new QPropertyAnimation(this, "AnmFrameAlpha", this);
-
An error occurs when using animation effects.
- Error Message
QPropertyAnimation: you're trying to animate a non-existing property AnmOuterBoundary of your QObject
Q_OBJECT Q_PROPERTY(qreal AnmFrameAlpha READ AnmFrameAlpha WRITE SetAnmFrameAlpha) public: qreal AnmFrameAlpha() const; public slots: void SetAnmFrameAlpha(qreal rAlpha); qreal usrCntrListItem::AnmFrameAlpha() const { return this->windowOpacity(); } void usrCntrListItem::SetAnmFrameAlpha(qreal rAlpha) { this->setWindowOpacity(rAlpha); this->update(); } void usrCntrListItem::SetCheckVisible(bool bShow) { //this->ui.frame->setVisible(bShow); this->ui.chk_Enable->setVisible(bShow); auto anim = new QPropertyAnimation(this->ui.frame, "AnmFrameAlpha", this); anim->setDuration(1500); //anim->setStartValue(bShow ? 1.0 : 0.0); //anim->setEndValue(!bShow ? 1.0 : 0.0); anim->setStartValue(bShow ? 0.0 : 1.0); anim->setEndValue(bShow ? 1.0 : 0.0); anim->start(); }
It says that you dont have
AnmOuterBoundary
property. The weird thing is, that the property name in your animation is correct.
I've noticed that your proptery name and your propertyREAD
have the exact same name... Could be the issue here.
(Edit: Is possible)Since it seems like your are trying to animate the opacity, you could also do it this way:
Maybe it works for you.
Edit:
Another thought: Have you done a clean & rebuild and re-run qmake / cmake already?
If there was a property with the name, the error msg states, there could be some junk temp files from former builds laying around. - Error Message
-
An error occurs when using animation effects.
- Error Message
QPropertyAnimation: you're trying to animate a non-existing property AnmOuterBoundary of your QObject
Q_OBJECT Q_PROPERTY(qreal AnmFrameAlpha READ AnmFrameAlpha WRITE SetAnmFrameAlpha) public: qreal AnmFrameAlpha() const; public slots: void SetAnmFrameAlpha(qreal rAlpha); qreal usrCntrListItem::AnmFrameAlpha() const { return this->windowOpacity(); } void usrCntrListItem::SetAnmFrameAlpha(qreal rAlpha) { this->setWindowOpacity(rAlpha); this->update(); } void usrCntrListItem::SetCheckVisible(bool bShow) { //this->ui.frame->setVisible(bShow); this->ui.chk_Enable->setVisible(bShow); auto anim = new QPropertyAnimation(this->ui.frame, "AnmFrameAlpha", this); anim->setDuration(1500); //anim->setStartValue(bShow ? 1.0 : 0.0); //anim->setEndValue(!bShow ? 1.0 : 0.0); anim->setStartValue(bShow ? 0.0 : 1.0); anim->setEndValue(bShow ? 1.0 : 0.0); anim->start(); }
@IknowQT said in An error occurs when using animation effects.:
you're trying to animate a non-existing property AnmOuterBoundary of your QObject
Do you have another animation trying to animate AnmOuterBoundary property?
In the code you posted you only have property AnmFrameAlpha. - Error Message
-
@IknowQT said in An error occurs when using animation effects.:
you're trying to animate a non-existing property AnmOuterBoundary of your QObject
Do you have another animation trying to animate AnmOuterBoundary property?
In the code you posted you only have property AnmFrameAlpha. -
Although I did not capture well, an error message is displayed even if I change to AnyFrame Alpha.
@IknowQT said in An error occurs when using animation effects.:
an error message
Would be nice to see it...
-
@IknowQT said in An error occurs when using animation effects.:
an error message
Would be nice to see it...
QPropertyAnimation: you're trying to animate a non-existing property AnmFrameAlpha of your QObject
void usrCntrListItem::SetCheckVisible(bool bShow) { if (bShow) { QSize s = this->ui.frame->size(); auto anim = new QPropertyAnimation(this->ui.frame, "AnmFrameAlpha", this); anim->setDuration(1500); anim->setStartValue(0.0); anim->setEndValue(1.0); anim->start(QAbstractAnimation::DeleteWhenStopped); } else { auto anim = new QPropertyAnimation(this->ui.frame, "AnmFrameAlpha", this); anim->setDuration(500); anim->setStartValue(1.0); anim->setEndValue(0.0); anim->start(QAbstractAnimation::DeleteWhenStopped); } } qreal usrCntrListItem::AnmFrameAlpha() const { return this->windowOpacity(); } void usrCntrListItem::SetAnmFrameAlpha(qreal rAlpha) { this->setWindowOpacity(rAlpha); this->update(); } ## Header Q_OBJECT Q_PROPERTY(qreal AnmFrameAlpha READ AnmFrameAlpha WRITE SetAnmFrameAlpha) public: qreal AnmFrameAlpha() const; public slots: void SetAnmFrameAlpha(qreal rAlpha);
-
QPropertyAnimation: you're trying to animate a non-existing property AnmFrameAlpha of your QObject
void usrCntrListItem::SetCheckVisible(bool bShow) { if (bShow) { QSize s = this->ui.frame->size(); auto anim = new QPropertyAnimation(this->ui.frame, "AnmFrameAlpha", this); anim->setDuration(1500); anim->setStartValue(0.0); anim->setEndValue(1.0); anim->start(QAbstractAnimation::DeleteWhenStopped); } else { auto anim = new QPropertyAnimation(this->ui.frame, "AnmFrameAlpha", this); anim->setDuration(500); anim->setStartValue(1.0); anim->setEndValue(0.0); anim->start(QAbstractAnimation::DeleteWhenStopped); } } qreal usrCntrListItem::AnmFrameAlpha() const { return this->windowOpacity(); } void usrCntrListItem::SetAnmFrameAlpha(qreal rAlpha) { this->setWindowOpacity(rAlpha); this->update(); } ## Header Q_OBJECT Q_PROPERTY(qreal AnmFrameAlpha READ AnmFrameAlpha WRITE SetAnmFrameAlpha) public: qreal AnmFrameAlpha() const; public slots: void SetAnmFrameAlpha(qreal rAlpha);
@IknowQT said in An error occurs when using animation effects.:
auto anim = new QPropertyAnimation(this->ui.frame, "AnmFrameAlpha", this);
This can't work: AnmFrameAlpha is a property of your usrCntrListItem class, not frame.
Should be:auto anim = new QPropertyAnimation(this, "AnmFrameAlpha", this);
-
@IknowQT said in An error occurs when using animation effects.:
auto anim = new QPropertyAnimation(this->ui.frame, "AnmFrameAlpha", this);
This can't work: AnmFrameAlpha is a property of your usrCntrListItem class, not frame.
Should be:auto anim = new QPropertyAnimation(this, "AnmFrameAlpha", this);
-
@IknowQT said in An error occurs when using animation effects.:
Does this mean that the custom class that inherits Qframe class should apply it?
Yes, because this property is a property of that custom class. There is no such property in QFrame, so how should it work?