summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2009-10-27 06:30:08 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2009-10-27 06:30:08 (GMT)
commitd72970e54390f00be28efaac148b55f027a1eb69 (patch)
treeefeb095eebca0c2cf29391d08f3bc58d5baa1f68 /src/declarative/qml
parentfc4dd3eab91fc1959e216a754620a96cf05932d7 (diff)
parentf2c0f63c2db21e3a0dd2fb78312084a835840be8 (diff)
downloadQt-d72970e54390f00be28efaac148b55f027a1eb69.zip
Qt-d72970e54390f00be28efaac148b55f027a1eb69.tar.gz
Qt-d72970e54390f00be28efaac148b55f027a1eb69.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src/declarative/qml')
-rw-r--r--src/declarative/qml/qmlbasicscript.cpp2
-rw-r--r--src/declarative/qml/qmlcompiler.cpp2
-rw-r--r--src/declarative/qml/qmlcontext.cpp21
-rw-r--r--src/declarative/qml/qmlcontext_p.h6
-rw-r--r--src/declarative/qml/qmlcontextscriptclass.cpp2
-rw-r--r--src/declarative/qml/qmlengine.cpp2
-rw-r--r--src/declarative/qml/qmlexpression.cpp10
7 files changed, 12 insertions, 33 deletions
diff --git a/src/declarative/qml/qmlbasicscript.cpp b/src/declarative/qml/qmlbasicscript.cpp
index b7aac54..eba4307 100644
--- a/src/declarative/qml/qmlbasicscript.cpp
+++ b/src/declarative/qml/qmlbasicscript.cpp
@@ -658,7 +658,7 @@ QVariant QmlBasicScript::run(QmlContext *context, QObject *me)
case ScriptInstruction::FetchRootConstant:
{
- QObject *obj = contextPrivate->defaultObjects.last();
+ QObject *obj = contextPrivate->defaultObjects.at(0);
stack.push(fetch_value(obj, instr.constant.idx, instr.constant.type));
if (obj && instr.constant.notify != 0)
diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp
index 69ebf9c..60282dc 100644
--- a/src/declarative/qml/qmlcompiler.cpp
+++ b/src/declarative/qml/qmlcompiler.cpp
@@ -1687,7 +1687,7 @@ bool QmlCompiler::buildGroupedProperty(QmlParser::Property *prop,
if (prop->type < (int)QVariant::UserType) {
QmlEnginePrivate *ep =
static_cast<QmlEnginePrivate *>(QObjectPrivate::get(engine));
- if (ep->valueTypes[prop->type]) {
+ if (prop->type >= 0 /* QVariant == -1 */ && ep->valueTypes[prop->type]) {
COMPILE_CHECK(buildValueTypeProperty(ep->valueTypes[prop->type],
prop->value, obj, ctxt.incr()));
obj->addValueTypeProperty(prop);
diff --git a/src/declarative/qml/qmlcontext.cpp b/src/declarative/qml/qmlcontext.cpp
index 7ba3544..2ebdf10 100644
--- a/src/declarative/qml/qmlcontext.cpp
+++ b/src/declarative/qml/qmlcontext.cpp
@@ -50,9 +50,6 @@
#include <private/qmlbindingoptimizations_p.h>
#include <QtDeclarative/qmlinfo.h>
-// 6-bits
-#define MAXIMUM_DEFAULT_OBJECTS 63
-
QT_BEGIN_NAMESPACE
QmlContextPrivate::QmlContextPrivate()
@@ -130,22 +127,6 @@ void QmlContextPrivate::init()
parent->d_func()->childContexts.insert(q);
}
-void QmlContextPrivate::addDefaultObject(QObject *object, Priority priority)
-{
- if (defaultObjects.count() >= (MAXIMUM_DEFAULT_OBJECTS - 1)) {
- qWarning("QmlContext: Cannot have more than %d default objects on "
- "one bind context.", MAXIMUM_DEFAULT_OBJECTS - 1);
- return;
- }
-
- if (priority == HighPriority) {
- defaultObjects.insert(highPriorityCount++, object);
- } else {
- defaultObjects.append(object);
- }
-}
-
-
/*!
\class QmlContext
\brief The QmlContext class defines a context within a QML engine.
@@ -366,7 +347,7 @@ QmlContext *QmlContext::parentContext() const
void QmlContext::addDefaultObject(QObject *defaultObject)
{
Q_D(QmlContext);
- d->addDefaultObject(defaultObject, QmlContextPrivate::NormalPriority);
+ d->defaultObjects.prepend(defaultObject);
}
/*!
diff --git a/src/declarative/qml/qmlcontext_p.h b/src/declarative/qml/qmlcontext_p.h
index be7bf1d..6af5f64 100644
--- a/src/declarative/qml/qmlcontext_p.h
+++ b/src/declarative/qml/qmlcontext_p.h
@@ -104,12 +104,6 @@ public:
void dump();
void dump(int depth);
- enum Priority {
- HighPriority,
- NormalPriority
- };
- void addDefaultObject(QObject *, Priority);
-
void invalidateEngines();
QSet<QmlContext *> childContexts;
diff --git a/src/declarative/qml/qmlcontextscriptclass.cpp b/src/declarative/qml/qmlcontextscriptclass.cpp
index 4df23f0..a978df2 100644
--- a/src/declarative/qml/qmlcontextscriptclass.cpp
+++ b/src/declarative/qml/qmlcontextscriptclass.cpp
@@ -155,7 +155,7 @@ QmlContextScriptClass::queryProperty(QmlContext *bindContext, QObject *scopeObje
}
}
- for (int ii = 0; ii < cp->defaultObjects.count(); ++ii) {
+ for (int ii = cp->defaultObjects.count() - 1; ii >= 0; --ii) {
QScriptClass::QueryFlags rv =
ep->objectClass->queryProperty(cp->defaultObjects.at(ii), name, flags, bindContext);
diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp
index ab3c23a..0e239ce 100644
--- a/src/declarative/qml/qmlengine.cpp
+++ b/src/declarative/qml/qmlengine.cpp
@@ -476,6 +476,8 @@ QmlEngine *qmlEngine(const QObject *obj)
QObject *qmlAttachedPropertiesObjectById(int id, const QObject *object, bool create)
{
QmlDeclarativeData *data = QmlDeclarativeData::get(object);
+ if (!data)
+ return 0; // Attached properties are only on objects created by QML
QObject *rv = data->attachedProperties?data->attachedProperties->value(id):0;
if (rv || !create)
diff --git a/src/declarative/qml/qmlexpression.cpp b/src/declarative/qml/qmlexpression.cpp
index 3b89a23..c62756b 100644
--- a/src/declarative/qml/qmlexpression.cpp
+++ b/src/declarative/qml/qmlexpression.cpp
@@ -293,8 +293,7 @@ QVariant QmlExpressionPrivate::evalQtScript(QObject *secondaryScope, bool *isUnd
QmlEnginePrivate *ep = QmlEnginePrivate::get(engine);
if (secondaryScope)
- ctxtPriv->defaultObjects.insert(ctxtPriv->highPriorityCount,
- secondaryScope);
+ ctxtPriv->defaultObjects.append(secondaryScope);
QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine);
@@ -328,8 +327,11 @@ QVariant QmlExpressionPrivate::evalQtScript(QObject *secondaryScope, bool *isUnd
return QVariant();
}
- if (secondaryScope)
- ctxtPriv->defaultObjects.removeAt(ctxtPriv->highPriorityCount);
+ if (secondaryScope) {
+ QObject *last = ctxtPriv->defaultObjects.takeLast();
+ Q_ASSERT(last == secondaryScope);
+ Q_UNUSED(last);
+ }
QVariant rv;