Commit 13f91358 authored by Christian Kamm's avatar Christian Kamm

qmldump: Dump attached types and read them in Creator.

parent 047ed355
......@@ -249,6 +249,7 @@ Module {
"Qt/Component 4.7",
"QtQuick/Component 1.0"
]
attachedType: "QDeclarativeComponentAttached"
Enum {
name: "Status"
values: {
......@@ -271,6 +272,12 @@ Module {
}
Method { name: "errorString"; type: "string" }
}
Component {
name: "QDeclarativeComponentAttached"
prototype: "QObject"
Signal { name: "completed" }
Signal { name: "destruction" }
}
Component {
name: "QDeclarativeConnections"
prototype: "QObject"
......@@ -677,6 +684,7 @@ Module {
"QtQuick/GridView 1.0",
"QtQuick/GridView 1.1"
]
attachedType: "QDeclarativeGridViewAttached"
Enum {
name: "HighlightRangeMode"
values: {
......@@ -766,6 +774,18 @@ Module {
Method { name: "positionViewAtBeginning" }
Method { name: "positionViewAtEnd" }
}
Component {
name: "QDeclarativeGridViewAttached"
prototype: "QObject"
Property { name: "view"; type: "QDeclarativeGridView"; isReadonly: true; isPointer: true }
Property { name: "isCurrentItem"; type: "bool"; isReadonly: true }
Property { name: "delayRemove"; type: "bool" }
Signal { name: "currentItemChanged" }
Signal { name: "delayRemoveChanged" }
Signal { name: "add" }
Signal { name: "remove" }
Signal { name: "viewChanged" }
}
Component {
name: "QDeclarativeImage"
defaultProperty: "data"
......@@ -967,6 +987,7 @@ Module {
"Qt/KeyNavigation 4.7",
"QtQuick/KeyNavigation 1.0"
]
attachedType: "QDeclarativeKeyNavigationAttached"
Enum {
name: "Priority"
values: {
......@@ -996,6 +1017,7 @@ Module {
"Qt/Keys 4.7",
"QtQuick/Keys 1.0"
]
attachedType: "QDeclarativeKeysAttached"
Enum {
name: "Priority"
values: {
......@@ -1248,6 +1270,7 @@ Module {
"QtQuick/ListView 1.0",
"QtQuick/ListView 1.1"
]
attachedType: "QDeclarativeListViewAttached"
Enum {
name: "HighlightRangeMode"
values: {
......@@ -1343,6 +1366,24 @@ Module {
Method { name: "positionViewAtBeginning" }
Method { name: "positionViewAtEnd" }
}
Component {
name: "QDeclarativeListViewAttached"
prototype: "QObject"
Property { name: "view"; type: "QDeclarativeListView"; isReadonly: true; isPointer: true }
Property { name: "isCurrentItem"; type: "bool"; isReadonly: true }
Property { name: "previousSection"; type: "string"; isReadonly: true }
Property { name: "nextSection"; type: "string"; isReadonly: true }
Property { name: "section"; type: "string"; isReadonly: true }
Property { name: "delayRemove"; type: "bool" }
Signal { name: "currentItemChanged" }
Signal { name: "sectionChanged" }
Signal { name: "prevSectionChanged" }
Signal { name: "nextSectionChanged" }
Signal { name: "delayRemoveChanged" }
Signal { name: "add" }
Signal { name: "remove" }
Signal { name: "viewChanged" }
}
Component {
name: "QDeclarativeLoader"
defaultProperty: "data"
......@@ -1443,8 +1484,14 @@ Module {
"Qt/Package 4.7",
"QtQuick/Package 1.0"
]
attachedType: "QDeclarativePackageAttached"
Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
}
Component {
name: "QDeclarativePackageAttached"
prototype: "QObject"
Property { name: "name"; type: "string" }
}
Component {
name: "QDeclarativePaintedItem"
defaultProperty: "data"
......@@ -1585,6 +1632,7 @@ Module {
"Qt/PathView 4.7",
"QtQuick/PathView 1.0"
]
attachedType: "QDeclarativePathViewAttached"
Enum {
name: "HighlightRangeMode"
values: {
......@@ -1637,6 +1685,15 @@ Module {
Method { name: "incrementCurrentIndex" }
Method { name: "decrementCurrentIndex" }
}
Component {
name: "QDeclarativePathViewAttached"
prototype: "QObject"
Property { name: "view"; type: "QDeclarativePathView"; isReadonly: true; isPointer: true }
Property { name: "isCurrentItem"; type: "bool"; isReadonly: true }
Property { name: "onPath"; type: "bool"; isReadonly: true }
Signal { name: "currentItemChanged" }
Signal { name: "pathChanged" }
}
Component {
name: "QDeclarativePauseAnimation"
prototype: "QDeclarativeAbstractAnimation"
......@@ -2623,9 +2680,16 @@ Module {
"Qt/VisualItemModel 4.7",
"QtQuick/VisualItemModel 1.0"
]
attachedType: "QDeclarativeVisualItemModelAttached"
Property { name: "children"; type: "QDeclarativeItem"; isList: true; isReadonly: true }
Signal { name: "childrenChanged" }
}
Component {
name: "QDeclarativeVisualItemModelAttached"
prototype: "QObject"
Property { name: "index"; type: "int"; isReadonly: true }
Signal { name: "indexChanged" }
}
Component {
name: "QDeclarativeVisualModel"
prototype: "QObject"
......
......@@ -67,6 +67,8 @@ void collectReachableMetaObjects(QObject *object, QSet<const QMetaObject *> *met
void collectReachableMetaObjects(const QDeclarativeType *ty, QSet<const QMetaObject *> *metas)
{
collectReachableMetaObjects(ty->metaObject(), metas);
if (ty->attachedPropertiesType())
collectReachableMetaObjects(ty->attachedPropertiesType(), metas);
}
/* We want to add the MetaObject for 'Qt' to the list, this is a
......@@ -219,6 +221,11 @@ public:
qSort(exports);
qml->writeArrayBinding(QLatin1String("exports"), exports);
if (const QMetaObject *attachedType = (*qmlTypes.begin())->attachedPropertiesType()) {
qml->writeScriptBinding(QLatin1String("attachedType"), enquote(
convertToId(attachedType->className())));
}
}
for (int index = meta->enumeratorOffset(); index < meta->enumeratorCount(); ++index)
......
......@@ -187,6 +187,13 @@ FakeMetaMethod FakeMetaObject::method(int index) const
QString FakeMetaObject::defaultPropertyName() const
{ return m_defaultPropertyName; }
void FakeMetaObject::setDefaultPropertyName(const QString defaultPropertyName)
void FakeMetaObject::setDefaultPropertyName(const QString &defaultPropertyName)
{ m_defaultPropertyName = defaultPropertyName; }
QString FakeMetaObject::attachedTypeName() const
{ return m_attachedTypeName; }
void FakeMetaObject::setAttachedTypeName(const QString &name)
{ m_attachedTypeName = name; }
bool FakeMetaObject::Export::isValid() const
{ return !type.isEmpty(); }
......@@ -148,6 +148,7 @@ private:
QHash<QString, int> m_propNameToIdx;
QList<FakeMetaMethod> m_methods;
QString m_defaultPropertyName;
QString m_attachedTypeName;
public:
FakeMetaObject();
......@@ -181,7 +182,10 @@ public:
FakeMetaMethod method(int index) const;
QString defaultPropertyName() const;
void setDefaultPropertyName(const QString defaultPropertyName);
void setDefaultPropertyName(const QString &defaultPropertyName);
QString attachedTypeName() const;
void setAttachedTypeName(const QString &name);
};
} // namespace LanguageUtils
......
......@@ -158,8 +158,10 @@ void TypeDescriptionReader::readComponent(UiObjectDefinition *ast)
fmo->setDefaultPropertyName(readStringBinding(script));
} else if (name == "exports") {
readExports(script, fmo);
} else if (name == "attachedType") {
fmo->setAttachedTypeName(readStringBinding(script));
} else {
addError(script->firstSourceLocation(), "Expected only name, prototype, defaultProperty and exports script bindings");
addError(script->firstSourceLocation(), "Expected only name, prototype, defaultProperty, attachedType and exports script bindings");
return;
}
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment