diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-06-10 05:52:25 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-06-10 05:52:25 (GMT) |
commit | bf750d1df7e1474ffddc547205f7f20520559ea7 (patch) | |
tree | cebde1834efd136e82e124b27e21cab42aabb01f /src/declarative/qml | |
parent | 4f40fa9b92f6f31f5a6d584f8890e2331b68f3bc (diff) | |
parent | 4dc4cfac667389efda4a43df5ff8cfa4ba305a2f (diff) | |
download | Qt-bf750d1df7e1474ffddc547205f7f20520559ea7.zip Qt-bf750d1df7e1474ffddc547205f7f20520559ea7.tar.gz Qt-bf750d1df7e1474ffddc547205f7f20520559ea7.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Conflicts:
src/declarative/qml/qmlvme.cpp
Diffstat (limited to 'src/declarative/qml')
-rw-r--r-- | src/declarative/qml/qmlbindablevalue.cpp | 4 | ||||
-rw-r--r-- | src/declarative/qml/qmlcompiler.cpp | 11 | ||||
-rw-r--r-- | src/declarative/qml/qmlinstruction.cpp | 3 | ||||
-rw-r--r-- | src/declarative/qml/qmlinstruction_p.h | 6 | ||||
-rw-r--r-- | src/declarative/qml/qmlparser_p.h | 2 | ||||
-rw-r--r-- | src/declarative/qml/qmlscriptparser.cpp | 1 | ||||
-rw-r--r-- | src/declarative/qml/qmlvme.cpp | 13 | ||||
-rw-r--r-- | src/declarative/qml/qmlvmemetaobject.cpp | 3 |
8 files changed, 41 insertions, 2 deletions
diff --git a/src/declarative/qml/qmlbindablevalue.cpp b/src/declarative/qml/qmlbindablevalue.cpp index 351e0bd..de01387 100644 --- a/src/declarative/qml/qmlbindablevalue.cpp +++ b/src/declarative/qml/qmlbindablevalue.cpp @@ -220,6 +220,10 @@ void QmlBindableValue::update() } else if (d->property.propertyCategory() == QmlMetaProperty::Normal) { QVariant value = this->value(); + if (d->property.propertyType() == QVariant::Url && value.canConvert(QVariant::String) && !value.isNull()) { + // Must resolve first + value.setValue(context()->resolvedUrl(value.toString())); + } d->property.write(value); } diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp index 16e1b13..d29ac1f 100644 --- a/src/declarative/qml/qmlcompiler.cpp +++ b/src/declarative/qml/qmlcompiler.cpp @@ -278,6 +278,14 @@ bool QmlCompiler::compileStoreInstruction(QmlInstruction &instr, instr.storeString.value = output->indexForString(string); } break; + case QVariant::Url: + { + instr.type = QmlInstruction::StoreUrl; + QUrl u = output->url.resolved(string); + instr.storeUrl.propertyIndex = prop.propertyIndex(); + instr.storeUrl.value = output->indexForString(u.toString()); + } + break; case QVariant::UInt: { instr.type = QmlInstruction::StoreInteger; @@ -1386,6 +1394,9 @@ bool QmlCompiler::compileDynamicMeta(QmlParser::Object *obj) case Object::DynamicProperty::String: type = "QString"; break; + case Object::DynamicProperty::Url: + type = "QUrl"; + break; case Object::DynamicProperty::Color: type = "QColor"; break; diff --git a/src/declarative/qml/qmlinstruction.cpp b/src/declarative/qml/qmlinstruction.cpp index bcc1f0d..a618fe7 100644 --- a/src/declarative/qml/qmlinstruction.cpp +++ b/src/declarative/qml/qmlinstruction.cpp @@ -85,6 +85,9 @@ void QmlCompiledComponent::dump(QmlInstruction *instr, int idx) case QmlInstruction::StoreString: qWarning() << idx << "\t" << line << "\t" << "STORE_STRING\t\t" << instr->storeString.propertyIndex << "\t" << instr->storeString.value << "\t\t" << primitives.at(instr->storeString.value); break; + case QmlInstruction::StoreUrl: + qWarning() << idx << "\t" << line << "\t" << "STORE_URL\t\t" << instr->storeUrl.propertyIndex << "\t" << instr->storeUrl.value << "\t\t" << primitives.at(instr->storeUrl.value); + break; case QmlInstruction::StoreColor: qWarning() << idx << "\t" << line << "\t" << "STORE_COLOR\t\t" << instr->storeColor.propertyIndex << "\t" << QString::number(instr->storeColor.value, 16); break; diff --git a/src/declarative/qml/qmlinstruction_p.h b/src/declarative/qml/qmlinstruction_p.h index a1d923d..0f1f697 100644 --- a/src/declarative/qml/qmlinstruction_p.h +++ b/src/declarative/qml/qmlinstruction_p.h @@ -76,6 +76,7 @@ public: // StoreInteger - Store a int or uint in a core property // StoreBool - Store a bool in a core property // StoreString - Store a QString in a core property + // StoreUrl - Store a QUrl in a core property // StoreColor - Store a QColor in a core property // StoreDate - Store a QDate in a core property // StoreTime - Store a QTime in a core property @@ -88,6 +89,7 @@ public: StoreInteger, /* storeInteger */ StoreBool, /* storeBool */ StoreString, /* storeString */ + StoreUrl, /* storeUrl */ StoreColor, /* storeColor */ StoreDate, /* storeDate */ StoreTime, /* storeTime */ @@ -213,6 +215,10 @@ public: } storeString; struct { int propertyIndex; + int value; + } storeUrl; + struct { + int propertyIndex; unsigned int value; } storeColor; struct { diff --git a/src/declarative/qml/qmlparser_p.h b/src/declarative/qml/qmlparser_p.h index 0fdd26b..7989933 100644 --- a/src/declarative/qml/qmlparser_p.h +++ b/src/declarative/qml/qmlparser_p.h @@ -131,7 +131,7 @@ namespace QmlParser DynamicProperty(); DynamicProperty(const DynamicProperty &); - enum Type { Variant, Int, Bool, Real, String, Color, Date }; + enum Type { Variant, Int, Bool, Real, String, Url, Color, Date }; bool isDefaultProperty; Type type; diff --git a/src/declarative/qml/qmlscriptparser.cpp b/src/declarative/qml/qmlscriptparser.cpp index 5207292..cab7915 100644 --- a/src/declarative/qml/qmlscriptparser.cpp +++ b/src/declarative/qml/qmlscriptparser.cpp @@ -501,6 +501,7 @@ bool ProcessAST::visit(AST::UiPublicMember *node) { "double", Object::DynamicProperty::Real }, { "real", Object::DynamicProperty::Real }, { "string", Object::DynamicProperty::String }, + { "url", Object::DynamicProperty::Url }, { "color", Object::DynamicProperty::Color }, { "date", Object::DynamicProperty::Date }, { "var", Object::DynamicProperty::Variant }, diff --git a/src/declarative/qml/qmlvme.cpp b/src/declarative/qml/qmlvme.cpp index 28b880c..cdc6a66 100644 --- a/src/declarative/qml/qmlvme.cpp +++ b/src/declarative/qml/qmlvme.cpp @@ -235,6 +235,17 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in } break; + case QmlInstruction::StoreUrl: + { + QObject *target = stack.top(); + void *a[1]; + QUrl u(primitives.at(instr.storeUrl.value)); + a[0] = (void *)&u; + QMetaObject::metacall(target, QMetaObject::WriteProperty, + instr.storeUrl.propertyIndex, a); + } + break; + case QmlInstruction::StoreFloat: { QObject *target = stack.top(); @@ -246,7 +257,7 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in } break; -case QmlInstruction::StoreDouble: + case QmlInstruction::StoreDouble: { QObject *target = stack.top(); double d = instr.storeDouble.value; diff --git a/src/declarative/qml/qmlvmemetaobject.cpp b/src/declarative/qml/qmlvmemetaobject.cpp index 58708cf..0117448 100644 --- a/src/declarative/qml/qmlvmemetaobject.cpp +++ b/src/declarative/qml/qmlvmemetaobject.cpp @@ -134,6 +134,9 @@ int QmlVMEMetaObject::metaCall(QMetaObject::Call c, int id, void **a) case QVariant::String: *reinterpret_cast<QString *>(a[0]) = data[propId].toString(); break; + case QVariant::Url: + *reinterpret_cast<QUrl *>(a[0]) = data[propId].toUrl(); + break; case QVariant::Color: *reinterpret_cast<QColor *>(a[0]) = data[propId].value<QColor>(); break; |