diff --git a/share/qtcreator/qml-type-descriptions/qml-builtin-types.xml b/share/qtcreator/qml-type-descriptions/qml-builtin-types.xml index 579395a188d..0e10758198d 100644 --- a/share/qtcreator/qml-type-descriptions/qml-builtin-types.xml +++ b/share/qtcreator/qml-type-descriptions/qml-builtin-types.xml @@ -1,10 +1,86 @@ - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -30,273 +106,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -411,6 +221,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -444,6 +292,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1178,6 +1064,28 @@ + + + + + + + + + + + + + + + + + + + + + + @@ -1359,22 +1267,389 @@ - - - + + + + + - - - - - - - + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1386,28 +1661,120 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + - + + + + + + + + + + + + + - + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1457,6 +1824,13 @@ + + + + + + + @@ -1473,76 +1847,435 @@ - - - - + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1663,13 +2396,6 @@ - - - - - - - @@ -1680,101 +2406,31 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + @@ -1799,78 +2455,27 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + - - - - - - + + + + + + - - - - - - - - - - - - + + + + + + + + @@ -1923,622 +2528,76 @@ - - - - - - - - - - - - + + + + + + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - + + + + + + + @@ -2566,134 +2625,113 @@ - - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - + @@ -2712,102 +2750,179 @@ - - - - - - - - - - - - - - + + + + + + + - - - - - - - + + + - - - - - - - - - - - - - - - - + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + - - - - - - - - - - - - - - - - - - - - - - - + + + - - + + + + + + + + + + + + + + + + + + + - + + + + + + - - - - - + + - - + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libs/qmljs/qmljsbind.cpp b/src/libs/qmljs/qmljsbind.cpp index 637bbb79613..f02ac9bc26e 100644 --- a/src/libs/qmljs/qmljsbind.cpp +++ b/src/libs/qmljs/qmljsbind.cpp @@ -170,7 +170,7 @@ ObjectValue *Bind::bindObject(UiQualifiedId *qualifiedTypeNameId, UiObjectInitia // Script blocks all contribute to the same scope parentObjectValue = switchObjectValue(_functionEnvironment); processScript(qualifiedTypeNameId, initializer); - return switchObjectValue(parentObjectValue); + switchObjectValue(parentObjectValue); } // normal component instance diff --git a/src/libs/qmljs/qmljslink.cpp b/src/libs/qmljs/qmljslink.cpp index 35c9dab7f18..5490fd67bc8 100644 --- a/src/libs/qmljs/qmljslink.cpp +++ b/src/libs/qmljs/qmljslink.cpp @@ -150,6 +150,11 @@ void Link::populateImportedTypes(Interpreter::ObjectValue *typeEnv, Document::Pt if (! (doc->qmlProgram() && doc->qmlProgram()->imports)) return; + // Add the implicitly available Script type + const ObjectValue *scriptValue = engine()->metaTypeSystem().staticTypeForImport("Script"); + if (scriptValue) + typeEnv->setProperty("Script", scriptValue); + QFileInfo fileInfo(doc->fileName()); const QString absolutePath = fileInfo.absolutePath(); diff --git a/src/libs/qmljs/qmljsscopebuilder.cpp b/src/libs/qmljs/qmljsscopebuilder.cpp index 2ebd2a05ace..9c63ebbc3a1 100644 --- a/src/libs/qmljs/qmljsscopebuilder.cpp +++ b/src/libs/qmljs/qmljsscopebuilder.cpp @@ -73,12 +73,14 @@ void ScopeBuilder::setQmlScopeObject(Node *node) return; // Probably syntax errors, where we're working with a "recovered" AST. } - // check if the object has a Qt.ListElement ancestor + // check if the object has a Qt.ListElement or Qt.Connections ancestor + // ### allow only signal bindings for Connections const ObjectValue *prototype = scopeObject->prototype(_context); while (prototype) { if (const QmlObjectValue *qmlMetaObject = dynamic_cast(prototype)) { - if (qmlMetaObject->className() == QLatin1String("ListElement") - && qmlMetaObject->packageName() == QLatin1String("Qt")) { + if ((qmlMetaObject->className() == QLatin1String("ListElement") + || qmlMetaObject->className() == QLatin1String("Connections") + ) && qmlMetaObject->packageName() == QLatin1String("Qt")) { scopeChain.qmlScopeObjects.clear(); break; } diff --git a/src/tools/qml/qmldump/main.cpp b/src/tools/qml/qmldump/main.cpp index e8891d60ee0..de026a3c297 100644 --- a/src/tools/qml/qmldump/main.cpp +++ b/src/tools/qml/qmldump/main.cpp @@ -209,6 +209,36 @@ void dump(const QMetaObject *meta, QXmlStreamWriter *xml) xml->writeEndElement(); } +void writeScriptElement(QXmlStreamWriter *xml) +{ + xml->writeStartElement("type"); + { + QXmlStreamAttributes attributes; + attributes.append(QXmlStreamAttribute("name", "Script")); + xml->writeAttributes(attributes); + } + + xml->writeStartElement("property"); + { + QXmlStreamAttributes attributes; + attributes.append(QXmlStreamAttribute("name", "script")); + attributes.append(QXmlStreamAttribute("type", "string")); + xml->writeAttributes(attributes); + } + xml->writeEndElement(); + + xml->writeStartElement("property"); + { + QXmlStreamAttributes attributes; + attributes.append(QXmlStreamAttribute("name", "source")); + attributes.append(QXmlStreamAttribute("type", "QUrl")); + xml->writeAttributes(attributes); + } + xml->writeEndElement(); + + xml->writeEndElement(); +} + int main(int argc, char *argv[]) { QApplication app(argc, argv); @@ -252,6 +282,8 @@ int main(int argc, char *argv[]) foreach (const QMetaObject *meta, metas) { dump(meta, &xml); } + + writeScriptElement(&xml); xml.writeEndElement(); xml.writeEndDocument();