summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-06-16 04:32:04 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-06-16 04:32:04 (GMT)
commit1e5dd7d82d542527ca9e650f78a5e25b6a3ebc41 (patch)
tree8dbb71c3feb65c1ad78018bbea27974b8177d66f /src/declarative
parentc9fd96774ced98da4145259d132a2c305dd3e6a9 (diff)
downloadQt-1e5dd7d82d542527ca9e650f78a5e25b6a3ebc41.zip
Qt-1e5dd7d82d542527ca9e650f78a5e25b6a3ebc41.tar.gz
Qt-1e5dd7d82d542527ca9e650f78a5e25b6a3ebc41.tar.bz2
Deferred properties mostly work.
However, they still don't honour the presence of an id property.
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/qml/qmlengine.cpp9
-rw-r--r--src/declarative/qml/qmlvme.cpp38
-rw-r--r--src/declarative/qml/qmlvme_p.h4
3 files changed, 39 insertions, 12 deletions
diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp
index a43b9b9..36b6424 100644
--- a/src/declarative/qml/qmlengine.cpp
+++ b/src/declarative/qml/qmlengine.cpp
@@ -71,7 +71,7 @@
#include <qmlcomponent.h>
#include "private/qmlmetaproperty_p.h"
#include <private/qmlbindablevalue_p.h>
-
+#include <private/qmlvme_p.h>
QT_BEGIN_NAMESPACE
@@ -710,7 +710,12 @@ void qmlExecuteDeferred(QObject *object)
{
QmlInstanceDeclarativeData *data = QmlInstanceDeclarativeData::get(object);
- if (data) {
+ if (data && data->deferredComponent) {
+ QmlVME vme;
+ vme.runDeferred(object);
+
+ data->deferredComponent->release();
+ data->deferredComponent = 0;
}
}
diff --git a/src/declarative/qml/qmlvme.cpp b/src/declarative/qml/qmlvme.cpp
index e65b206..ccf12b0 100644
--- a/src/declarative/qml/qmlvme.cpp
+++ b/src/declarative/qml/qmlvme.cpp
@@ -89,16 +89,11 @@ QmlVME::QmlVME()
struct ListInstance
{
ListInstance() {}
- /*
- ListInstance(const QVariant &l, int t)
- : list(l), type(t), qmlListInterface(0) {}
- */
ListInstance(QList<void *> *q, int t)
: type(t), qListInterface(q), qmlListInterface(0) {}
ListInstance(QmlPrivate::ListInterface *q, int t)
: type(t), qListInterface(0), qmlListInterface(q) {}
- //QVariant list;
int type;
QList<void *> *qListInterface;
QmlPrivate::ListInterface *qmlListInterface;
@@ -106,6 +101,35 @@ struct ListInstance
QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, int count)
{
+ QStack<QObject *> stack;
+
+ if (start == -1) start = 0;
+ if (count == -1) count = comp->bytecode.count();
+
+ return run(stack, ctxt, comp, start, count);
+}
+
+void QmlVME::runDeferred(QObject *object)
+{
+ QmlInstanceDeclarativeData *data = QmlInstanceDeclarativeData::get(object);
+
+ if (!data || !data->context || !data->deferredComponent)
+ return;
+
+ QmlContext *ctxt = data->context;
+ ctxt->activate();
+ QmlCompiledComponent *comp = data->deferredComponent;
+ int start = data->deferredIdx + 1;
+ int count = data->deferredComponent->bytecode.at(data->deferredIdx).defer.deferCount;
+ QStack<QObject *> stack;
+ stack.push(object);
+
+ run(stack, ctxt, comp, start, count);
+ ctxt->deactivate();
+}
+
+QObject *QmlVME::run(QStack<QObject *> &stack, QmlContext *ctxt, QmlCompiledComponent *comp, int start, int count)
+{
// XXX - All instances of QmlContext::activeContext() here should be
// replaced with the use of ctxt. However, this cannot be done until
// behaviours stop modifying the active context and expecting the
@@ -126,7 +150,6 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
QmlEnginePrivate::SimpleList<QmlBindableValue> bindValues;
QmlEnginePrivate::SimpleList<QmlParserStatus> parserStatus;
- QStack<QObject *> stack;
QStack<ListInstance> qliststack;
QStack<QmlMetaProperty> pushedProperties;
@@ -134,9 +157,6 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
vmeErrors.clear();
- if (start == -1) start = 0;
- if (count == -1) count = comp->bytecode.count();
-
for (int ii = start; !isError() && ii < (start + count); ++ii) {
QmlInstruction &instr = comp->bytecode[ii];
diff --git a/src/declarative/qml/qmlvme_p.h b/src/declarative/qml/qmlvme_p.h
index f2ed576..149c82c 100644
--- a/src/declarative/qml/qmlvme_p.h
+++ b/src/declarative/qml/qmlvme_p.h
@@ -58,12 +58,14 @@ class QmlVME
public:
QmlVME();
- QObject *run(QmlContext *, QmlCompiledComponent *, int start = -1, int end = -1);
+ QObject *run(QmlContext *, QmlCompiledComponent *, int start = -1, int count = -1);
+ void runDeferred(QObject *);
bool isError() const;
QList<QmlError> errors() const;
private:
+ QObject *run(QStack<QObject *> &, QmlContext *, QmlCompiledComponent *, int start, int count);
QList<QmlError> vmeErrors;
};