aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-09-21 09:24:03 +0200
committerLiang Qi <liang.qi@qt.io>2016-09-21 09:24:03 +0200
commitcb5cbe9eb7c9a68acbe19ff2fd0c299e30f42eca (patch)
tree2ba783322c213c9c533163dc69c950367f767a44 /src/qml
parent8de7ec4bf82c35ff1413fb5f5a5ca1788dc93af3 (diff)
parent16914894f035963ace51c92de13aad11a53c3cf8 (diff)
Merge remote-tracking branch 'origin/5.8' into dev
Conflicts: src/qml/compiler/qv4isel_moth_p.h Change-Id: I8e86a649d1ef8ad27dc66cc8c290093b2faabc69
Diffstat (limited to 'src/qml')
-rw-r--r--src/qml/compiler/qv4compilationunitmapper_win.cpp1
-rw-r--r--src/qml/compiler/qv4compileddata_p.h2
-rw-r--r--src/qml/compiler/qv4compiler.cpp1
-rw-r--r--src/qml/compiler/qv4instr_moth_p.h2
-rw-r--r--src/qml/compiler/qv4isel_moth.cpp4
-rw-r--r--src/qml/compiler/qv4isel_moth_p.h2
-rw-r--r--src/qml/compiler/qv4isel_p.cpp6
-rw-r--r--src/qml/compiler/qv4isel_p.h2
-rw-r--r--src/qml/doc/src/qmlfunctions.qdoc36
-rw-r--r--src/qml/doc/src/qtqml.qdoc13
-rw-r--r--src/qml/jit/qv4isel_masm.cpp6
-rw-r--r--src/qml/jit/qv4isel_masm_p.h2
-rw-r--r--src/qml/jit/qv4regalloc.cpp2
-rw-r--r--src/qml/jsruntime/qv4arraybuffer.cpp10
-rw-r--r--src/qml/jsruntime/qv4arraybuffer_p.h1
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper.cpp2
-rw-r--r--src/qml/jsruntime/qv4runtime.cpp16
-rw-r--r--src/qml/jsruntime/qv4runtime_p.h2
-rw-r--r--src/qml/jsruntime/qv4runtimeapi_p.h4
-rw-r--r--src/qml/jsruntime/qv4vme_moth.cpp4
-rw-r--r--src/qml/qml/qml.pri2
-rw-r--r--src/qml/qml/qqml.h3
-rw-r--r--src/qml/qml/qqmlaccessors.cpp105
-rw-r--r--src/qml/qml/qqmlaccessors_p.h182
-rw-r--r--src/qml/qml/qqmlbinding.cpp3
-rw-r--r--src/qml/qml/qqmlengine.cpp33
-rw-r--r--src/qml/qml/qqmlimport.cpp33
-rw-r--r--src/qml/qml/qqmljavascriptexpression.cpp10
-rw-r--r--src/qml/qml/qqmljavascriptexpression_p.h8
-rw-r--r--src/qml/qml/qqmlobjectcreator.cpp1
-rw-r--r--src/qml/qml/qqmlpropertycache.cpp37
-rw-r--r--src/qml/qml/qqmlpropertycache_p.h5
-rw-r--r--src/qml/qml/v8/qv8engine.cpp3
33 files changed, 178 insertions, 365 deletions
diff --git a/src/qml/compiler/qv4compilationunitmapper_win.cpp b/src/qml/compiler/qv4compilationunitmapper_win.cpp
index abf109484b..457b702ac3 100644
--- a/src/qml/compiler/qv4compilationunitmapper_win.cpp
+++ b/src/qml/compiler/qv4compilationunitmapper_win.cpp
@@ -116,6 +116,7 @@ CompiledData::Unit *CompilationUnitMapper::open(const QString &cacheFileName, co
return reinterpret_cast<CompiledData::Unit*>(dataPtr);
#else
+ Q_UNUSED(sourcePath);
*errorString = QStringLiteral("Compilation unit mapping not supported on WinRT 8.1");
return nullptr;
#endif
diff --git a/src/qml/compiler/qv4compileddata_p.h b/src/qml/compiler/qv4compileddata_p.h
index b71c1d8185..ae8677138e 100644
--- a/src/qml/compiler/qv4compileddata_p.h
+++ b/src/qml/compiler/qv4compileddata_p.h
@@ -71,7 +71,7 @@
QT_BEGIN_NAMESPACE
// Bump this whenever the compiler data structures change in an incompatible way.
-#define QV4_DATA_STRUCTURE_VERSION 0x03
+#define QV4_DATA_STRUCTURE_VERSION 0x04
class QIODevice;
class QQmlPropertyCache;
diff --git a/src/qml/compiler/qv4compiler.cpp b/src/qml/compiler/qv4compiler.cpp
index 0f39506c28..729c56540d 100644
--- a/src/qml/compiler/qv4compiler.cpp
+++ b/src/qml/compiler/qv4compiler.cpp
@@ -278,6 +278,7 @@ void QV4::Compiler::JSUnitGenerator::writeFunction(char *f, QV4::IR::Function *i
QV4::CompiledData::Function *function = (QV4::CompiledData::Function *)f;
quint32 currentOffset = sizeof(QV4::CompiledData::Function);
+ currentOffset = (currentOffset + 7) & ~quint32(0x7);
function->nameIndex = getStringId(*irFunction->name);
function->flags = 0;
diff --git a/src/qml/compiler/qv4instr_moth_p.h b/src/qml/compiler/qv4instr_moth_p.h
index 20b871c4e8..beb43376ee 100644
--- a/src/qml/compiler/qv4instr_moth_p.h
+++ b/src/qml/compiler/qv4instr_moth_p.h
@@ -335,12 +335,14 @@ union Instr
int propertyIndex;
Param base;
Param result;
+ bool captureRequired;
};
struct instr_loadContextObjectProperty {
MOTH_INSTR_HEADER
int propertyIndex;
Param base;
Param result;
+ bool captureRequired;
};
struct instr_loadIdObject {
MOTH_INSTR_HEADER
diff --git a/src/qml/compiler/qv4isel_moth.cpp b/src/qml/compiler/qv4isel_moth.cpp
index 91386b1133..5dd722bfc2 100644
--- a/src/qml/compiler/qv4isel_moth.cpp
+++ b/src/qml/compiler/qv4isel_moth.cpp
@@ -579,18 +579,20 @@ void InstructionSelection::setQObjectProperty(IR::Expr *source, IR::Expr *target
addInstruction(store);
}
-void InstructionSelection::getQmlContextProperty(IR::Expr *source, IR::Member::MemberKind kind, int index, IR::Expr *target)
+void InstructionSelection::getQmlContextProperty(IR::Expr *source, IR::Member::MemberKind kind, int index, bool captureRequired, IR::Expr *target)
{
if (kind == IR::Member::MemberOfQmlScopeObject) {
Instruction::LoadScopeObjectProperty load;
load.base = getParam(source);
load.propertyIndex = index;
+ load.captureRequired = captureRequired;
load.result = getResultParam(target);
addInstruction(load);
} else if (kind == IR::Member::MemberOfQmlContextObject) {
Instruction::LoadContextObjectProperty load;
load.base = getParam(source);
load.propertyIndex = index;
+ load.captureRequired = captureRequired;
load.result = getResultParam(target);
addInstruction(load);
} else if (kind == IR::Member::MemberOfIdObjectsArray) {
diff --git a/src/qml/compiler/qv4isel_moth_p.h b/src/qml/compiler/qv4isel_moth_p.h
index 08e431e547..9699555670 100644
--- a/src/qml/compiler/qv4isel_moth_p.h
+++ b/src/qml/compiler/qv4isel_moth_p.h
@@ -138,7 +138,7 @@ protected:
void setProperty(IR::Expr *source, IR::Expr *targetBase, const QString &targetName) override;
void setQmlContextProperty(IR::Expr *source, IR::Expr *targetBase, IR::Member::MemberKind kind, int propertyIndex) override;
void setQObjectProperty(IR::Expr *source, IR::Expr *targetBase, int propertyIndex) override;
- void getQmlContextProperty(IR::Expr *source, IR::Member::MemberKind kind, int index, IR::Expr *target) override;
+ void getQmlContextProperty(IR::Expr *source, IR::Member::MemberKind kind, int index, bool captureRequired, IR::Expr *target) override;
void getQObjectProperty(IR::Expr *base, int propertyIndex, bool captureRequired, bool isSingleton, int attachedPropertiesId, IR::Expr *target) override;
void getElement(IR::Expr *base, IR::Expr *index, IR::Expr *target) override;
void setElement(IR::Expr *source, IR::Expr *targetBase, IR::Expr *targetIndex) override;
diff --git a/src/qml/compiler/qv4isel_p.cpp b/src/qml/compiler/qv4isel_p.cpp
index 72e6c276a9..efcfb9bd77 100644
--- a/src/qml/compiler/qv4isel_p.cpp
+++ b/src/qml/compiler/qv4isel_p.cpp
@@ -147,7 +147,7 @@ void IRDecoder::visitMove(IR::Move *s)
const int attachedPropertiesId = m->attachedPropertiesId;
const bool isSingletonProperty = m->kind == IR::Member::MemberOfSingletonObject;
- if (_function && attachedPropertiesId == 0 && !m->property->isConstant()) {
+ if (_function && attachedPropertiesId == 0 && !m->property->isConstant() && _function->isQmlBinding) {
if (m->kind == IR::Member::MemberOfQmlContextObject) {
_function->contextObjectPropertyDependencies.insert(m->property->coreIndex(), m->property->notifyIndex());
captureRequired = false;
@@ -157,14 +157,14 @@ void IRDecoder::visitMove(IR::Move *s)
}
}
if (m->kind == IR::Member::MemberOfQmlScopeObject || m->kind == IR::Member::MemberOfQmlContextObject) {
- getQmlContextProperty(m->base, (IR::Member::MemberKind)m->kind, m->property->coreIndex(), s->target);
+ getQmlContextProperty(m->base, (IR::Member::MemberKind)m->kind, m->property->coreIndex(), captureRequired, s->target);
return;
}
getQObjectProperty(m->base, m->property->coreIndex(), captureRequired, isSingletonProperty, attachedPropertiesId, s->target);
#endif // V4_BOOTSTRAP
return;
} else if (m->kind == IR::Member::MemberOfIdObjectsArray) {
- getQmlContextProperty(m->base, (IR::Member::MemberKind)m->kind, m->idIndex, s->target);
+ getQmlContextProperty(m->base, (IR::Member::MemberKind)m->kind, m->idIndex, /*captureRequired*/false, s->target);
return;
} else if (m->base->asTemp() || m->base->asConst() || m->base->asArgLocal()) {
getProperty(m->base, *m->name, s->target);
diff --git a/src/qml/compiler/qv4isel_p.h b/src/qml/compiler/qv4isel_p.h
index a3fa80b6f0..037c02e5ea 100644
--- a/src/qml/compiler/qv4isel_p.h
+++ b/src/qml/compiler/qv4isel_p.h
@@ -188,7 +188,7 @@ public: // to implement by subclasses:
virtual void initClosure(IR::Closure *closure, IR::Expr *target) = 0;
virtual void getProperty(IR::Expr *base, const QString &name, IR::Expr *target) = 0;
virtual void getQObjectProperty(IR::Expr *base, int propertyIndex, bool captureRequired, bool isSingletonProperty, int attachedPropertiesId, IR::Expr *target) = 0;
- virtual void getQmlContextProperty(IR::Expr *source, IR::Member::MemberKind kind, int index, IR::Expr *target) = 0;
+ virtual void getQmlContextProperty(IR::Expr *source, IR::Member::MemberKind kind, int index, bool captureRequired, IR::Expr *target) = 0;
virtual void setProperty(IR::Expr *source, IR::Expr *targetBase, const QString &targetName) = 0;
virtual void setQmlContextProperty(IR::Expr *source, IR::Expr *targetBase, IR::Member::MemberKind kind, int propertyIndex) = 0;
virtual void setQObjectProperty(IR::Expr *source, IR::Expr *targetBase, int propertyIndex) = 0;
diff --git a/src/qml/doc/src/qmlfunctions.qdoc b/src/qml/doc/src/qmlfunctions.qdoc
index 26fc40ff37..8b24d19891 100644
--- a/src/qml/doc/src/qmlfunctions.qdoc
+++ b/src/qml/doc/src/qmlfunctions.qdoc
@@ -180,6 +180,42 @@
*/
/*!
+ \fn static inline int qmlRegisterUncreatableMetaObject(const QMetaObject &staticMetaObject, const char *uri, int versionMajor, int versionMinor, const char *qmlName, const QString& reason)
+ \relates QQmlEngine
+ \since 5.8
+
+ This function registers the \a staticMetaObject and its extension
+ in the QML system with the name \a qmlName in the library imported
+ from \a uri having version number composed from \a versionMajor and
+ \a versionMinor.
+
+ This function is useful to register Q_NAMESPACE namespaces.
+
+ Returns the QML type id.
+
+ Example:
+
+ \code
+ namespace MyNamespace {
+ Q_NAMESPACE
+ enum MyEnum {
+ Key1,
+ Key2,
+ };
+ Q_ENUMS(MyEnum)
+ }
+
+ //...
+ qmlRegisterUncreatableMetaObject(MyNamespace::staticMetaObject, "io.qt", 1, 0, "MyNamespace", "Access to enums & flags only");
+ \endcode
+
+ Now on QML side you can use the registered enums:
+ \code
+ Component.onCompleted: console.log(MyNamespace.Key2)
+ \endcode
+*/
+
+/*!
\fn int qmlRegisterCustomExtendedType(const char *uri, int versionMajor, int versionMinor, const char *qmlName, QQmlCustomParser *parser)
\relates QQmlEngine
\internal
diff --git a/src/qml/doc/src/qtqml.qdoc b/src/qml/doc/src/qtqml.qdoc
index 33bb0c0750..747466281e 100644
--- a/src/qml/doc/src/qtqml.qdoc
+++ b/src/qml/doc/src/qtqml.qdoc
@@ -131,6 +131,19 @@ the QML code to interact with C++ code.
\li \l{The Declarative State Machine Framework}
\endlist
+\section1 Licenses and Attributions
+
+Qt QML is available under commercial licenses from \l{The Qt Company}.
+In addition, it is available under the
+\l{GNU Lesser General Public License, version 3}, or
+the \l{GNU General Public License, version 2}.
+See \l{Qt Licensing} for further details.
+
+Furthermore Qt QML potentially contains third party
+modules under following permissive licenses:
+
+\generatelist{groupsbymodule attributions-qtqml}
+
\section1 Guides and Other Information
Further information for writing QML applications:
diff --git a/src/qml/jit/qv4isel_masm.cpp b/src/qml/jit/qv4isel_masm.cpp
index dd3b803ca8..12b1eb4473 100644
--- a/src/qml/jit/qv4isel_masm.cpp
+++ b/src/qml/jit/qv4isel_masm.cpp
@@ -730,12 +730,12 @@ void InstructionSelection::getProperty(IR::Expr *base, const QString &name, IR::
}
}
-void InstructionSelection::getQmlContextProperty(IR::Expr *base, IR::Member::MemberKind kind, int index, IR::Expr *target)
+void InstructionSelection::getQmlContextProperty(IR::Expr *base, IR::Member::MemberKind kind, int index, bool captureRequired, IR::Expr *target)
{
if (kind == IR::Member::MemberOfQmlScopeObject)
- generateRuntimeCall(target, getQmlScopeObjectProperty, Assembler::EngineRegister, Assembler::PointerToValue(base), Assembler::TrustedImm32(index));
+ generateRuntimeCall(target, getQmlScopeObjectProperty, Assembler::EngineRegister, Assembler::PointerToValue(base), Assembler::TrustedImm32(index), Assembler::TrustedImm32(captureRequired));
else if (kind == IR::Member::MemberOfQmlContextObject)
- generateRuntimeCall(target, getQmlContextObjectProperty, Assembler::EngineRegister, Assembler::PointerToValue(base), Assembler::TrustedImm32(index));
+ generateRuntimeCall(target, getQmlContextObjectProperty, Assembler::EngineRegister, Assembler::PointerToValue(base), Assembler::TrustedImm32(index), Assembler::TrustedImm32(captureRequired));
else if (kind == IR::Member::MemberOfIdObjectsArray)
generateRuntimeCall(target, getQmlIdObject, Assembler::EngineRegister, Assembler::PointerToValue(base), Assembler::TrustedImm32(index));
else
diff --git a/src/qml/jit/qv4isel_masm_p.h b/src/qml/jit/qv4isel_masm_p.h
index 0e909820e7..1742ff9a36 100644
--- a/src/qml/jit/qv4isel_masm_p.h
+++ b/src/qml/jit/qv4isel_masm_p.h
@@ -124,7 +124,7 @@ protected:
virtual void setActivationProperty(IR::Expr *source, const QString &targetName);
virtual void initClosure(IR::Closure *closure, IR::Expr *target);
virtual void getProperty(IR::Expr *base, const QString &name, IR::Expr *target);
- virtual void getQmlContextProperty(IR::Expr *source, IR::Member::MemberKind kind, int index, IR::Expr *target);
+ virtual void getQmlContextProperty(IR::Expr *source, IR::Member::MemberKind kind, int index, bool captureRequired, IR::Expr *target);
virtual void getQObjectProperty(IR::Expr *base, int propertyIndex, bool captureRequired, bool isSingleton, int attachedPropertiesId, IR::Expr *target);
virtual void setProperty(IR::Expr *source, IR::Expr *targetBase, const QString &targetName);
virtual void setQmlContextProperty(IR::Expr *source, IR::Expr *targetBase, IR::Member::MemberKind kind, int propertyIndex);
diff --git a/src/qml/jit/qv4regalloc.cpp b/src/qml/jit/qv4regalloc.cpp
index 350ab7e0c6..406b9096ea 100644
--- a/src/qml/jit/qv4regalloc.cpp
+++ b/src/qml/jit/qv4regalloc.cpp
@@ -528,7 +528,7 @@ protected: // IRDecoder
addCall();
}
- virtual void getQmlContextProperty(IR::Expr *base, IR::Member::MemberKind /*kind*/, int /*index*/, IR::Expr *target)
+ virtual void getQmlContextProperty(IR::Expr *base, IR::Member::MemberKind /*kind*/, int /*index*/, bool /*captureRequired*/, IR::Expr *target)
{
addDef(target);
addUses(base->asTemp(), Use::CouldHaveRegister);
diff --git a/src/qml/jsruntime/qv4arraybuffer.cpp b/src/qml/jsruntime/qv4arraybuffer.cpp
index e006773c9e..34c7746684 100644
--- a/src/qml/jsruntime/qv4arraybuffer.cpp
+++ b/src/qml/jsruntime/qv4arraybuffer.cpp
@@ -154,6 +154,7 @@ void ArrayBufferPrototype::init(ExecutionEngine *engine, Object *ctor)
defineDefaultProperty(engine->id_constructor(), (o = ctor));
defineAccessorProperty(QStringLiteral("byteLength"), method_get_byteLength, 0);
defineDefaultProperty(QStringLiteral("slice"), method_slice, 2);
+ defineDefaultProperty(QStringLiteral("toString"), method_toString, 0);
}
ReturnedValue ArrayBufferPrototype::method_get_byteLength(CallContext *ctx)
@@ -198,3 +199,12 @@ ReturnedValue ArrayBufferPrototype::method_slice(CallContext *ctx)
return newBuffer.asReturnedValue();
}
+
+ReturnedValue ArrayBufferPrototype::method_toString(CallContext *ctx)
+{
+ Scope scope(ctx);
+ Scoped<ArrayBuffer> a(scope, ctx->thisObject());
+ if (!a)
+ return Encode::undefined();
+ return Encode(ctx->engine()->newString(QString::fromUtf8(a->asByteArray())));
+}
diff --git a/src/qml/jsruntime/qv4arraybuffer_p.h b/src/qml/jsruntime/qv4arraybuffer_p.h
index d079aeb9f7..b552cef9f1 100644
--- a/src/qml/jsruntime/qv4arraybuffer_p.h
+++ b/src/qml/jsruntime/qv4arraybuffer_p.h
@@ -106,6 +106,7 @@ struct ArrayBufferPrototype: Object
static ReturnedValue method_get_byteLength(CallContext *ctx);
static ReturnedValue method_slice(CallContext *ctx);
+ static ReturnedValue method_toString(CallContext *ctx);
};
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp
index 870782c306..7707f3ba24 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper.cpp
+++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp
@@ -1920,7 +1920,7 @@ ReturnedValue QMetaObjectWrapper::callConstructor(const QQmlPropertyData &data,
const QMetaObject* mo = d()->metaObject;
const QQmlStaticMetaObject object(mo);
- return CallPrecise(object, data, engine, callArgs, QMetaObject::InvokeMetaMethod);
+ return CallPrecise(object, data, engine, callArgs, QMetaObject::CreateInstance);
}
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp
index d1104dc74c..e82e7eb804 100644
--- a/src/qml/jsruntime/qv4runtime.cpp
+++ b/src/qml/jsruntime/qv4runtime.cpp
@@ -988,7 +988,7 @@ ReturnedValue Runtime::method_callActivationProperty(ExecutionEngine *engine, in
ReturnedValue Runtime::method_callQmlScopeObjectProperty(ExecutionEngine *engine, int propertyIndex, CallData *callData)
{
Scope scope(engine);
- ScopedFunctionObject o(scope, method_getQmlScopeObjectProperty(engine, callData->thisObject, propertyIndex));
+ ScopedFunctionObject o(scope, method_getQmlScopeObjectProperty(engine, callData->thisObject, propertyIndex, /*captureRequired*/true));
if (!o) {
QString error = QStringLiteral("Property '%1' of scope object is not a function").arg(propertyIndex);
return engine->throwTypeError(error);
@@ -1001,7 +1001,7 @@ ReturnedValue Runtime::method_callQmlScopeObjectProperty(ExecutionEngine *engine
ReturnedValue Runtime::method_callQmlContextObjectProperty(ExecutionEngine *engine, int propertyIndex, CallData *callData)
{
Scope scope(engine);
- ScopedFunctionObject o(scope, method_getQmlContextObjectProperty(engine, callData->thisObject, propertyIndex));
+ ScopedFunctionObject o(scope, method_getQmlContextObjectProperty(engine, callData->thisObject, propertyIndex, /*captureRequired*/true));
if (!o) {
QString error = QStringLiteral("Property '%1' of context object is not a function").arg(propertyIndex);
return engine->throwTypeError(error);
@@ -1209,7 +1209,7 @@ QV4::ReturnedValue Runtime::method_typeofName(ExecutionEngine *engine, int nameI
ReturnedValue Runtime::method_typeofScopeObjectProperty(ExecutionEngine *engine, const Value &context, int propertyIndex)
{
Scope scope(engine);
- ScopedValue prop(scope, method_getQmlScopeObjectProperty(engine, context, propertyIndex));
+ ScopedValue prop(scope, method_getQmlScopeObjectProperty(engine, context, propertyIndex, /*captureRequired*/true));
if (scope.engine->hasException)
return Encode::undefined();
return method_typeofValue(engine, prop);
@@ -1218,7 +1218,7 @@ ReturnedValue Runtime::method_typeofScopeObjectProperty(ExecutionEngine *engine,
ReturnedValue Runtime::method_typeofContextObjectProperty(ExecutionEngine *engine, const Value &context, int propertyIndex)
{
Scope scope(engine);
- ScopedValue prop(scope, method_getQmlContextObjectProperty(engine, context, propertyIndex));
+ ScopedValue prop(scope, method_getQmlContextObjectProperty(engine, context, propertyIndex, /*captureRequired*/true));
if (scope.engine->hasException)
return Encode::undefined();
return method_typeofValue(engine, prop);
@@ -1453,16 +1453,16 @@ QV4::ReturnedValue Runtime::method_getQmlAttachedProperty(ExecutionEngine *engin
return QV4::QObjectWrapper::getProperty(engine, attachedObject, propertyIndex, /*captureRequired*/true);
}
-ReturnedValue Runtime::method_getQmlScopeObjectProperty(ExecutionEngine *engine, const Value &context, int propertyIndex)
+ReturnedValue Runtime::method_getQmlScopeObjectProperty(ExecutionEngine *engine, const Value &context, int propertyIndex, bool captureRequired)
{
const QmlContext &c = static_cast<const QmlContext &>(context);
- return QV4::QObjectWrapper::getProperty(engine, c.d()->qml->scopeObject, propertyIndex, false);
+ return QV4::QObjectWrapper::getProperty(engine, c.d()->qml->scopeObject, propertyIndex, captureRequired);
}
-ReturnedValue Runtime::method_getQmlContextObjectProperty(ExecutionEngine *engine, const Value &context, int propertyIndex)
+ReturnedValue Runtime::method_getQmlContextObjectProperty(ExecutionEngine *engine, const Value &context, int propertyIndex, bool captureRequired)
{
const QmlContext &c = static_cast<const QmlContext &>(context);
- return QV4::QObjectWrapper::getProperty(engine, c.d()->qml->context->contextObject, propertyIndex, false);
+ return QV4::QObjectWrapper::getProperty(engine, c.d()->qml->context->contextObject, propertyIndex, captureRequired);
}
ReturnedValue Runtime::method_getQmlSingletonQObjectProperty(ExecutionEngine *engine, const Value &object, int propertyIndex, bool captureRequired)
diff --git a/src/qml/jsruntime/qv4runtime_p.h b/src/qml/jsruntime/qv4runtime_p.h
index 88c09ec5f9..a32b3f1663 100644
--- a/src/qml/jsruntime/qv4runtime_p.h
+++ b/src/qml/jsruntime/qv4runtime_p.h
@@ -60,8 +60,6 @@
QT_BEGIN_NAMESPACE
-class QQmlAccessors;
-
#undef QV4_COUNT_RUNTIME_FUNCTIONS
namespace QV4 {
diff --git a/src/qml/jsruntime/qv4runtimeapi_p.h b/src/qml/jsruntime/qv4runtimeapi_p.h
index 582cdcf4e9..040a545b83 100644
--- a/src/qml/jsruntime/qv4runtimeapi_p.h
+++ b/src/qml/jsruntime/qv4runtimeapi_p.h
@@ -327,8 +327,8 @@ struct Q_QML_PRIVATE_EXPORT Runtime {
RUNTIME_METHOD(ReturnedValue, getQmlImportedScripts, (NoThrowEngine *engine));
RUNTIME_METHOD(ReturnedValue, getQmlSingleton, (NoThrowEngine *engine, int nameIndex));
RUNTIME_METHOD(ReturnedValue, getQmlAttachedProperty, (ExecutionEngine *engine, int attachedPropertiesId, int propertyIndex));
- RUNTIME_METHOD(ReturnedValue, getQmlScopeObjectProperty, (ExecutionEngine *engine, const Value &context, int propertyIndex));
- RUNTIME_METHOD(ReturnedValue, getQmlContextObjectProperty, (ExecutionEngine *engine, const Value &context, int propertyIndex));
+ RUNTIME_METHOD(ReturnedValue, getQmlScopeObjectProperty, (ExecutionEngine *engine, const Value &context, int propertyIndex, bool captureRequired));
+ RUNTIME_METHOD(ReturnedValue, getQmlContextObjectProperty, (ExecutionEngine *engine, const Value &context, int propertyIndex, bool captureRequired));
RUNTIME_METHOD(ReturnedValue, getQmlQObjectProperty, (ExecutionEngine *engine, const Value &object, int propertyIndex, bool captureRequired));
RUNTIME_METHOD(ReturnedValue, getQmlSingletonQObjectProperty, (ExecutionEngine *engine, const Value &object, int propertyIndex, bool captureRequired));
RUNTIME_METHOD(ReturnedValue, getQmlIdObject, (ExecutionEngine *engine, const Value &context, uint index));
diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp
index 420abd1458..9d18713253 100644
--- a/src/qml/jsruntime/qv4vme_moth.cpp
+++ b/src/qml/jsruntime/qv4vme_moth.cpp
@@ -527,7 +527,7 @@ QV4::ReturnedValue VME::run(ExecutionEngine *engine, const uchar *code
MOTH_END_INSTR(StoreScopeObjectProperty)
MOTH_BEGIN_INSTR(LoadScopeObjectProperty)
- STOREVALUE(instr.result, engine->runtime.getQmlScopeObjectProperty(engine, VALUE(instr.base), instr.propertyIndex));
+ STOREVALUE(instr.result, engine->runtime.getQmlScopeObjectProperty(engine, VALUE(instr.base), instr.propertyIndex, instr.captureRequired));
MOTH_END_INSTR(LoadScopeObjectProperty)
MOTH_BEGIN_INSTR(StoreContextObjectProperty)
@@ -536,7 +536,7 @@ QV4::ReturnedValue VME::run(ExecutionEngine *engine, const uchar *code
MOTH_END_INSTR(StoreContextObjectProperty)
MOTH_BEGIN_INSTR(LoadContextObjectProperty)
- STOREVALUE(instr.result, engine->runtime.getQmlContextObjectProperty(engine, VALUE(instr.base), instr.propertyIndex));
+ STOREVALUE(instr.result, engine->runtime.getQmlContextObjectProperty(engine, VALUE(instr.base), instr.propertyIndex, instr.captureRequired));
MOTH_END_INSTR(LoadContextObjectProperty)
MOTH_BEGIN_INSTR(LoadIdObject)
diff --git a/src/qml/qml/qml.pri b/src/qml/qml/qml.pri
index 4244b16210..8d8da3742d 100644
--- a/src/qml/qml/qml.pri
+++ b/src/qml/qml/qml.pri
@@ -20,7 +20,6 @@ SOURCES += \
$$PWD/qqmlinfo.cpp \
$$PWD/qqmlerror.cpp \
$$PWD/qqmlvaluetype.cpp \
- $$PWD/qqmlaccessors.cpp \
$$PWD/qqmlxmlhttprequest.cpp \
$$PWD/qqmlcleanup.cpp \
$$PWD/qqmlpropertycache.cpp \
@@ -87,7 +86,6 @@ HEADERS += \
$$PWD/qqmldata_p.h \
$$PWD/qqmlerror.h \
$$PWD/qqmlvaluetype_p.h \
- $$PWD/qqmlaccessors_p.h \
$$PWD/qqmlxmlhttprequest_p.h \
$$PWD/qqmlcleanup_p.h \
$$PWD/qqmlpropertycache_p.h \
diff --git a/src/qml/qml/qqml.h b/src/qml/qml/qqml.h
index 8fb710ad9d..39764b8001 100644
--- a/src/qml/qml/qqml.h
+++ b/src/qml/qml/qqml.h
@@ -238,6 +238,9 @@ int qmlRegisterExtendedUncreatableType(const char *uri, int versionMajor, int ve
return QQmlPrivate::qmlregister(QQmlPrivate::TypeRegistration, &type);
}
+
+Q_QML_EXPORT int qmlRegisterUncreatableMetaObject(const QMetaObject &staticMetaObject, const char *uri, int versionMajor, int versionMinor, const char *qmlName, const QString& reason);
+
template<typename T>
int qmlRegisterType(const char *uri, int versionMajor, int versionMinor, const char *qmlName)
{
diff --git a/src/qml/qml/qqmlaccessors.cpp b/src/qml/qml/qqmlaccessors.cpp
deleted file mode 100644
index 7b0fafdc90..0000000000
--- a/src/qml/qml/qqmlaccessors.cpp
+++ /dev/null
@@ -1,105 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtQml module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qqmlaccessors_p.h"
-
-#include "qqmldata_p.h"
-#include "qqmlnotifier_p.h"
-
-QT_BEGIN_NAMESPACE
-
-struct AccessorProperties {
- AccessorProperties();
-
- QReadWriteLock lock;
- QHash<const QMetaObject *, QQmlAccessorProperties::Properties> properties;
-};
-
-Q_GLOBAL_STATIC(AccessorProperties, accessorProperties)
-
-static void buildNameMask(QQmlAccessorProperties::Properties &properties)
-{
- quint32 mask = 0;
-
- for (int ii = 0; ii < properties.count; ++ii) {
- Q_ASSERT(strlen(properties.properties[ii].name) == properties.properties[ii].nameLength);
- Q_ASSERT(properties.properties[ii].nameLength > 0);
-
- mask |= (1 << qMin(31U, properties.properties[ii].nameLength - 1));
- }
-
- properties.nameMask = mask;
-}
-
-AccessorProperties::AccessorProperties()
-{
-}
-
-QQmlAccessorProperties::Properties::Properties(Property *properties, int count)
-: count(count), properties(properties)
-{
- buildNameMask(*this);
-}
-
-QQmlAccessorProperties::Properties
-QQmlAccessorProperties::properties(const QMetaObject *mo)
-{
- AccessorProperties *This = accessorProperties();
-
- QReadLocker lock(&This->lock);
- return This->properties.value(mo);
-}
-
-void QQmlAccessorProperties::registerProperties(const QMetaObject *mo, int count,
- Property *props)
-{
- Q_ASSERT(count > 0);
-
- Properties properties(props, count);
-
- AccessorProperties *This = accessorProperties();
-
- QWriteLocker lock(&This->lock);
-
- Q_ASSERT(!This->properties.contains(mo) || This->properties.value(mo) == properties);
-
- This->properties.insert(mo, properties);
-}
-
-QT_END_NAMESPACE
diff --git a/src/qml/qml/qqmlaccessors_p.h b/src/qml/qml/qqmlaccessors_p.h
deleted file mode 100644
index e98663adfe..0000000000
--- a/src/qml/qml/qqmlaccessors_p.h
+++ /dev/null
@@ -1,182 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtQml module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQMLACCESSORS_P_H
-#define QQMLACCESSORS_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <private/qtqmlglobal_p.h>
-#include <QtCore/qbytearray.h>
-#include <QtCore/qvector.h>
-#include <QtCore/qhash.h>
-#include <QtCore/QReadWriteLock>
-
-#if defined(Q_OS_QNX) || defined(Q_OS_LINUX)
-#include <stdint.h>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-class QObject;
-struct QMetaObject;
-class QQmlNotifier;
-
-// QML "accessor properties" allow V4 and V8 to bypass Qt's meta system to read and, more
-// importantly, subscribe to properties directly. Any property that is primarily read
-// from bindings is a candidate for inclusion as an accessor property.
-//
-// To define accessor properties, use the QML_DECLARE_PROPERTIES() and QML_DEFINE_PROPERTIES()
-// macros. The QML_DECLARE_PROPERTIES() macro is used to specify the properties, and the
-// QML_DEFINE_PROPERTIES() macro to register the properties with the
-// QQmlAccessorProperties singleton.
-//
-// A class with accessor properties must also add the Q_CLASSINFO("qt_HasQmlAccessors", "true")
-// tag to its declaration. This is essential for QML to maintain internal consistency,
-// and forgetting to do so will probably cause your application to qFatal() with a
-// helpful reminder of this requirement.
-//
-// It is important that QML_DEFINE_PROPERTIES() has been called before QML ever sees
-// the type with the accessor properties. As QML_DEFINE_PROPERTIES() is idempotent, it is
-// recommended to call it in the type's constructor as well as when the type is registered
-// as a QML element (if it ever is). QML_DEFINE_PROPERTIES() is a very cheap operation
-// if registration has already occurred.
-
-#define QML_DECLARE_PROPERTIES(type) \
- static volatile bool qqml_accessor_properties_isregistered_ ## type = false; \
- static QQmlAccessorProperties::Property qqml_accessor_properties_ ## type[] =
-
-#define QML_DEFINE_PROPERTIES(type) \
- do { \
- if (!qqml_accessor_properties_isregistered_ ## type) { \
- int count = sizeof(qqml_accessor_properties_ ## type) / \
- sizeof(QQmlAccessorProperties::Property); \
- QQmlAccessorProperties::registerProperties(&type::staticMetaObject, count, \
- qqml_accessor_properties_ ## type);\
- qqml_accessor_properties_isregistered_ ## type = true; \
- } \
- } while (false);
-
-#define QML_PRIVATE_ACCESSOR(clazz, cpptype, name, variable, setter) \
- static void clazz ## _ ## name ## Read(QObject *o, void *rv) \
- { \
- clazz ## Private *d = clazz ## Private::get(static_cast<clazz *>(o)); \
- *static_cast<cpptype *>(rv) = d->variable; \
- } \
- static void clazz ## _ ## name ## Write(QObject *o, void *rv) \
- { \
- static_cast<clazz *>(o)->setter(*static_cast<cpptype *>(rv)); \
- }
-
-#define QML_PROPERTY_NAME(name) #name, sizeof #name - 1
-
-class QQmlAccessors
-{
-public:
- void (*read)(QObject *object, void *output);
- void (*write)(QObject *object, void *output);
- void (*notifier)(QObject *object, QQmlNotifier **notifier);
-};
-
-namespace QQmlAccessorProperties {
- struct Property {
- const char *name;
- unsigned int nameLength;
- qintptr data;
- QQmlAccessors *accessors;
- };
-
- struct Properties {
- inline Properties();
- Properties(Property *, int);
-
- bool operator==(const Properties &o) const {
- return count == o.count && properties == o.properties;
- }
-
- inline Property *property(const char *name);
-
- int count;
- Property *properties;
- quint32 nameMask;
- };
-
- Properties properties(const QMetaObject *);
- void Q_QML_PRIVATE_EXPORT registerProperties(const QMetaObject *, int, Property *);
-};
-
-QQmlAccessorProperties::Property *
-QQmlAccessorProperties::Properties::property(const char *name)
-{
- if (count == 0)
- return 0;
-
- const unsigned int length = (unsigned int)strlen(name);
-
- Q_ASSERT(length);
-
- if (nameMask & (1 << qMin(31U, length - 1))) {
-
- for (int ii = 0; ii < count; ++ii) {
- if (properties[ii].nameLength == length && 0 == qstrcmp(name, properties[ii].name))
- return &properties[ii];
- }
-
- }
-
- return 0;
-}
-
-QQmlAccessorProperties::Properties::Properties()
-: count(0), properties(0), nameMask(0)
-{
-}
-
-QT_END_NAMESPACE
-
-#endif // QQMLACCESSORS_P_H
diff --git a/src/qml/qml/qqmlbinding.cpp b/src/qml/qml/qqmlbinding.cpp
index d944857fc1..90698c3b24 100644
--- a/src/qml/qml/qqmlbinding.cpp
+++ b/src/qml/qml/qqmlbinding.cpp
@@ -43,7 +43,6 @@
#include "qqmlcontext.h"
#include "qqmlinfo.h"
#include "qqmldata_p.h"
-#include "qqmlaccessors_p.h"
#include <private/qqmlprofiler_p.h>
#include <private/qqmlexpression_p.h>
#include <private/qqmlscriptstring_p.h>
@@ -253,6 +252,8 @@ protected:
}
+ cancelPermanentGuards();
+
ep->dereferenceScarceResources();
}
diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp
index 25bb52ad2b..01f1f93b81 100644
--- a/src/qml/qml/qqmlengine.cpp
+++ b/src/qml/qml/qqmlengine.cpp
@@ -116,6 +116,39 @@ void qmlRegisterBaseTypes(const char *uri, int versionMajor, int versionMinor)
QQmlValueTypeFactory::registerValueTypes(uri, versionMajor, versionMinor);
}
+// Declared in qqml.h
+int qmlRegisterUncreatableMetaObject(const QMetaObject &staticMetaObject,
+ const char *uri, int versionMajor,
+ int versionMinor, const char *qmlName,
+ const QString& reason)
+{
+ QQmlPrivate::RegisterType type = {
+ 0,
+
+ 0,
+ 0,
+ 0,
+ Q_NULLPTR,
+ reason,
+
+ uri, versionMajor, versionMinor, qmlName, &staticMetaObject,
+
+ QQmlAttachedPropertiesFunc(),
+ Q_NULLPTR,
+
+ 0,
+ 0,
+ 0,
+
+ Q_NULLPTR, Q_NULLPTR,
+
+ Q_NULLPTR,
+ 0
+ };
+
+ return QQmlPrivate::qmlregister(QQmlPrivate::TypeRegistration, &type);
+}
+
/*!
\qmltype QtObject
\instantiates QObject
diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp
index 9b78ac6526..4c5179dc75 100644
--- a/src/qml/qml/qqmlimport.cpp
+++ b/src/qml/qml/qqmlimport.cpp
@@ -1732,29 +1732,32 @@ QString QQmlImportDatabase::resolvePlugin(QQmlTypeLoader *typeLoader,
const QString &baseName)
{
#if defined(Q_OS_WIN)
- return resolvePlugin(typeLoader, qmldirPath, qmldirPluginPath, baseName,
- QStringList()
+ static const QString prefix;
+ static const QStringList suffixes = {
# ifdef QT_DEBUG
- << QLatin1String("d.dll") // try a qmake-style debug build first
+ QLatin1String("d.dll"), // try a qmake-style debug build first
# endif
- << QLatin1String(".dll"));
+ QLatin1String(".dll")
+ };
#elif defined(Q_OS_DARWIN)
-
- return resolvePlugin(typeLoader, qmldirPath, qmldirPluginPath, baseName,
- QStringList()
+ static const QString prefix = QLatin1String("lib");
+ static const QStringList suffixes = {
# ifdef QT_DEBUG
- << QLatin1String("_debug.dylib") // try a qmake-style debug build first
- << QLatin1String(".dylib")
+ QLatin1String("_debug.dylib"), // try a qmake-style debug build first
+ QLatin1String(".dylib"),
# else
- << QLatin1String(".dylib")
- << QLatin1String("_debug.dylib") // try a qmake-style debug build after
+ QLatin1String(".dylib"),
+ QLatin1String("_debug.dylib"), // try a qmake-style debug build after
# endif
- << QLatin1String(".so")
- << QLatin1String(".bundle"),
- QLatin1String("lib"));
+ QLatin1String(".so"),
+ QLatin1String(".bundle")
+ };
# else // Unix
- return resolvePlugin(typeLoader, qmldirPath, qmldirPluginPath, baseName, QStringList() << QLatin1String(".so"), QLatin1String("lib"));
+ static const QString prefix = QLatin1String("lib");
+ static const QStringList suffixes = { QLatin1String(".so") };
#endif
+
+ return resolvePlugin(typeLoader, qmldirPath, qmldirPluginPath, baseName, suffixes, prefix);
}
/*!
diff --git a/src/qml/qml/qqmljavascriptexpression.cpp b/src/qml/qml/qqmljavascriptexpression.cpp
index ebc4d49c36..8020bdb2be 100644
--- a/src/qml/qml/qqmljavascriptexpression.cpp
+++ b/src/qml/qml/qqmljavascriptexpression.cpp
@@ -115,12 +115,17 @@ QQmlJavaScriptExpression::~QQmlJavaScriptExpression()
void QQmlJavaScriptExpression::setNotifyOnValueChanged(bool v)
{
activeGuards.setFlagValue(v);
- if (!v) clearActiveGuards();
+ permanentGuards.setFlagValue(v);
+ if (!v) {
+ clearActiveGuards();
+ clearPermanentGuards();
+ m_permanentDependenciesRegistered = false;
+ }
}
void QQmlJavaScriptExpression::resetNotifyOnValueChanged()
{
- clearActiveGuards();
+ setNotifyOnValueChanged(false);
}
void QQmlJavaScriptExpression::setContext(QQmlContextData *context)
@@ -429,6 +434,7 @@ void QQmlJavaScriptExpression::clearActiveGuards()
void QQmlJavaScriptExpression::clearPermanentGuards()
{
+ m_permanentDependenciesRegistered = false;
while (QQmlJavaScriptExpressionGuard *g = permanentGuards.takeFirst())
g->Delete();
}
diff --git a/src/qml/qml/qqmljavascriptexpression_p.h b/src/qml/qml/qqmljavascriptexpression_p.h
index a5c7a80153..5f9cffb56d 100644
--- a/src/qml/qml/qqmljavascriptexpression_p.h
+++ b/src/qml/qml/qqmljavascriptexpression_p.h
@@ -146,6 +146,14 @@ public:
protected:
void createQmlBinding(QQmlContextData *ctxt, QObject *scope, const QString &code, const QString &filename, quint16 line);
+ void cancelPermanentGuards() const
+ {
+ if (m_permanentDependenciesRegistered) {
+ for (QQmlJavaScriptExpressionGuard *it = permanentGuards.first(); it; it = permanentGuards.next(it))
+ it->cancelNotify();
+ }
+ }
+
private:
friend class QQmlContextData;
friend class QQmlPropertyCapture;
diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp
index e02d362815..2218f277d6 100644
--- a/src/qml/qml/qqmlobjectcreator.cpp
+++ b/src/qml/qml/qqmlobjectcreator.cpp
@@ -54,7 +54,6 @@
#include <private/qqmlscriptstring_p.h>
#include <private/qqmlpropertyvalueinterceptor_p.h>
#include <private/qqmlvaluetypeproxybinding_p.h>
-#include <private/qqmlaccessors_p.h>
QT_USE_NAMESPACE
diff --git a/src/qml/qml/qqmlpropertycache.cpp b/src/qml/qml/qqmlpropertycache.cpp
index ed00eddb30..337c37b5be 100644
--- a/src/qml/qml/qqmlpropertycache.cpp
+++ b/src/qml/qml/qqmlpropertycache.cpp
@@ -45,7 +45,6 @@
#include <private/qv8engine_p.h>
#include <private/qmetaobject_p.h>
-#include <private/qqmlaccessors_p.h>
#include <private/qmetaobjectbuilder_p.h>
#include <private/qv4value_p.h>
@@ -500,35 +499,16 @@ void QQmlPropertyCache::append(const QMetaObject *metaObject,
int signalCount = metaObjectSignalCount(metaObject);
int classInfoCount = QMetaObjectPrivate::get(metaObject)->classInfoCount;
- QQmlAccessorProperties::Properties accessorProperties;
-
if (classInfoCount) {
int classInfoOffset = metaObject->classInfoOffset();
- bool hasFastProperty = false;
for (int ii = 0; ii < classInfoCount; ++ii) {
int idx = ii + classInfoOffset;
QMetaClassInfo mci = metaObject->classInfo(idx);
const char *name = mci.name();
- if (0 == qstrcmp(name, "qt_HasQmlAccessors")) {
- hasFastProperty = true;
- } else if (0 == qstrcmp(name, "DefaultProperty")) {
+ if (0 == qstrcmp(name, "DefaultProperty")) {
_defaultPropertyName = QString::fromUtf8(mci.value());
}
}
-
- if (hasFastProperty) {
- accessorProperties = QQmlAccessorProperties::properties(metaObject);
- if (accessorProperties.count == 0)
- qFatal("QQmlPropertyCache: %s has FastProperty class info, but has not "
- "installed property accessors", metaObject->className());
- } else {
-#ifndef QT_NO_DEBUG
- accessorProperties = QQmlAccessorProperties::properties(metaObject);
- if (accessorProperties.count != 0)
- qFatal("QQmlPropertyCache: %s has fast property accessors, but is missing "
- "FastProperty class info", metaObject->className());
-#endif
- }
}
//Used to block access to QObject::destroyed() and QObject::deleteLater() from QML
@@ -1111,9 +1091,21 @@ QQmlPropertyCache::property(QJSEngine *engine, QObject *obj,
return qQmlPropertyCacheProperty<const QString &>(engine, obj, name, context, local);
}
+// these two functions are copied from qmetaobject.cpp
static inline const QMetaObjectPrivate *priv(const uint* data)
{ return reinterpret_cast<const QMetaObjectPrivate*>(data); }
+static inline const QByteArray stringData(const QMetaObject *mo, int index)
+{
+ Q_ASSERT(priv(mo->d.data)->revision >= 7);
+ const QByteArrayDataPtr data = { const_cast<QByteArrayData*>(&mo->d.stringdata[index]) };
+ Q_ASSERT(data.ptr->ref.isStatic());
+ Q_ASSERT(data.ptr->alloc == 0);
+ Q_ASSERT(data.ptr->capacityReserved == 0);
+ Q_ASSERT(data.ptr->size >= 0);
+ return data;
+}
+
bool QQmlPropertyCache::isDynamicMetaObject(const QMetaObject *mo)
{
return priv(mo->d.data)->revision >= 3 && priv(mo->d.data)->flags & DynamicMetaObject;
@@ -1419,8 +1411,7 @@ bool QQmlPropertyCache::addToHash(QCryptographicHash &hash, const QMetaObject &m
hash.addData(reinterpret_cast<const char *>(mo.d.data), fieldCount * sizeof(uint));
for (int i = 0; i < stringCount; ++i) {
- const QByteArrayDataPtr data = { const_cast<QByteArrayData*>(&mo.d.stringdata[i]) };
- hash.addData(QByteArray(data));
+ hash.addData(stringData(&mo, i));
}
return true;
diff --git a/src/qml/qml/qqmlpropertycache_p.h b/src/qml/qml/qqmlpropertycache_p.h
index f28b2d0599..4da02037fa 100644
--- a/src/qml/qml/qqmlpropertycache_p.h
+++ b/src/qml/qml/qqmlpropertycache_p.h
@@ -62,7 +62,6 @@
#include <QtCore/qvector.h>
#include <private/qv4value_p.h>
-#include <private/qqmlaccessors_p.h>
#include <limits>
@@ -73,7 +72,6 @@ class QMetaProperty;
class QQmlEngine;
class QJSEngine;
class QQmlPropertyData;
-class QQmlAccessors;
class QMetaObjectBuilder;
class QQmlPropertyCacheMethodArguments;
class QQmlVMEMetaObject;
@@ -159,7 +157,6 @@ public:
bool isFinal() const { return _flags.isFinal; }
bool isOverridden() const { return _flags.isOverridden; }
bool isDirect() const { return _flags.isDirect; }
- bool hasAccessors() const { return accessors() != nullptr; }
bool hasStaticMetaCallFunction() const { return staticMetaCallFunction() != nullptr; }
bool isFunction() const { return _flags.type == Flags::FunctionType; }
bool isQObject() const { return _flags.type == Flags::QObjectDerivedType; }
@@ -240,8 +237,6 @@ public:
_metaObjectOffset = qint16(off);
}
- QQmlAccessors *accessors() const { return nullptr; } // TODO: remove in subsequent patch
-
StaticMetaCallFunction staticMetaCallFunction() const { return _staticMetaCallFunction; }
void trySetStaticMetaCallFunction(StaticMetaCallFunction f, unsigned relativePropertyIndex)
{
diff --git a/src/qml/qml/v8/qv8engine.cpp b/src/qml/qml/v8/qv8engine.cpp
index e08ff3b979..f15020f6c9 100644
--- a/src/qml/qml/v8/qv8engine.cpp
+++ b/src/qml/qml/v8/qv8engine.cpp
@@ -160,10 +160,9 @@ QV8Engine::~QV8Engine()
qDeleteAll(m_extensionData);
m_extensionData.clear();
-#if !defined(QT_NO_XMLSTREAMREADER) && defined(QT_NO_NETWORK)
qt_rem_qmlxmlhttprequest(m_v4Engine, m_xmlHttpRequestData);
m_xmlHttpRequestData = 0;
-#endif
+
delete m_listModelData;
m_listModelData = 0;