summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/kernel/qmetaobject.cpp15
-rw-r--r--src/corelib/kernel/qmetaobject.h1
2 files changed, 13 insertions, 3 deletions
diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp
index bdd2af1a2e..650ea60617 100644
--- a/src/corelib/kernel/qmetaobject.cpp
+++ b/src/corelib/kernel/qmetaobject.cpp
@@ -1031,8 +1031,8 @@ int QMetaObject::indexOfProperty(const char *name) const
while (m) {
const QMetaObjectPrivate *d = priv(m->d.data);
for (int i = 0; i < d->propertyCount; ++i) {
- const QMetaProperty p(m, i);
- const char *prop = rawStringData(m, p.data.name());
+ const QMetaProperty::Data data = QMetaProperty::getMetaPropertyData(m, i);
+ const char *prop = rawStringData(m, data.name());
if (name[0] == prop[0] && strcmp(name + 1, prop + 1) == 0) {
i += m->propertyOffset();
return i;
@@ -3104,7 +3104,7 @@ int QMetaProperty::registerPropertyType() const
QMetaProperty::QMetaProperty(const QMetaObject *mobj, int index)
: mobj(mobj),
- data({ mobj->d.data + priv(mobj->d.data)->propertyData + index * Data::Size })
+ data(getMetaPropertyData(mobj, index))
{
Q_ASSERT(index >= 0 && index < priv(mobj->d.data)->propertyCount);
@@ -3142,6 +3142,15 @@ QMetaProperty::QMetaProperty(const QMetaObject *mobj, int index)
}
/*!
+ \internal
+ Constructs the \c QMetaProperty::Data for the \a index th property of \a mobj
+ */
+QMetaProperty::Data QMetaProperty::getMetaPropertyData(const QMetaObject *mobj, int index)
+{
+ return { mobj->d.data + priv(mobj->d.data)->propertyData + index * Data::Size };
+}
+
+/*!
Returns the enumerator if this property's type is an enumerator
type; otherwise the returned value is undefined.
diff --git a/src/corelib/kernel/qmetaobject.h b/src/corelib/kernel/qmetaobject.h
index dd4619dc03..1e9a0097fb 100644
--- a/src/corelib/kernel/qmetaobject.h
+++ b/src/corelib/kernel/qmetaobject.h
@@ -348,6 +348,7 @@ private:
};
QMetaProperty(const QMetaObject *mobj, int index);
+ static Data getMetaPropertyData(const QMetaObject *mobj, int index);
const QMetaObject *mobj;
Data data;