summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml
diff options
context:
space:
mode:
authorBea Lam <bea.lam@nokia.com>2009-09-23 07:31:22 (GMT)
committerBea Lam <bea.lam@nokia.com>2009-09-23 07:31:22 (GMT)
commitc646730ca4ef1795973d578a95413ab4c4671a93 (patch)
tree3365cb2cb8df8c0178913c4dd9ea922365df8330 /src/declarative/qml
parent857f3f1466cb4ba57eca2d39d5515e2655a8c617 (diff)
parent04cf065afd6d0f5025cad58984ee4bad8e43bf76 (diff)
downloadQt-c646730ca4ef1795973d578a95413ab4c4671a93.zip
Qt-c646730ca4ef1795973d578a95413ab4c4671a93.tar.gz
Qt-c646730ca4ef1795973d578a95413ab4c4671a93.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/qmlengine.cpp3
-rw-r--r--src/declarative/qml/qmlmetaproperty.cpp18
-rw-r--r--src/declarative/qml/qmlmetaproperty_p.h6
3 files changed, 21 insertions, 6 deletions
diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp
index a58b35e..72603ed 100644
--- a/src/declarative/qml/qmlengine.cpp
+++ b/src/declarative/qml/qmlengine.cpp
@@ -1255,7 +1255,8 @@ QmlTypeNameScriptClass::queryProperty(const QScriptValue &scriptObject,
} else {
// Must be an attached property
this->object = qmlAttachedPropertiesObjectById(bridge.type->index(), bridge.object);
- Q_ASSERT(this->object);
+ if (!this->object)
+ return 0;
return ep->queryObject(strName, id, this->object);
}
}
diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp
index 91769d3..efc4a2b 100644
--- a/src/declarative/qml/qmlmetaproperty.cpp
+++ b/src/declarative/qml/qmlmetaproperty.cpp
@@ -119,6 +119,7 @@ QmlMetaObjectCache::property(const QString &name, const QMetaObject *metaObject)
QmlMetaProperty::QmlMetaProperty()
: d(new QmlMetaPropertyPrivate)
{
+ d->q = this;
}
/*!
@@ -134,7 +135,9 @@ QmlMetaProperty::~QmlMetaProperty()
default property, an invalid QmlMetaProperty will be created.
*/
QmlMetaProperty::QmlMetaProperty(QObject *obj)
+: d(new QmlMetaPropertyPrivate)
{
+ d->q = this;
d->initDefault(obj);
}
@@ -146,6 +149,7 @@ QmlMetaProperty::QmlMetaProperty(QObject *obj)
QmlMetaProperty::QmlMetaProperty(QObject *obj, QmlContext *ctxt)
: d(new QmlMetaPropertyPrivate)
{
+ d->q = this;
d->context = ctxt;
d->initDefault(obj);
}
@@ -175,6 +179,7 @@ void QmlMetaPropertyPrivate::initDefault(QObject *obj)
QmlMetaProperty::QmlMetaProperty(QObject *obj, int idx, QmlContext *ctxt)
: d(new QmlMetaPropertyPrivate)
{
+ d->q = this;
d->context = ctxt;
d->object = obj;
d->type = Property;
@@ -191,6 +196,7 @@ QmlMetaProperty::QmlMetaProperty(QObject *obj, int idx, QmlContext *ctxt)
QmlMetaProperty::QmlMetaProperty(QObject *obj, const QString &name)
: d(new QmlMetaPropertyPrivate)
{
+ d->q = this;
d->initProperty(obj, name);
}
@@ -201,6 +207,7 @@ QmlMetaProperty::QmlMetaProperty(QObject *obj, const QString &name)
QmlMetaProperty::QmlMetaProperty(QObject *obj, const QString &name, QmlContext *ctxt)
: d(new QmlMetaPropertyPrivate)
{
+ d->q = this;
d->context = ctxt;
d->initProperty(obj, name);
}
@@ -276,6 +283,7 @@ void QmlMetaPropertyPrivate::initProperty(QObject *obj, const QString &name)
QmlMetaProperty::QmlMetaProperty(const QmlMetaProperty &other)
: d(new QmlMetaPropertyPrivate(*other.d))
{
+ d->q = this;
}
/*!
@@ -560,9 +568,10 @@ QmlMetaProperty::setBinding(QmlAbstractBinding *newBinding) const
if (!isProperty() || (type() & Attached) || !d->object)
return 0;
- QmlDeclarativeData *data = QmlDeclarativeData::get(d->object, true);
+ QmlDeclarativeData *data =
+ QmlDeclarativeData::get(d->object, 0 != newBinding);
- if (data->hasBindingBit(d->coreIdx)) {
+ if (data && data->hasBindingBit(d->coreIdx)) {
QmlAbstractBinding *binding = data->bindings;
while (binding) {
// ### This wont work for value types
@@ -584,7 +593,6 @@ QmlMetaProperty::setBinding(QmlAbstractBinding *newBinding) const
return 0;
}
-
/*!
Returns the expression associated with this signal property, or 0 if no
signal expression exists.
@@ -743,6 +751,10 @@ void QmlMetaPropertyPrivate::writeValueProperty(const QVariant &value,
int writeBackIdx = -1;
bool deleteWriteBack = false;
+ // Remove any existing bindings on this property
+ if (source != QmlMetaProperty::Binding)
+ delete q->setBinding(0);
+
if (type & QmlMetaProperty::ValueTypeProperty) {
QmlEnginePrivate *ep = context?static_cast<QmlEnginePrivate *>(QObjectPrivate::get(context->engine())):0;
diff --git a/src/declarative/qml/qmlmetaproperty_p.h b/src/declarative/qml/qmlmetaproperty_p.h
index f2d0039..1ccf913 100644
--- a/src/declarative/qml/qmlmetaproperty_p.h
+++ b/src/declarative/qml/qmlmetaproperty_p.h
@@ -85,16 +85,18 @@ class QmlMetaPropertyPrivate
{
public:
QmlMetaPropertyPrivate()
- : context(0), coreIdx(-1), valueTypeIdx(-1), valueTypeId(0),
+ : q(0), context(0), coreIdx(-1), valueTypeIdx(-1), valueTypeId(0),
type(QmlMetaProperty::Invalid), attachedFunc(-1),
object(0), propType(-1), category(QmlMetaProperty::Unknown) {}
QmlMetaPropertyPrivate(const QmlMetaPropertyPrivate &other)
- : name(other.name), signal(other.signal), context(other.context),
+ : q(0), name(other.name), signal(other.signal), context(other.context),
coreIdx(other.coreIdx), valueTypeIdx(other.valueTypeIdx),
valueTypeId(other.valueTypeId), type(other.type),
attachedFunc(other.attachedFunc), object(other.object),
propType(other.propType), category(other.category) {}
+ QmlMetaProperty *q;
+
QString name;
QMetaMethod signal;
QmlContext *context;