aboutsummaryrefslogtreecommitdiffstats
path: root/src/labs/animation/qquickboundaryrule.cpp
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2021-08-27 10:39:20 +0200
committerFabian Kosmale <fabian.kosmale@qt.io>2021-09-24 11:32:23 +0200
commitedb5a06d1556dcf5ff044a40fbcf5247abe43853 (patch)
tree6c0a6c29b287b074ee1c5f4abd267fdee66eaf2c /src/labs/animation/qquickboundaryrule.cpp
parent08ee029ed88c89623a7ba38f44ea51f1b9206f0f (diff)
QQuickBoundaryRule: Port from finalize callback to QQmlParserStatus
QQuickBoundaryRule only uses the finalize callback to set a flag when the component is actually completed. This can be easily done with the public QQmlParserStatus instead. Besides being clearer thanks to using a documented approach, this should also slightly improve performance as it avoids unnecessary work with the meta-object system. Task-number: QTBUG-96054 Change-Id: I2a4c8b3974f42aad5a47acb2c133aca035773873 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Diffstat (limited to 'src/labs/animation/qquickboundaryrule.cpp')
-rw-r--r--src/labs/animation/qquickboundaryrule.cpp27
1 files changed, 13 insertions, 14 deletions
diff --git a/src/labs/animation/qquickboundaryrule.cpp b/src/labs/animation/qquickboundaryrule.cpp
index 61e5d007d5..7573a3d2f8 100644
--- a/src/labs/animation/qquickboundaryrule.cpp
+++ b/src/labs/animation/qquickboundaryrule.cpp
@@ -74,7 +74,7 @@ public:
int returnDuration = 100;
QQuickBoundaryRule::OvershootFilter overshootFilter = QQuickBoundaryRule::OvershootFilter::None;
bool enabled = true;
- bool finalized = false;
+ bool completed = false;
qreal easedOvershoot(qreal overshootingValue);
void resetOvershoot();
@@ -467,6 +467,17 @@ void QQuickBoundaryRule::setReturnDuration(int duration)
emit returnDurationChanged();
}
+void QQuickBoundaryRule::classBegin()
+{
+
+}
+
+void QQuickBoundaryRule::componentComplete()
+{
+ Q_D(QQuickBoundaryRule);
+ d->completed = true;
+}
+
void QQuickBoundaryRule::write(const QVariant &value)
{
bool conversionOk = false;
@@ -476,7 +487,7 @@ void QQuickBoundaryRule::write(const QVariant &value)
return;
}
Q_D(QQuickBoundaryRule);
- bool bypass = !d->enabled || !d->finalized || QQmlEnginePrivate::designerMode();
+ bool bypass = !d->enabled || !d->completed || QQmlEnginePrivate::designerMode();
if (bypass) {
QQmlPropertyPrivate::write(d->property, value,
QQmlPropertyData::BypassInterceptor | QQmlPropertyData::DontRemoveBinding);
@@ -492,18 +503,6 @@ void QQuickBoundaryRule::setTarget(const QQmlProperty &property)
{
Q_D(QQuickBoundaryRule);
d->property = property;
-
- QQmlEnginePrivate *engPriv = QQmlEnginePrivate::get(qmlEngine(this));
- static int finalizedIdx = -1;
- if (finalizedIdx < 0)
- finalizedIdx = metaObject()->indexOfSlot("componentFinalized()");
- engPriv->registerFinalizeCallback(this, finalizedIdx);
-}
-
-void QQuickBoundaryRule::componentFinalized()
-{
- Q_D(QQuickBoundaryRule);
- d->finalized = true;
}
/*!