aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorUlf Hermann <[email protected]>2022-03-10 12:09:00 +0100
committerUlf Hermann <[email protected]>2022-03-14 16:44:35 +0100
commit9de2b11a7033a1969156277bafa848b5c178baa1 (patch)
treee9d349e5165350b50065663e3b9efadd94738cb8 /src
parente5246cafffb93f69a49c133210390c253fcb71f2 (diff)
Make most QQmlPropertyData const
You really should not mess with that after creating the property cache. Change-Id: I070200772475bb67f539dbbd85a298020b14ca79 Reviewed-by: Fabian Kosmale <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp2
-rw-r--r--src/qml/jsruntime/qv4executablecompilationunit_p.h2
-rw-r--r--src/qml/jsruntime/qv4lookup_p.h6
-rw-r--r--src/qml/jsruntime/qv4qmlcontext.cpp4
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper.cpp24
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper_p.h13
-rw-r--r--src/qml/qml/qqml.cpp2
-rw-r--r--src/qml/qml/qqmlbinding.cpp20
-rw-r--r--src/qml/qml/qqmlbinding_p.h2
-rw-r--r--src/qml/qml/qqmlcomponent.cpp2
-rw-r--r--src/qml/qml/qqmlcontext.cpp2
-rw-r--r--src/qml/qml/qqmllist.cpp2
-rw-r--r--src/qml/qml/qqmlmetatypedata.cpp4
-rw-r--r--src/qml/qml/qqmlobjectcreator.cpp18
-rw-r--r--src/qml/qml/qqmlobjectcreator_p.h2
-rw-r--r--src/qml/qml/qqmlproperty.cpp14
-rw-r--r--src/qml/qml/qqmlpropertybinding.cpp4
-rw-r--r--src/qml/qml/qqmlpropertycache.cpp54
-rw-r--r--src/qml/qml/qqmlpropertycache_p.h46
-rw-r--r--src/qml/qml/qqmlpropertycachecreator_p.h14
-rw-r--r--src/qml/qml/qqmlpropertyresolver.cpp8
-rw-r--r--src/qml/qml/qqmlpropertyresolver_p.h6
-rw-r--r--src/qml/qml/qqmlpropertyvalidator.cpp8
-rw-r--r--src/qml/qml/qqmlpropertyvalidator_p.h4
-rw-r--r--src/qml/qml/qqmltypecompiler.cpp26
-rw-r--r--src/qml/qml/qqmltypewrapper.cpp2
-rw-r--r--src/qml/types/qqmlconnections.cpp2
-rw-r--r--src/quick/items/qquickshadereffect.cpp2
28 files changed, 146 insertions, 149 deletions
diff --git a/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp b/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp
index cadee73b5a..e02e975736 100644
--- a/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp
+++ b/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp
@@ -782,7 +782,7 @@ bool QQmlEngineDebugServiceImpl::setMethodBody(int objectId, const QString &meth
QQmlRefPointer<QQmlContextData> contextData = QQmlContextData::get(context);
QQmlPropertyData dummy;
- QQmlPropertyData *prop = QQmlPropertyCache::property(object, method, contextData, &dummy);
+ const QQmlPropertyData *prop = QQmlPropertyCache::property(object, method, contextData, &dummy);
if (!prop || !prop->isVMEFunction())
return false;
diff --git a/src/qml/jsruntime/qv4executablecompilationunit_p.h b/src/qml/jsruntime/qv4executablecompilationunit_p.h
index 5c73b40121..673a181eec 100644
--- a/src/qml/jsruntime/qv4executablecompilationunit_p.h
+++ b/src/qml/jsruntime/qv4executablecompilationunit_p.h
@@ -89,7 +89,7 @@ struct InlineComponentData {
namespace QV4 {
// index is per-object binding index
-typedef QVector<QQmlPropertyData*> BindingPropertyData;
+typedef QVector<const QQmlPropertyData *> BindingPropertyData;
class CompilationUnitMapper;
class ResolvedTypeReference;
diff --git a/src/qml/jsruntime/qv4lookup_p.h b/src/qml/jsruntime/qv4lookup_p.h
index 7e5c15ba13..09e8c4e2d2 100644
--- a/src/qml/jsruntime/qv4lookup_p.h
+++ b/src/qml/jsruntime/qv4lookup_p.h
@@ -253,7 +253,7 @@ Q_STATIC_ASSERT(std::is_standard_layout<Lookup>::value);
Q_STATIC_ASSERT(offsetof(Lookup, getter) == 0);
inline void setupQObjectLookup(
- Lookup *lookup, const QQmlData *ddata, QQmlPropertyData *propertyData)
+ Lookup *lookup, const QQmlData *ddata, const QQmlPropertyData *propertyData)
{
lookup->releasePropertyCache();
Q_ASSERT(!ddata->propertyCache.isNull());
@@ -263,7 +263,7 @@ inline void setupQObjectLookup(
}
inline void setupQObjectLookup(
- Lookup *lookup, const QQmlData *ddata, QQmlPropertyData *propertyData,
+ Lookup *lookup, const QQmlData *ddata, const QQmlPropertyData *propertyData,
const Object *self)
{
lookup->qobjectLookup.ic = self->internalClass();
@@ -272,7 +272,7 @@ inline void setupQObjectLookup(
inline void setupQObjectLookup(
- Lookup *lookup, const QQmlData *ddata, QQmlPropertyData *propertyData,
+ Lookup *lookup, const QQmlData *ddata, const QQmlPropertyData *propertyData,
const Object *self, const Object *qmlType)
{
lookup->qobjectLookup.qmlTypeIc = qmlType->internalClass();
diff --git a/src/qml/jsruntime/qv4qmlcontext.cpp b/src/qml/jsruntime/qv4qmlcontext.cpp
index f7a5f897c8..2bd06752e1 100644
--- a/src/qml/jsruntime/qv4qmlcontext.cpp
+++ b/src/qml/jsruntime/qv4qmlcontext.cpp
@@ -296,7 +296,7 @@ ReturnedValue QQmlContextWrapper::getPropertyAndBase(const QQmlContextWrapper *r
if (scopeObject) {
bool hasProp = false;
- QQmlPropertyData *propertyData = nullptr;
+ const QQmlPropertyData *propertyData = nullptr;
QV4::ScopedValue result(scope, QV4::QObjectWrapper::getQmlProperty(v4, context, scopeObject,
name, QV4::QObjectWrapper::CheckRevision, &hasProp, &propertyData));
if (hasProp) {
@@ -323,7 +323,7 @@ ReturnedValue QQmlContextWrapper::getPropertyAndBase(const QQmlContextWrapper *r
// Search context object
if (QObject *contextObject = context->contextObject()) {
bool hasProp = false;
- QQmlPropertyData *propertyData = nullptr;
+ const QQmlPropertyData *propertyData = nullptr;
result = QV4::QObjectWrapper::getQmlProperty(v4, context, contextObject,
name, QV4::QObjectWrapper::CheckRevision,
&hasProp, &propertyData);
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp
index 596d65b47f..5d29cab79b 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper.cpp
+++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp
@@ -233,21 +233,21 @@ void QObjectWrapper::initializeBindings(ExecutionEngine *engine)
engine->functionPrototype()->defineDefaultProperty(QStringLiteral("disconnect"), method_disconnect);
}
-QQmlPropertyData *QObjectWrapper::findProperty(
+const QQmlPropertyData *QObjectWrapper::findProperty(
const QQmlRefPointer<QQmlContextData> &qmlContext, String *name,
RevisionMode revisionMode, QQmlPropertyData *local) const
{
return findProperty(d()->object(), qmlContext, name, revisionMode, local);
}
-QQmlPropertyData *QObjectWrapper::findProperty(
+const QQmlPropertyData *QObjectWrapper::findProperty(
QObject *o, const QQmlRefPointer<QQmlContextData> &qmlContext,
String *name, RevisionMode revisionMode, QQmlPropertyData *local)
{
Q_UNUSED(revisionMode);
QQmlData *ddata = QQmlData::get(o, false);
- QQmlPropertyData *result = nullptr;
+ const QQmlPropertyData *result = nullptr;
if (ddata && ddata->propertyCache)
result = ddata->propertyCache->property(name, o, qmlContext);
else
@@ -357,7 +357,7 @@ ReturnedValue QObjectWrapper::getQmlProperty(
return *methodValue;
QQmlPropertyData local;
- QQmlPropertyData *result = findProperty(qmlContext, name, revisionMode, &local);
+ const QQmlPropertyData *result = findProperty(qmlContext, name, revisionMode, &local);
if (!result) {
// Check for attached properties
@@ -387,7 +387,7 @@ ReturnedValue QObjectWrapper::getQmlProperty(
ReturnedValue QObjectWrapper::getQmlProperty(
ExecutionEngine *engine, const QQmlRefPointer<QQmlContextData> &qmlContext,
QObject *object, String *name, QObjectWrapper::RevisionMode revisionMode, bool *hasProperty,
- QQmlPropertyData **property)
+ const QQmlPropertyData **property)
{
if (QQmlData::wasDeleted(object)) {
if (hasProperty)
@@ -400,7 +400,7 @@ ReturnedValue QObjectWrapper::getQmlProperty(
QQmlData *ddata = QQmlData::get(object, false);
QQmlPropertyData local;
- QQmlPropertyData *result = findProperty(object, qmlContext, name, revisionMode, &local);
+ const QQmlPropertyData *result = findProperty(object, qmlContext, name, revisionMode, &local);
if (result) {
if (revisionMode == QObjectWrapper::CheckRevision && result->hasRevision()) {
@@ -455,7 +455,7 @@ bool QObjectWrapper::setQmlProperty(
return false;
QQmlPropertyData local;
- QQmlPropertyData *result = QQmlPropertyCache::property(object, name, qmlContext, &local);
+ const QQmlPropertyData *result = QQmlPropertyCache::property(object, name, qmlContext, &local);
if (!result)
return false;
@@ -491,7 +491,8 @@ void QObjectWrapper::setProperty(
const QQmlPropertyCache *targetCache
= QQmlData::get(targetObject)->propertyCache.data();
Q_ASSERT(targetCache);
- QQmlPropertyData *targetProperty = targetCache->property(targetIndex.coreIndex());
+ const QQmlPropertyData *targetProperty
+ = targetCache->property(targetIndex.coreIndex());
object = targetObject;
property = targetProperty;
return targetProperty->isVarProperty() || targetProperty->propType() == QMetaType::fromType<QJSValue>();
@@ -737,7 +738,7 @@ void QObjectWrapper::setProperty(ExecutionEngine *engine, QObject *object, int p
return;
Q_ASSERT(ddata->propertyCache);
- QQmlPropertyData *property = ddata->propertyCache->property(propertyIndex);
+ const QQmlPropertyData *property = ddata->propertyCache->property(propertyIndex);
Q_ASSERT(property); // We resolved this property earlier, so it better exist!
return setProperty(engine, object, property, value);
}
@@ -940,10 +941,11 @@ ReturnedValue QObjectWrapper::virtualResolveLookupGetter(const Object *object, E
QQmlData *ddata = QQmlData::get(qobj, false);
if (!ddata || !ddata->propertyCache) {
QQmlPropertyData local;
- QQmlPropertyData *property = QQmlPropertyCache::property(qobj, name, qmlContext, &local);
+ const QQmlPropertyData *property = QQmlPropertyCache::property(
+ qobj, name, qmlContext, &local);
return property ? getProperty(engine, qobj, property) : Encode::undefined();
}
- QQmlPropertyData *property = ddata->propertyCache->property(name.getPointer(), qobj, qmlContext);
+ const QQmlPropertyData *property = ddata->propertyCache->property(name.getPointer(), qobj, qmlContext);
if (!property) {
// Check for attached properties
diff --git a/src/qml/jsruntime/qv4qobjectwrapper_p.h b/src/qml/jsruntime/qv4qobjectwrapper_p.h
index 85f7502105..a4b3056276 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper_p.h
+++ b/src/qml/jsruntime/qv4qobjectwrapper_p.h
@@ -110,7 +110,7 @@ DECLARE_HEAP_OBJECT(QObjectMethod, FunctionObject) {
void init(QV4::ExecutionContext *scope);
void destroy()
{
- if (methods != reinterpret_cast<QQmlPropertyData *>(&_singleMethod))
+ if (methods != reinterpret_cast<const QQmlPropertyData *>(&_singleMethod))
delete[] methods;
qObj.destroy();
FunctionObject::destroy();
@@ -167,10 +167,9 @@ struct Q_QML_EXPORT QObjectWrapper : public Object
RevisionMode revisionMode, bool *hasProperty = nullptr,
bool includeImports = false) const;
\
- static ReturnedValue getQmlProperty(
- ExecutionEngine *engine, const QQmlRefPointer<QQmlContextData> &qmlContext,
+ static ReturnedValue getQmlProperty(ExecutionEngine *engine, const QQmlRefPointer<QQmlContextData> &qmlContext,
QObject *object, String *name, RevisionMode revisionMode, bool *hasProperty = nullptr,
- QQmlPropertyData **property = nullptr);
+ const QQmlPropertyData **property = nullptr);
static bool setQmlProperty(
ExecutionEngine *engine, const QQmlRefPointer<QQmlContextData> &qmlContext,
@@ -202,12 +201,10 @@ protected:
static bool virtualIsEqualTo(Managed *that, Managed *o);
static ReturnedValue create(ExecutionEngine *engine, QObject *object);
- static QQmlPropertyData *findProperty(
- QObject *o, const QQmlRefPointer<QQmlContextData> &qmlContext,
+ static const QQmlPropertyData *findProperty(QObject *o, const QQmlRefPointer<QQmlContextData> &qmlContext,
String *name, RevisionMode revisionMode, QQmlPropertyData *local);
- QQmlPropertyData *findProperty(
- const QQmlRefPointer<QQmlContextData> &qmlContext,
+ const QQmlPropertyData *findProperty(const QQmlRefPointer<QQmlContextData> &qmlContext,
String *name, RevisionMode revisionMode, QQmlPropertyData *local) const;
static ReturnedValue virtualGet(const Managed *m, PropertyKey id, const Value *receiver, bool *hasProperty);
diff --git a/src/qml/qml/qqml.cpp b/src/qml/qml/qqml.cpp
index 43cb973691..c6f27c0a06 100644
--- a/src/qml/qml/qqml.cpp
+++ b/src/qml/qml/qqml.cpp
@@ -956,7 +956,7 @@ static ObjectLookupResult initObjectLookup(
if (ddata->isQueuedForDeletion)
return ObjectLookupResult::Failure;
- QQmlPropertyData *property;
+ const QQmlPropertyData *property;
if (!ddata->propertyCache) {
property = QQmlPropertyCache::property(object, name, aotContext->qmlContext, nullptr);
} else {
diff --git a/src/qml/qml/qqmlbinding.cpp b/src/qml/qml/qqmlbinding.cpp
index 6bb370eab7..820b441223 100644
--- a/src/qml/qml/qqmlbinding.cpp
+++ b/src/qml/qml/qqmlbinding.cpp
@@ -175,7 +175,7 @@ void QQmlBinding::update(QQmlPropertyData::WriteFlags flags)
// Check for a binding update loop
if (Q_UNLIKELY(updatingFlag())) {
- QQmlPropertyData *d = nullptr;
+ const QQmlPropertyData *d = nullptr;
QQmlPropertyData vtd;
getPropertyData(&d, &vtd);
Q_ASSERT(d);
@@ -236,7 +236,7 @@ protected:
QQmlPropertyData::WriteFlags flags, QV4::Scope &) override final
{
Q_ASSERT(!m_targetIndex.hasValueTypeIndex());
- QQmlPropertyData *pd = nullptr;
+ const QQmlPropertyData *pd = nullptr;
getPropertyData(&pd, nullptr);
QQmlBinding *thisPtr = this;
pd->writeProperty(m_target.data(), &thisPtr, flags);
@@ -314,7 +314,7 @@ protected:
Q_ALWAYS_INLINE bool write(void *result, QMetaType type, bool isUndefined,
QQmlPropertyData::WriteFlags flags) override final
{
- QQmlPropertyData *pd;
+ const QQmlPropertyData *pd;
QQmlPropertyData vpd;
getPropertyData(&pd, &vpd);
Q_ASSERT(pd);
@@ -338,7 +338,7 @@ protected:
{
Q_ASSERT(targetObject());
- QQmlPropertyData *pd;
+ const QQmlPropertyData *pd;
QQmlPropertyData vpd;
getPropertyData(&pd, &vpd);
Q_ASSERT(pd);
@@ -425,7 +425,7 @@ public:
Q_ASSERT(targetObject());
- QQmlPropertyData *pd;
+ const QQmlPropertyData *pd;
QQmlPropertyData vpd;
getPropertyData(&pd, &vpd);
Q_ASSERT(pd);
@@ -719,7 +719,7 @@ bool QQmlBinding::setTarget(QObject *object, int coreIndex, bool coreIsAlias, in
m_targetIndex = QQmlPropertyIndex();
return false;
}
- QQmlPropertyData *propertyData = data->propertyCache->property(coreIndex);
+ const QQmlPropertyData *propertyData = data->propertyCache->property(coreIndex);
Q_ASSERT(propertyData);
m_target = object;
@@ -735,7 +735,7 @@ bool QQmlBinding::setTarget(QObject *object, int coreIndex, bool coreIsAlias, in
return true;
}
-void QQmlBinding::getPropertyData(QQmlPropertyData **propertyData, QQmlPropertyData *valueTypeData) const
+void QQmlBinding::getPropertyData(const QQmlPropertyData **propertyData, QQmlPropertyData *valueTypeData) const
{
Q_ASSERT(propertyData);
@@ -811,7 +811,7 @@ protected:
Q_ALWAYS_INLINE bool write(void *result, QMetaType type, bool isUndefined,
QQmlPropertyData::WriteFlags flags) override final
{
- QQmlPropertyData *pd;
+ const QQmlPropertyData *pd;
QQmlPropertyData vtpd;
getPropertyData(&pd, &vtpd);
if (Q_UNLIKELY(isUndefined || vtpd.isValid()))
@@ -850,7 +850,7 @@ protected:
Q_ALWAYS_INLINE bool write(const QV4::Value &result, bool isUndefined,
QQmlPropertyData::WriteFlags flags) override final
{
- QQmlPropertyData *pd;
+ const QQmlPropertyData *pd;
QQmlPropertyData vtpd;
getPropertyData(&pd, &vtpd);
if (Q_UNLIKELY(isUndefined || vtpd.isValid()))
@@ -890,7 +890,7 @@ private:
using QQmlBinding::slowWrite;
template<typename SlowWrite>
- bool compareAndSet(const QQmlMetaObject &resultMo, QObject *resultObject, QQmlPropertyData *pd,
+ bool compareAndSet(const QQmlMetaObject &resultMo, QObject *resultObject, const QQmlPropertyData *pd,
QQmlPropertyData::WriteFlags flags, const SlowWrite &slowWrite) const
{
if (QQmlMetaObject::canConvert(resultMo, targetMetaObject)) {
diff --git a/src/qml/qml/qqmlbinding_p.h b/src/qml/qml/qqmlbinding_p.h
index f0a3282add..b9b7cdeab3 100644
--- a/src/qml/qml/qqmlbinding_p.h
+++ b/src/qml/qml/qqmlbinding_p.h
@@ -140,7 +140,7 @@ protected:
virtual void doUpdate(const DeleteWatcher &watcher,
QQmlPropertyData::WriteFlags flags, QV4::Scope &scope) = 0;
- void getPropertyData(QQmlPropertyData **propertyData, QQmlPropertyData *valueTypeData) const;
+ void getPropertyData(const QQmlPropertyData **propertyData, QQmlPropertyData *valueTypeData) const;
int getPropertyType() const;
bool slowWrite(const QQmlPropertyData &core, const QQmlPropertyData &valueTypeData,
diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp
index 5b383714b4..76a968fe4d 100644
--- a/src/qml/qml/qqmlcomponent.cpp
+++ b/src/qml/qml/qqmlcomponent.cpp
@@ -1077,7 +1077,7 @@ QQmlProperty QQmlComponentPrivate::removePropertyFromRequired(
auto privProp = QQmlPropertyPrivate::get(prop);
if (prop.isValid()) {
// resolve outstanding required properties
- auto targetProp = &privProp->core;
+ const QQmlPropertyData *targetProp = &privProp->core;
if (targetProp->isAlias()) {
auto target = createdComponent;
QQmlPropertyIndex originalIndex(targetProp->coreIndex());
diff --git a/src/qml/qml/qqmlcontext.cpp b/src/qml/qml/qqmlcontext.cpp
index 6503ac07c7..7c788863cf 100644
--- a/src/qml/qml/qqmlcontext.cpp
+++ b/src/qml/qml/qqmlcontext.cpp
@@ -358,7 +358,7 @@ static bool readObjectProperty(
QVariant *target)
{
QQmlPropertyData local;
- if (QQmlPropertyData *property = QQmlPropertyCache::property(object, name, data, &local)) {
+ if (const QQmlPropertyData *property = QQmlPropertyCache::property(object, name, data, &local)) {
*target = object->metaObject()->property(property->coreIndex()).read(object);
return true;
}
diff --git a/src/qml/qml/qqmllist.cpp b/src/qml/qml/qqmllist.cpp
index 9f72bc71b2..961d265df2 100644
--- a/src/qml/qml/qqmllist.cpp
+++ b/src/qml/qml/qqmllist.cpp
@@ -161,7 +161,7 @@ QQmlListReference::QQmlListReference(QObject *object, const char *property)
if (!object || !property) return;
QQmlPropertyData local;
- QQmlPropertyData *data =
+ const QQmlPropertyData *data =
QQmlPropertyCache::property(object, QLatin1String(property), nullptr, &local);
if (!data || !data->isQList()) return;
diff --git a/src/qml/qml/qqmlmetatypedata.cpp b/src/qml/qml/qqmlmetatypedata.cpp
index 4e5400dc8d..aafe4490fb 100644
--- a/src/qml/qml/qqmlmetatypedata.cpp
+++ b/src/qml/qml/qqmlmetatypedata.cpp
@@ -246,12 +246,12 @@ QQmlRefPointer<QQmlPropertyCache> QQmlMetaTypeData::propertyCache(
!overloadError && iter != raw->stringCache.end();
++iter) {
- QQmlPropertyData *d = *iter;
+ const QQmlPropertyData *d = *iter;
if (raw->isAllowedInRevision(d))
continue; // Not excluded - no problems
// check that a regular "name" overload isn't happening
- QQmlPropertyData *current = d;
+ const QQmlPropertyData *current = d;
while (!overloadError && current) {
current = d->overrideData(current);
if (current && raw->isAllowedInRevision(current))
diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp
index 77e6b6a061..37a80c11cd 100644
--- a/src/qml/qml/qqmlobjectcreator.cpp
+++ b/src/qml/qml/qqmlobjectcreator.cpp
@@ -647,11 +647,11 @@ void QQmlObjectCreator::setupBindings(BindingSetupFlags mode)
if (qmlTypeForObject(_bindingTarget).isValid()) {
quint32 bindingSkipList = 0;
- QQmlPropertyData *defaultProperty = _compiledObject->indexOfDefaultPropertyOrAlias != -1 ? _propertyCache->parent()->defaultProperty() : _propertyCache->defaultProperty();
+ const QQmlPropertyData *defaultProperty = _compiledObject->indexOfDefaultPropertyOrAlias != -1 ? _propertyCache->parent()->defaultProperty() : _propertyCache->defaultProperty();
const QV4::CompiledData::Binding *binding = _compiledObject->bindingTable();
for (quint32 i = 0; i < _compiledObject->nBindings; ++i, ++binding) {
- QQmlPropertyData *property = binding->propertyNameIndex != 0
+ const QQmlPropertyData *property = binding->propertyNameIndex != 0
? _propertyCache->property(stringAt(binding->propertyNameIndex),
_qobject, context)
: defaultProperty;
@@ -668,9 +668,9 @@ void QQmlObjectCreator::setupBindings(BindingSetupFlags mode)
const QV4::CompiledData::Binding *binding = _compiledObject->bindingTable();
for (quint32 i = 0; i < _compiledObject->nBindings; ++i, ++binding) {
- QQmlPropertyData *const property = propertyData.at(i);
+ const QQmlPropertyData *const property = propertyData.at(i);
if (property) {
- QQmlPropertyData* targetProperty = property;
+ const QQmlPropertyData *targetProperty = property;
if (targetProperty->isAlias()) {
// follow alias
QQmlPropertyIndex originalIndex(targetProperty->coreIndex(), _valueTypeProperty ? _valueTypeProperty->coreIndex() : -1);
@@ -1128,7 +1128,7 @@ void QQmlObjectCreator::setupFunctions()
QV4::Function *runtimeFunction = compilationUnit->runtimeFunctions[*functionIdx];
const QString name = runtimeFunction->name()->toQString();
- QQmlPropertyData *property = _propertyCache->property(name, _qobject, context);
+ const QQmlPropertyData *property = _propertyCache->property(name, _qobject, context);
if (!property->isVMEFunction())
continue;
@@ -1535,7 +1535,7 @@ bool QQmlObjectCreator::populateInstance(int index, QObject *instance, QObject *
for (int propertyIndex = 0; propertyIndex != _compiledObject->propertyCount(); ++propertyIndex) {
const QV4::CompiledData::Property* property = _compiledObject->propertiesBegin() + propertyIndex;
- QQmlPropertyData *propertyData = _propertyCache->property(_propertyCache->propertyOffset() + propertyIndex);
+ const QQmlPropertyData *propertyData = _propertyCache->property(_propertyCache->propertyOffset() + propertyIndex);
// only compute stringAt if there's a chance for the lookup to succeed
auto postHocIt = postHocRequired.isEmpty() ? postHocRequired.end() : postHocRequired.find(stringAt(property->nameIndex));
if (!property->isRequired && postHocRequired.end() == postHocIt)
@@ -1584,7 +1584,7 @@ bool QQmlObjectCreator::populateInstance(int index, QObject *instance, QObject *
};
const auto [offset, count] = getPropertyCacheRange();
for (int i = offset; i < count; ++i) {
- QQmlPropertyData *propertyData = _propertyCache->maybeUnresolvedProperty(i);
+ const QQmlPropertyData *propertyData = _propertyCache->maybeUnresolvedProperty(i);
if (!propertyData)
continue;
// TODO: the property might be a group property (in which case we need
@@ -1621,7 +1621,7 @@ bool QQmlObjectCreator::populateInstance(int index, QObject *instance, QObject *
if (!postHocRequired.isEmpty()) {
// NB: go through [0, offset) range as [offset, count) is already done
for (int i = 0; i < offset; ++i) {
- QQmlPropertyData *propertyData = _propertyCache->maybeUnresolvedProperty(i);
+ const QQmlPropertyData *propertyData = _propertyCache->maybeUnresolvedProperty(i);
if (!propertyData)
continue;
QString name = propertyData->name(_qobject);
@@ -1662,7 +1662,7 @@ bool QQmlObjectCreator::populateInstance(int index, QObject *instance, QObject *
if (targetDData == nullptr || targetDData->propertyCache.isNull())
continue;
int coreIndex = QQmlPropertyIndex::fromEncoded(alias->encodedMetaPropertyIndex).coreIndex();
- QQmlPropertyData *const targetProperty = targetDData->propertyCache->property(coreIndex);
+ const QQmlPropertyData *const targetProperty = targetDData->propertyCache->property(coreIndex);
if (!targetProperty)
continue;
auto it = sharedState->requiredProperties.find(targetProperty);
diff --git a/src/qml/qml/qqmlobjectcreator_p.h b/src/qml/qml/qqmlobjectcreator_p.h
index 1e1557c55b..bdecf563c2 100644
--- a/src/qml/qml/qqmlobjectcreator_p.h
+++ b/src/qml/qml/qqmlobjectcreator_p.h
@@ -89,7 +89,7 @@ struct RequiredPropertyInfo
QVector<AliasToRequiredInfo> aliasesToRequired;
};
-class RequiredProperties : public QHash<QQmlPropertyData*, RequiredPropertyInfo> {};
+class RequiredProperties : public QHash<const QQmlPropertyData *, RequiredPropertyInfo> {};
struct DeferredQPropertyBinding {
QObject *target = nullptr;
diff --git a/src/qml/qml/qqmlproperty.cpp b/src/qml/qml/qqmlproperty.cpp
index 7a49f53e9d..36adbf4075 100644
--- a/src/qml/qml/qqmlproperty.cpp
+++ b/src/qml/qml/qqmlproperty.cpp
@@ -330,7 +330,7 @@ void QQmlPropertyPrivate::initProperty(QObject *obj, const QString &name,
}
QQmlPropertyData local;
- QQmlPropertyData *property = currentObject
+ const QQmlPropertyData *property = currentObject
? QQmlPropertyCache::property(currentObject, pathName, context, &local)
: nullptr;
@@ -411,7 +411,7 @@ void QQmlPropertyPrivate::initProperty(QObject *obj, const QString &name,
const QString changed = QStringLiteral("Changed");
if (signalName.endsWith(changed)) {
const QStringView propName = signalName.first(signalName.length() - changed.length());
- QQmlPropertyData *d = ddata->propertyCache->property(propName, currentObject, context);
+ const QQmlPropertyData *d = ddata->propertyCache->property(propName, currentObject, context);
while (d && d->isFunction())
d = ddata->propertyCache->overrideData(d);
@@ -436,7 +436,7 @@ void QQmlPropertyPrivate::initProperty(QObject *obj, const QString &name,
if (ddata && ddata->propertyCache) {
// Try method
- QQmlPropertyData *d = ddata->propertyCache->property(
+ const QQmlPropertyData *d = ddata->propertyCache->property(
signalName, currentObject, context);
// ### Qt7: This code treats methods as signals. It should use d->isSignal().
@@ -459,7 +459,7 @@ void QQmlPropertyPrivate::initProperty(QObject *obj, const QString &name,
}
if (ddata && ddata->propertyCache) {
- QQmlPropertyData *property = ddata->propertyCache->property(
+ const QQmlPropertyData *property = ddata->propertyCache->property(
terminal, currentObject, context);
// Technically, we might find an override that is not a function.
@@ -965,7 +965,7 @@ void QQmlPropertyPrivate::findAliasTarget(QObject *object, QQmlPropertyIndex bin
int coreIndex = bindingIndex.coreIndex();
int valueTypeIndex = bindingIndex.valueTypeIndex();
- QQmlPropertyData *propertyData =
+ const QQmlPropertyData *propertyData =
data->propertyCache?data->propertyCache->property(coreIndex):nullptr;
if (propertyData && propertyData->isAlias()) {
QQmlVMEMetaObject *vme = QQmlVMEMetaObject::getForProperty(object, coreIndex);
@@ -1013,7 +1013,7 @@ void QQmlPropertyPrivate::setBinding(QQmlAbstractBinding *binding, BindingFlags
int coreIndex = index.coreIndex();
QQmlData *data = QQmlData::get(object, true);
if (data->propertyCache) {
- QQmlPropertyData *propertyData = data->propertyCache->property(coreIndex);
+ const QQmlPropertyData *propertyData = data->propertyCache->property(coreIndex);
Q_ASSERT(propertyData);
}
#endif
@@ -1856,7 +1856,7 @@ static inline void flush_vme_signal(const QObject *object, int index, bool index
{
QQmlData *data = QQmlData::get(object);
if (data && data->propertyCache) {
- QQmlPropertyData *property = indexInSignalRange ? data->propertyCache->signal(index)
+ const QQmlPropertyData *property = indexInSignalRange ? data->propertyCache->signal(index)
: data->propertyCache->method(index);
if (property && property->isVMESignal()) {
diff --git a/src/qml/qml/qqmlpropertybinding.cpp b/src/qml/qml/qqmlpropertybinding.cpp
index 876e5e01af..c1b3bb0d5d 100644
--- a/src/qml/qml/qqmlpropertybinding.cpp
+++ b/src/qml/qml/qqmlpropertybinding.cpp
@@ -225,7 +225,7 @@ static QtPrivate::QPropertyBindingData *bindingDataFromPropertyData(QUntypedProp
void QQmlPropertyBinding::handleUndefinedAssignment(QQmlEnginePrivate *ep, void *dataPtr)
{
- QQmlPropertyData *propertyData = nullptr;
+ const QQmlPropertyData *propertyData = nullptr;
QQmlPropertyData valueTypeData;
QQmlData *data = QQmlData::get(target(), false);
Q_ASSERT(data);
@@ -295,7 +295,7 @@ void QQmlPropertyBinding::handleUndefinedAssignment(QQmlEnginePrivate *ep, void
QString QQmlPropertyBinding::createBindingLoopErrorDescription()
{
- QQmlPropertyData *propertyData = nullptr;
+ const QQmlPropertyData *propertyData = nullptr;
QQmlPropertyData valueTypeData;
QQmlData *data = QQmlData::get(target(), false);
Q_ASSERT(data);
diff --git a/src/qml/qml/qqmlpropertycache.cpp b/src/qml/qml/qqmlpropertycache.cpp
index c881b84ee9..75f1838923 100644
--- a/src/qml/qml/qqmlpropertycache.cpp
+++ b/src/qml/qml/qqmlpropertycache.cpp
@@ -334,20 +334,20 @@ const QMetaObject *QQmlPropertyCache::createMetaObject() const
return _metaObject.metaObject();
}
-QQmlPropertyData *QQmlPropertyCache::maybeUnresolvedProperty(int index) const
+const QQmlPropertyData *QQmlPropertyCache::maybeUnresolvedProperty(int index) const
{
if (index < 0 || index >= propertyCount())
return nullptr;
- QQmlPropertyData *rv = nullptr;
+ const QQmlPropertyData *rv = nullptr;
if (index < propertyIndexCacheStart)
return _parent->maybeUnresolvedProperty(index);
else
- rv = const_cast<QQmlPropertyData *>(&propertyIndexCache.at(index - propertyIndexCacheStart));
+ rv = const_cast<const QQmlPropertyData *>(&propertyIndexCache.at(index - propertyIndexCacheStart));
return rv;
}
-QQmlPropertyData *QQmlPropertyCache::defaultProperty() const
+const QQmlPropertyData *QQmlPropertyCache::defaultProperty() const
{
return property(defaultPropertyName(), nullptr, nullptr);
}
@@ -636,7 +636,7 @@ void QQmlPropertyCache::invalidate(const QMetaObject *metaObject)
}
}
-QQmlPropertyData *QQmlPropertyCache::findProperty(
+const QQmlPropertyData *QQmlPropertyCache::findProperty(
StringCache::ConstIterator it, QObject *object,
const QQmlRefPointer<QQmlContextData> &context) const
{
@@ -658,7 +658,7 @@ inline bool contextHasNoExtensions(const QQmlRefPointer<QQmlContextData> &contex
return (!context->parent() || !context->parent()->imports());
}
-inline int maximumIndexForProperty(QQmlPropertyData *prop, const int methodCount, const int signalCount, const int propertyCount)
+inline int maximumIndexForProperty(const QQmlPropertyData *prop, const int methodCount, const int signalCount, const int propertyCount)
{
return prop->isFunction() ? methodCount
: prop->isSignalHandler() ? signalCount
@@ -667,14 +667,14 @@ inline int maximumIndexForProperty(QQmlPropertyData *prop, const int methodCount
}
-QQmlPropertyData *QQmlPropertyCache::findProperty(
+const QQmlPropertyData *QQmlPropertyCache::findProperty(
StringCache::ConstIterator it, const QQmlVMEMetaObject *vmemo,
const QQmlRefPointer<QQmlContextData> &context) const
{
StringCache::ConstIterator end = stringCache.end();
if (it != end) {
- QQmlPropertyData *result = it.value().second;
+ const QQmlPropertyData *result = it.value().second;
// If there exists a typed property (not a function or signal handler), of the
// right name available to the specified context, we need to return that
@@ -807,7 +807,7 @@ int QQmlPropertyCache::originalClone(const QObject *object, int index)
QQmlData *data = QQmlData::get(object);
if (data && data->propertyCache) {
const QQmlPropertyCache *cache = data->propertyCache.data();
- QQmlPropertyData *sig = cache->signal(index);
+ const QQmlPropertyData *sig = cache->signal(index);
while (sig && sig->isCloned()) {
--index;
sig = cache->signal(index);
@@ -894,7 +894,7 @@ static inline QByteArray qQmlPropertyCacheToString(const QV4::String *string)
}
template<typename T>
-QQmlPropertyData *
+const QQmlPropertyData *
qQmlPropertyCacheProperty(QObject *obj, T name, const QQmlRefPointer<QQmlContextData> &context,
QQmlPropertyData *local)
{
@@ -910,7 +910,7 @@ qQmlPropertyCacheProperty(QObject *obj, T name, const QQmlRefPointer<QQmlContext
ddata->propertyCache = std::move(newCache);
}
- QQmlPropertyData *rv = nullptr;
+ const QQmlPropertyData *rv = nullptr;
if (cache) {
rv = cache->property(name, obj, context);
@@ -923,21 +923,21 @@ qQmlPropertyCacheProperty(QObject *obj, T name, const QQmlRefPointer<QQmlContext
return rv;
}
-QQmlPropertyData *QQmlPropertyCache::property(
+const QQmlPropertyData *QQmlPropertyCache::property(
QObject *obj, const QV4::String *name, const QQmlRefPointer<QQmlContextData> &context,
QQmlPropertyData *local)
{
return qQmlPropertyCacheProperty<const QV4::String *>(obj, name, context, local);
}
-QQmlPropertyData *QQmlPropertyCache::property(
+const QQmlPropertyData *QQmlPropertyCache::property(
QObject *obj, QStringView name, const QQmlRefPointer<QQmlContextData> &context,
QQmlPropertyData *local)
{
return qQmlPropertyCacheProperty<const QStringView &>(obj, name, context, local);
}
-QQmlPropertyData *QQmlPropertyCache::property(
+const QQmlPropertyData *QQmlPropertyCache::property(
QObject *obj, const QLatin1String &name, const QQmlRefPointer<QQmlContextData> &context,
QQmlPropertyData *local)
{
@@ -963,15 +963,15 @@ const char *QQmlPropertyCache::className() const
void QQmlPropertyCache::toMetaObjectBuilder(QMetaObjectBuilder &builder) const
{
- struct Sort { static bool lt(const QPair<QString, QQmlPropertyData *> &lhs,
- const QPair<QString, QQmlPropertyData *> &rhs) {
+ struct Sort { static bool lt(const QPair<QString, const QQmlPropertyData *> &lhs,
+ const QPair<QString, const QQmlPropertyData *> &rhs) {
return lhs.second->coreIndex() < rhs.second->coreIndex();
} };
struct Insert { static void in(const QQmlPropertyCache *This,
- QList<QPair<QString, QQmlPropertyData *> > &properties,
- QList<QPair<QString, QQmlPropertyData *> > &methods,
- StringCache::ConstIterator iter, QQmlPropertyData *data) {
+ QList<QPair<QString, const QQmlPropertyData *> > &properties,
+ QList<QPair<QString, const QQmlPropertyData *> > &methods,
+ StringCache::ConstIterator iter, const QQmlPropertyData *data) {
if (data->isSignalHandler())
return;
@@ -979,7 +979,7 @@ void QQmlPropertyCache::toMetaObjectBuilder(QMetaObjectBuilder &builder) const
if (data->coreIndex() < This->methodIndexCacheStart)
return;
- QPair<QString, QQmlPropertyData *> entry = qMakePair((QString)iter.key(), data);
+ QPair<QString, const QQmlPropertyData *> entry = qMakePair((QString)iter.key(), data);
// Overrides can cause the entry to already exist
if (!methods.contains(entry)) methods.append(entry);
@@ -989,7 +989,7 @@ void QQmlPropertyCache::toMetaObjectBuilder(QMetaObjectBuilder &builder) const
if (data->coreIndex() < This->propertyIndexCacheStart)
return;
- QPair<QString, QQmlPropertyData *> entry = qMakePair((QString)iter.key(), data);
+ QPair<QString, const QQmlPropertyData *> entry = qMakePair((QString)iter.key(), data);
// Overrides can cause the entry to already exist
if (!properties.contains(entry)) properties.append(entry);
@@ -1001,8 +1001,8 @@ void QQmlPropertyCache::toMetaObjectBuilder(QMetaObjectBuilder &builder) const
builder.setClassName(_dynamicClassName);
- QList<QPair<QString, QQmlPropertyData *> > properties;
- QList<QPair<QString, QQmlPropertyData *> > methods;
+ QList<QPair<QString, const QQmlPropertyData *> > properties;
+ QList<QPair<QString, const QQmlPropertyData *> > methods;
for (StringCache::ConstIterator iter = stringCache.begin(), cend = stringCache.end(); iter != cend; ++iter)
Insert::in(this, properties, methods, iter, iter.value().second);
@@ -1014,7 +1014,7 @@ void QQmlPropertyCache::toMetaObjectBuilder(QMetaObjectBuilder &builder) const
std::sort(methods.begin(), methods.end(), Sort::lt);
for (int ii = 0; ii < properties.count(); ++ii) {
- QQmlPropertyData *data = properties.at(ii).second;
+ const QQmlPropertyData *data = properties.at(ii).second;
int notifierId = -1;
if (data->notifyIndex() != -1)
@@ -1032,7 +1032,7 @@ void QQmlPropertyCache::toMetaObjectBuilder(QMetaObjectBuilder &builder) const
}
for (int ii = 0; ii < methods.count(); ++ii) {
- QQmlPropertyData *data = methods.at(ii).second;
+ const QQmlPropertyData *data = methods.at(ii).second;
QByteArray returnType;
if (data->propType().isValid())
@@ -1081,7 +1081,7 @@ void QQmlPropertyCache::toMetaObjectBuilder(QMetaObjectBuilder &builder) const
}
if (!_defaultPropertyName.isEmpty()) {
- QQmlPropertyData *dp = property(_defaultPropertyName, nullptr, nullptr);
+ const QQmlPropertyData *dp = property(_defaultPropertyName, nullptr, nullptr);
if (dp && dp->coreIndex() >= propertyIndexCacheStart) {
Q_ASSERT(!dp->isFunction());
builder.addClassInfo("DefaultProperty", _defaultPropertyName.toUtf8());
@@ -1298,7 +1298,7 @@ QByteArray QQmlPropertyCache::checksum(QHash<quintptr, QByteArray> *checksums, b
*/
QList<QByteArray> QQmlPropertyCache::signalParameterNames(int index) const
{
- QQmlPropertyData *signalData = signal(index);
+ const QQmlPropertyData *signalData = signal(index);
if (signalData && signalData->hasArguments()) {
QQmlPropertyCacheMethodArguments *args = (QQmlPropertyCacheMethodArguments *)signalData->arguments();
if (args && args->names)
diff --git a/src/qml/qml/qqmlpropertycache_p.h b/src/qml/qml/qqmlpropertycache_p.h
index 1f52d9abba..904bc0e5b4 100644
--- a/src/qml/qml/qqmlpropertycache_p.h
+++ b/src/qml/qml/qqmlpropertycache_p.h
@@ -191,21 +191,21 @@ public:
const QMetaObject *firstCppMetaObject() const;
template<typename K>
- QQmlPropertyData *property(const K &key, QObject *object,
+ const QQmlPropertyData *property(const K &key, QObject *object,
const QQmlRefPointer<QQmlContextData> &context) const
{
return findProperty(stringCache.find(key), object, context);
}
- QQmlPropertyData *property(int) const;
- QQmlPropertyData *maybeUnresolvedProperty(int) const;
- QQmlPropertyData *method(int) const;
- QQmlPropertyData *signal(int index) const;
+ const QQmlPropertyData *property(int) const;
+ const QQmlPropertyData *maybeUnresolvedProperty(int) const;
+ const QQmlPropertyData *method(int) const;
+ const QQmlPropertyData *signal(int index) const;
QQmlEnumData *qmlEnum(int) const;
int methodIndexToSignalIndex(int) const;
QString defaultPropertyName() const;
- QQmlPropertyData *defaultProperty() const;
+ const QQmlPropertyData *defaultProperty() const;
// Return a reference here so that we don't have to addref/release all the time
inline const QQmlPropertyCache::ConstPtr &parent() const;
@@ -213,17 +213,15 @@ public:
// is used by the Qml Designer
void setParent(QQmlPropertyCache::ConstPtr newParent);
- inline QQmlPropertyData *overrideData(QQmlPropertyData *) const;
- inline bool isAllowedInRevision(QQmlPropertyData *) const;
+ inline const QQmlPropertyData *overrideData(const QQmlPropertyData *) const;
+ inline bool isAllowedInRevision(const QQmlPropertyData *) const;
- static QQmlPropertyData *property(
+ static const QQmlPropertyData *property(
QObject *, QStringView, const QQmlRefPointer<QQmlContextData> &,
QQmlPropertyData *);
- static QQmlPropertyData *property(
- QObject *, const QLatin1String &, const QQmlRefPointer<QQmlContextData> &,
+ static const QQmlPropertyData *property(QObject *, const QLatin1String &, const QQmlRefPointer<QQmlContextData> &,
QQmlPropertyData *);
- static QQmlPropertyData *property(
- QObject *, const QV4::String *, const QQmlRefPointer<QQmlContextData> &,
+ static const QQmlPropertyData *property(QObject *, const QV4::String *, const QQmlRefPointer<QQmlContextData> &,
QQmlPropertyData *);
//see QMetaObjectPrivate::originalClone
@@ -278,9 +276,9 @@ private:
typedef QLinkedStringMultiHash<QPair<int, QQmlPropertyData *> > StringCache;
typedef QVector<QTypeRevision> AllowedRevisionCache;
- QQmlPropertyData *findProperty(StringCache::ConstIterator it, QObject *,
+ const QQmlPropertyData *findProperty(StringCache::ConstIterator it, QObject *,
const QQmlRefPointer<QQmlContextData> &) const;
- QQmlPropertyData *findProperty(StringCache::ConstIterator it, const QQmlVMEMetaObject *,
+ const QQmlPropertyData *findProperty(StringCache::ConstIterator it, const QQmlVMEMetaObject *,
const QQmlRefPointer<QQmlContextData> &) const;
void updateRecur(const QMetaObject *);
@@ -360,7 +358,7 @@ inline const QMetaObject *QQmlPropertyCache::firstCppMetaObject() const
return p->_metaObject.metaObject();
}
-inline QQmlPropertyData *QQmlPropertyCache::property(int index) const
+inline const QQmlPropertyData *QQmlPropertyCache::property(int index) const
{
if (index < 0 || index >= propertyCount())
return nullptr;
@@ -368,10 +366,10 @@ inline QQmlPropertyData *QQmlPropertyCache::property(int index) const
if (index < propertyIndexCacheStart)
return _parent->property(index);
- return const_cast<QQmlPropertyData *>(&propertyIndexCache.at(index - propertyIndexCacheStart));
+ return &propertyIndexCache.at(index - propertyIndexCacheStart);
}
-inline QQmlPropertyData *QQmlPropertyCache::method(int index) const
+inline const QQmlPropertyData *QQmlPropertyCache::method(int index) const
{
if (index < 0 || index >= (methodIndexCacheStart + methodIndexCache.count()))
return nullptr;
@@ -379,14 +377,14 @@ inline QQmlPropertyData *QQmlPropertyCache::method(int index) const
if (index < methodIndexCacheStart)
return _parent->method(index);
- return const_cast<QQmlPropertyData *>(&methodIndexCache.at(index - methodIndexCacheStart));
+ return const_cast<const QQmlPropertyData *>(&methodIndexCache.at(index - methodIndexCacheStart));
}
/*! \internal
\a index MUST be in the signal index range (see QObjectPrivate::signalIndex()).
This is different from QMetaMethod::methodIndex().
*/
-inline QQmlPropertyData *QQmlPropertyCache::signal(int index) const
+inline const QQmlPropertyData *QQmlPropertyCache::signal(int index) const
{
if (index < 0 || index >= (signalHandlerIndexCacheStart + signalHandlerIndexCache.count()))
return nullptr;
@@ -394,7 +392,7 @@ inline QQmlPropertyData *QQmlPropertyCache::signal(int index) const
if (index < signalHandlerIndexCacheStart)
return _parent->signal(index);
- QQmlPropertyData *rv = const_cast<QQmlPropertyData *>(&methodIndexCache.at(index - signalHandlerIndexCacheStart));
+ const QQmlPropertyData *rv = const_cast<const QQmlPropertyData *>(&methodIndexCache.at(index - signalHandlerIndexCacheStart));
Q_ASSERT(rv->isSignal() || rv->coreIndex() == -1);
return rv;
}
@@ -429,8 +427,8 @@ inline const QQmlPropertyCache::ConstPtr &QQmlPropertyCache::parent() const
return _parent;
}
-QQmlPropertyData *
-QQmlPropertyCache::overrideData(QQmlPropertyData *data) const
+const QQmlPropertyData *
+QQmlPropertyCache::overrideData(const QQmlPropertyData *data) const
{
if (!data->hasOverride())
return nullptr;
@@ -441,7 +439,7 @@ QQmlPropertyCache::overrideData(QQmlPropertyData *data) const
return method(data->overrideIndex());
}
-bool QQmlPropertyCache::isAllowedInRevision(QQmlPropertyData *data) const
+bool QQmlPropertyCache::isAllowedInRevision(const QQmlPropertyData *data) const
{
const QTypeRevision requested = data->revision();
const int offset = data->metaObjectOffset();
diff --git a/src/qml/qml/qqmlpropertycachecreator_p.h b/src/qml/qml/qqmlpropertycachecreator_p.h
index 9a96db73d2..76f5f1fdc7 100644
--- a/src/qml/qml/qqmlpropertycachecreator_p.h
+++ b/src/qml/qml/qqmlpropertycachecreator_p.h
@@ -87,7 +87,7 @@ struct QQmlBindingInstantiationContext {
const QV4::CompiledData::Binding *instantiatingBinding = nullptr;
QString instantiatingPropertyName;
QQmlPropertyCache::ConstPtr referencingObjectPropertyCache;
- QQmlPropertyData *instantiatingProperty = nullptr;
+ const QQmlPropertyData *instantiatingProperty = nullptr;
};
struct QQmlPendingGroupPropertyBindings : public QVector<QQmlBindingInstantiationContext>
@@ -490,7 +490,7 @@ inline QQmlError QQmlPropertyCacheCreator<ObjectContainer>::createMetaObject(
auto pend = obj->propertiesEnd();
for ( ; p != pend; ++p) {
bool notInRevision = false;
- QQmlPropertyData *d = resolver.property(stringAt(p->nameIndex), &notInRevision);
+ const QQmlPropertyData *d = resolver.property(stringAt(p->nameIndex), &notInRevision);
if (d && d->isFinal())
return qQmlCompileError(p->location, QQmlPropertyCacheCreatorBase::tr("Cannot override FINAL property"));
}
@@ -499,7 +499,7 @@ inline QQmlError QQmlPropertyCacheCreator<ObjectContainer>::createMetaObject(
auto aend = obj->aliasesEnd();
for ( ; a != aend; ++a) {
bool notInRevision = false;
- QQmlPropertyData *d = resolver.property(stringAt(a->nameIndex), &notInRevision);
+ const QQmlPropertyData *d = resolver.property(stringAt(a->nameIndex), &notInRevision);
if (d && d->isFinal())
return qQmlCompileError(a->location, QQmlPropertyCacheCreatorBase::tr("Cannot override FINAL property"));
}
@@ -517,7 +517,7 @@ inline QQmlError QQmlPropertyCacheCreator<ObjectContainer>::createMetaObject(
if (int pSigCount = parentCache->signalCount()) {
int pSigOffset = parentCache->signalOffset();
for (int i = pSigOffset; i < pSigCount; ++i) {
- QQmlPropertyData *currPSig = parentCache->signal(i);
+ const QQmlPropertyData *currPSig = parentCache->signal(i);
// XXX TODO: find a better way to get signal name from the property data :-/
for (QQmlPropertyCache::StringCache::ConstIterator iter = parentCache->stringCache.begin();
iter != parentCache->stringCache.end(); ++iter) {
@@ -850,7 +850,7 @@ inline void QQmlPropertyCacheAliasCreator<ObjectContainer>::appendAliasPropertie
Q_ASSERT(targetCache);
int coreIndex = QQmlPropertyIndex::fromEncoded(alias->encodedMetaPropertyIndex).coreIndex();
- QQmlPropertyData *targetProperty = targetCache->property(coreIndex);
+ const QQmlPropertyData *targetProperty = targetCache->property(coreIndex);
if (!targetProperty)
return false;
}
@@ -968,7 +968,7 @@ inline QQmlError QQmlPropertyCacheAliasCreator<ObjectContainer>::propertyDataFor
QQmlPropertyCache::ConstPtr targetCache = propertyCaches->at(targetObjectIndex);
Q_ASSERT(targetCache);
- QQmlPropertyData *targetProperty = targetCache->property(coreIndex);
+ const QQmlPropertyData *targetProperty = targetCache->property(coreIndex);
Q_ASSERT(targetProperty);
// for deep aliases, valueTypeIndex is always set
@@ -977,7 +977,7 @@ inline QQmlError QQmlPropertyCacheAliasCreator<ObjectContainer>::propertyDataFor
*type = targetProperty->propType();
QQmlPropertyCache::ConstPtr typeCache = QQmlMetaType::propertyCacheForType(*type);
Q_ASSERT(typeCache);
- QQmlPropertyData *typeProperty = typeCache->property(valueTypeIndex);
+ const QQmlPropertyData *typeProperty = typeCache->property(valueTypeIndex);
if (typeProperty == nullptr) {
return qQmlCompileError(alias.referenceLocation,
diff --git a/src/qml/qml/qqmlpropertyresolver.cpp b/src/qml/qml/qqmlpropertyresolver.cpp
index 396f2876b9..96e90485ea 100644
--- a/src/qml/qml/qqmlpropertyresolver.cpp
+++ b/src/qml/qml/qqmlpropertyresolver.cpp
@@ -42,12 +42,12 @@
QT_BEGIN_NAMESPACE
-QQmlPropertyData *QQmlPropertyResolver::property(const QString &name, bool *notInRevision,
+const QQmlPropertyData *QQmlPropertyResolver::property(const QString &name, bool *notInRevision,
RevisionCheck check) const
{
if (notInRevision) *notInRevision = false;
- QQmlPropertyData *d = cache->property(name, nullptr, nullptr);
+ const QQmlPropertyData *d = cache->property(name, nullptr, nullptr);
// Find the first property
while (d && d->isFunction())
@@ -62,11 +62,11 @@ QQmlPropertyData *QQmlPropertyResolver::property(const QString &name, bool *notI
}
-QQmlPropertyData *QQmlPropertyResolver::signal(const QString &name, bool *notInRevision) const
+const QQmlPropertyData *QQmlPropertyResolver::signal(const QString &name, bool *notInRevision) const
{
if (notInRevision) *notInRevision = false;
- QQmlPropertyData *d = cache->property(name, nullptr, nullptr);
+ const QQmlPropertyData *d = cache->property(name, nullptr, nullptr);
if (notInRevision) *notInRevision = false;
while (d && !(d->isFunction()))
diff --git a/src/qml/qml/qqmlpropertyresolver_p.h b/src/qml/qml/qqmlpropertyresolver_p.h
index 5f807b6009..922a9adc5e 100644
--- a/src/qml/qml/qqmlpropertyresolver_p.h
+++ b/src/qml/qml/qqmlpropertyresolver_p.h
@@ -63,7 +63,7 @@ struct Q_QML_EXPORT QQmlPropertyResolver
: cache(cache)
{}
- QQmlPropertyData *property(int index) const
+ const QQmlPropertyData *property(int index) const
{
return cache->property(index);
}
@@ -73,11 +73,11 @@ struct Q_QML_EXPORT QQmlPropertyResolver
IgnoreRevision
};
- QQmlPropertyData *property(const QString &name, bool *notInRevision = nullptr,
+ const QQmlPropertyData *property(const QString &name, bool *notInRevision = nullptr,
RevisionCheck check = CheckRevision) const;
// This code must match the semantics of QQmlPropertyPrivate::findSignalByName
- QQmlPropertyData *signal(const QString &name, bool *notInRevision) const;
+ const QQmlPropertyData *signal(const QString &name, bool *notInRevision) const;
QQmlPropertyCache::ConstPtr cache;
};
diff --git a/src/qml/qml/qqmlpropertyvalidator.cpp b/src/qml/qml/qqmlpropertyvalidator.cpp
index 603bbf8b03..1bdcfc220c 100644
--- a/src/qml/qml/qqmlpropertyvalidator.cpp
+++ b/src/qml/qml/qqmlpropertyvalidator.cpp
@@ -149,7 +149,7 @@ QVector<QQmlError> QQmlPropertyValidator::validateObject(
QQmlPropertyResolver propertyResolver(propertyCache);
QString defaultPropertyName;
- QQmlPropertyData *defaultProperty = nullptr;
+ const QQmlPropertyData *defaultProperty = nullptr;
if (obj->indexOfDefaultPropertyOrAlias != -1) {
const QQmlPropertyCache *cache = propertyCache->parent().data();
defaultPropertyName = cache->defaultPropertyName();
@@ -182,7 +182,7 @@ QVector<QQmlError> QQmlPropertyValidator::validateObject(
bool isGroupProperty = instantiatingBinding && instantiatingBinding->type == QV4::CompiledData::Binding::Type_GroupProperty;
bool notInRevision = false;
- QQmlPropertyData *pd = nullptr;
+ const QQmlPropertyData *pd = nullptr;
if (!name.isEmpty()) {
if (binding->flags & QV4::CompiledData::Binding::IsSignalHandlerExpression
|| binding->flags & QV4::CompiledData::Binding::IsSignalHandlerObject) {
@@ -380,7 +380,7 @@ QVector<QQmlError> QQmlPropertyValidator::validateObject(
}
QQmlError QQmlPropertyValidator::validateLiteralBinding(
- const QQmlPropertyCache::ConstPtr &propertyCache, QQmlPropertyData *property,
+ const QQmlPropertyCache::ConstPtr &propertyCache, const QQmlPropertyData *property,
const QV4::CompiledData::Binding *binding) const
{
if (property->isQList()) {
@@ -698,7 +698,7 @@ QVector<QQmlError> QQmlPropertyValidator::recordError(const QQmlError &error) co
return errors;
}
-QQmlError QQmlPropertyValidator::validateObjectBinding(QQmlPropertyData *property, const QString &propertyName, const QV4::CompiledData::Binding *binding) const
+QQmlError QQmlPropertyValidator::validateObjectBinding(const QQmlPropertyData *property, const QString &propertyName, const QV4::CompiledData::Binding *binding) const
{
QQmlError noError;
diff --git a/src/qml/qml/qqmlpropertyvalidator_p.h b/src/qml/qml/qqmlpropertyvalidator_p.h
index 0927b0be78..b8dc699dad 100644
--- a/src/qml/qml/qqmlpropertyvalidator_p.h
+++ b/src/qml/qml/qqmlpropertyvalidator_p.h
@@ -73,10 +73,10 @@ private:
int objectIndex, const QV4::CompiledData::Binding *instantiatingBinding,
bool populatingValueTypeGroupProperty = false) const;
QQmlError validateLiteralBinding(
- const QQmlPropertyCache::ConstPtr &propertyCache, QQmlPropertyData *property,
+ const QQmlPropertyCache::ConstPtr &propertyCache, const QQmlPropertyData *property,
const QV4::CompiledData::Binding *binding) const;
QQmlError validateObjectBinding(
- QQmlPropertyData *property, const QString &propertyName,
+ const QQmlPropertyData *property, const QString &propertyName,
const QV4::CompiledData::Binding *binding) const;
bool canCoerce(QMetaType to, QQmlPropertyCache::ConstPtr fromMo) const;
diff --git a/src/qml/qml/qqmltypecompiler.cpp b/src/qml/qml/qqmltypecompiler.cpp
index e4078a2ba0..60b42fee1d 100644
--- a/src/qml/qml/qqmltypecompiler.cpp
+++ b/src/qml/qml/qqmltypecompiler.cpp
@@ -369,9 +369,9 @@ bool SignalHandlerResolver::resolveSignalHandlerExpressions(
qPropertyName = signalName.mid(0, signalName.length() - static_cast<int>(strlen("Changed")));
bool notInRevision = false;
- QQmlPropertyData * const signal = resolver.signal(signalName, &notInRevision);
- QQmlPropertyData * const signalPropertyData = resolver.property(signalName, /*notInRevision ptr*/nullptr);
- QQmlPropertyData * const qPropertyData = !qPropertyName.isEmpty() ? resolver.property(qPropertyName) : nullptr;
+ const QQmlPropertyData * const signal = resolver.signal(signalName, &notInRevision);
+ const QQmlPropertyData * const signalPropertyData = resolver.property(signalName, /*notInRevision ptr*/nullptr);
+ const QQmlPropertyData * const qPropertyData = !qPropertyName.isEmpty() ? resolver.property(qPropertyName) : nullptr;
QString finalSignalHandlerPropertyName = signalName;
uint flags = QV4::CompiledData::Binding::IsSignalHandlerExpression;
@@ -491,7 +491,7 @@ bool QQmlEnumTypeResolver::resolveEnumBindings()
const QString propertyName = stringAt(binding->propertyNameIndex);
bool notInRevision = false;
- QQmlPropertyData *pd = resolver.property(propertyName, &notInRevision);
+ const QQmlPropertyData *pd = resolver.property(propertyName, &notInRevision);
if (!pd || pd->isQList())
continue;
@@ -702,13 +702,13 @@ void QQmlAliasAnnotator::annotateBindingsToAliases()
const QmlIR::Object *obj = qmlObjects.at(i);
QQmlPropertyResolver resolver(propertyCache);
- QQmlPropertyData *defaultProperty = obj->indexOfDefaultPropertyOrAlias != -1 ? propertyCache->parent()->defaultProperty() : propertyCache->defaultProperty();
+ const QQmlPropertyData *defaultProperty = obj->indexOfDefaultPropertyOrAlias != -1 ? propertyCache->parent()->defaultProperty() : propertyCache->defaultProperty();
for (QmlIR::Binding *binding = obj->firstBinding(); binding; binding = binding->next) {
if (!binding->isValueBinding())
continue;
bool notInRevision = false;
- QQmlPropertyData *pd = binding->propertyNameIndex != quint32(0) ? resolver.property(stringAt(binding->propertyNameIndex), &notInRevision) : defaultProperty;
+ const QQmlPropertyData *pd = binding->propertyNameIndex != quint32(0) ? resolver.property(stringAt(binding->propertyNameIndex), &notInRevision) : defaultProperty;
if (pd && pd->isAlias())
binding->flags |= QV4::CompiledData::Binding::IsBindingToAlias;
}
@@ -734,13 +734,13 @@ void QQmlScriptStringScanner::scan()
const QmlIR::Object *obj = qmlObjects.at(i);
QQmlPropertyResolver resolver(propertyCache);
- QQmlPropertyData *defaultProperty = obj->indexOfDefaultPropertyOrAlias != -1 ? propertyCache->parent()->defaultProperty() : propertyCache->defaultProperty();
+ const QQmlPropertyData *defaultProperty = obj->indexOfDefaultPropertyOrAlias != -1 ? propertyCache->parent()->defaultProperty() : propertyCache->defaultProperty();
for (QmlIR::Binding *binding = obj->firstBinding(); binding; binding = binding->next) {
if (binding->type != QV4::CompiledData::Binding::Type_Script)
continue;
bool notInRevision = false;
- QQmlPropertyData *pd = binding->propertyNameIndex != quint32(0) ? resolver.property(stringAt(binding->propertyNameIndex), &notInRevision) : defaultProperty;
+ const QQmlPropertyData *pd = binding->propertyNameIndex != quint32(0) ? resolver.property(stringAt(binding->propertyNameIndex), &notInRevision) : defaultProperty;
if (!pd || pd->propType() != scriptStringMetaType)
continue;
@@ -781,7 +781,7 @@ void QQmlComponentAndAliasResolver::findAndRegisterImplicitComponents(
{
QQmlPropertyResolver propertyResolver(propertyCache);
- QQmlPropertyData *defaultProperty = obj->indexOfDefaultPropertyOrAlias != -1 ? propertyCache->parent()->defaultProperty() : propertyCache->defaultProperty();
+ const QQmlPropertyData *defaultProperty = obj->indexOfDefaultPropertyOrAlias != -1 ? propertyCache->parent()->defaultProperty() : propertyCache->defaultProperty();
for (QmlIR::Binding *binding = obj->firstBinding(); binding; binding = binding->next) {
if (binding->type != QV4::CompiledData::Binding::Type_Object)
@@ -803,7 +803,7 @@ void QQmlComponentAndAliasResolver::findAndRegisterImplicitComponents(
continue;
// if here, not a QQmlComponent, so needs wrapping
- QQmlPropertyData *pd = nullptr;
+ const QQmlPropertyData *pd = nullptr;
if (binding->propertyNameIndex != quint32(0)) {
bool notInRevision = false;
pd = propertyResolver.property(stringAt(binding->propertyNameIndex), &notInRevision);
@@ -1121,7 +1121,7 @@ QQmlComponentAndAliasResolver::resolveAliasesInObject(int objectIndex,
QQmlPropertyResolver resolver(targetCache);
- QQmlPropertyData *targetProperty = resolver.property(property.toString());
+ const QQmlPropertyData *targetProperty = resolver.property(property.toString());
// If it's an alias that we haven't resolved yet, try again later.
if (!targetProperty) {
@@ -1169,7 +1169,7 @@ QQmlComponentAndAliasResolver::resolveAliasesInObject(int objectIndex,
auto binding = *it;
if (compiler->stringAt(binding.propertyNameIndex) == property) {
resolver = QQmlPropertyResolver(propertyCaches.at(binding.value.objectIndex));
- QQmlPropertyData *actualProperty = resolver.property(subProperty.toString());
+ const QQmlPropertyData *actualProperty = resolver.property(subProperty.toString());
if (actualProperty) {
propIdx = QQmlPropertyIndex(propIdx.coreIndex(), actualProperty->coreIndex());
isDeepAlias = true;
@@ -1256,7 +1256,7 @@ bool QQmlDeferredAndCustomParserBindingScanner::scanObject(
return true;
QString defaultPropertyName;
- QQmlPropertyData *defaultProperty = nullptr;
+ const QQmlPropertyData *defaultProperty = nullptr;
if (obj->indexOfDefaultPropertyOrAlias != -1) {
const QQmlPropertyCache *cache = propertyCache->parent().data();
defaultPropertyName = cache->defaultPropertyName();
diff --git a/src/qml/qml/qqmltypewrapper.cpp b/src/qml/qml/qqmltypewrapper.cpp
index de2448ba2d..515ad2c59b 100644
--- a/src/qml/qml/qqmltypewrapper.cpp
+++ b/src/qml/qml/qqmltypewrapper.cpp
@@ -452,7 +452,7 @@ ReturnedValue QQmlTypeWrapper::virtualResolveLookupGetter(const Object *object,
if (!includeEnums || !name->startsWithUpper()) {
QQmlData *ddata = QQmlData::get(qobjectSingleton, false);
if (ddata && ddata->propertyCache) {
- QQmlPropertyData *property = ddata->propertyCache->property(name.getPointer(), qobjectSingleton, qmlContext);
+ const QQmlPropertyData *property = ddata->propertyCache->property(name.getPointer(), qobjectSingleton, qmlContext);
if (property) {
ScopedValue val(scope, Value::fromReturnedValue(QV4::QObjectWrapper::wrap(engine, qobjectSingleton)));
setupQObjectLookup(lookup, ddata, property,
diff --git a/src/qml/types/qqmlconnections.cpp b/src/qml/types/qqmlconnections.cpp
index 73a3e60efc..523594a171 100644
--- a/src/qml/types/qqmlconnections.cpp
+++ b/src/qml/types/qqmlconnections.cpp
@@ -302,7 +302,7 @@ void QQmlConnections::connectSignalsToMethods()
i < end;
++i) {
- QQmlPropertyData *handler = ddata->propertyCache->method(i);
+ const QQmlPropertyData *handler = ddata->propertyCache->method(i);
if (!handler || !handler->isVMEFunction())
continue;
diff --git a/src/quick/items/qquickshadereffect.cpp b/src/quick/items/qquickshadereffect.cpp
index cd619d24a5..cbad537886 100644
--- a/src/quick/items/qquickshadereffect.cpp
+++ b/src/quick/items/qquickshadereffect.cpp
@@ -1481,7 +1481,7 @@ void QQuickShaderEffectImpl::updateShaderVars(Shader shaderType)
// Find the property on the ShaderEffect item.
int propIdx = -1;
- QQmlPropertyData *pd = nullptr;
+ const QQmlPropertyData *pd = nullptr;
if (propCache) {
pd = propCache->property(QLatin1String(v.name), nullptr, nullptr);
if (pd) {