aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/util/qquickstategroup.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2023-09-22 21:28:21 +0200
committerUlf Hermann <ulf.hermann@qt.io>2023-09-26 20:46:38 +0200
commit94ca4ad6d55fae3627df7c8e44e58cdf2dc9bb28 (patch)
treecd661368f381d567af80763d04f16b3a9d61f173 /src/quick/util/qquickstategroup.cpp
parent46d77f02e361e59df94ac1e409e779218b4be41f (diff)
QQuickStateGroup: Don't needlessly create QQmlProperty
That is more expensive than simply resolving the property index. Change-Id: I9f821cf14baf38b7ce9d444f20cfa0f4c49df715 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/quick/util/qquickstategroup.cpp')
-rw-r--r--src/quick/util/qquickstategroup.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/quick/util/qquickstategroup.cpp b/src/quick/util/qquickstategroup.cpp
index 481a49b319..737ec9731e 100644
--- a/src/quick/util/qquickstategroup.cpp
+++ b/src/quick/util/qquickstategroup.cpp
@@ -345,8 +345,8 @@ bool QQuickStateGroupPrivate::updateAutoState()
if (state->isWhenKnown()) {
if (state->isNamed()) {
bool whenValue = state->when();
- const QQmlProperty whenProp(state, u"when"_s);
- const auto potentialWhenBinding = QQmlAnyBinding::ofProperty(whenProp);
+ const QQmlPropertyIndex whenIndex(state->metaObject()->indexOfProperty("when"));
+ const auto potentialWhenBinding = QQmlAnyBinding::ofProperty(state, whenIndex);
Q_ASSERT(!potentialWhenBinding.isUntypedPropertyBinding());
// if there is a binding, the value in when might not be up-to-date at this point