summaryrefslogtreecommitdiffstats
path: root/src/tools/qdoc/qdocindexfiles.cpp
diff options
context:
space:
mode:
authorMartin Smith <martin.smith@digia.com>2013-02-20 12:03:32 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-02-20 17:22:26 +0100
commit2cb22c6cc01627700ebfb8d2528ab4f700917a9b (patch)
tree2a90f9db61cf7ee292f58975a52cff1738487db0 /src/tools/qdoc/qdocindexfiles.cpp
parentdacc222d5a3327fb27d69e57d99111cdf9084304 (diff)
qdoc: QML Inheritance is not resolved correctly.
This change adds some QML property, signal, and method data to the .index file. It also provides more robust resolving of QML inheritance for qml types. Task-number: QTBUG-29778 Change-Id: Iaefd64227913a19f427b21e904ca5e32c82d7b29 Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
Diffstat (limited to 'src/tools/qdoc/qdocindexfiles.cpp')
-rw-r--r--src/tools/qdoc/qdocindexfiles.cpp54
1 files changed, 48 insertions, 6 deletions
diff --git a/src/tools/qdoc/qdocindexfiles.cpp b/src/tools/qdoc/qdocindexfiles.cpp
index 358c2a14d9a..63d8639d0f8 100644
--- a/src/tools/qdoc/qdocindexfiles.cpp
+++ b/src/tools/qdoc/qdocindexfiles.cpp
@@ -190,6 +190,9 @@ void QDocIndexFiles::readIndexSection(const QDomElement& element,
((element.nodeName() == "page") && (element.attribute("subtype") == "qmlclass"))) {
QmlClassNode* qcn = new QmlClassNode(parent, name);
qcn->setTitle(element.attribute("title"));
+ QString qmlModuleName = element.attribute("qml-module-name");
+ QString qmlModuleVersion = element.attribute("qml-module-version");
+ qdb_->addToQmlModule(qmlModuleName + " " + qmlModuleVersion, qcn);
if (element.hasAttribute("location"))
name = element.attribute("location", QString());
if (!indexUrl.isEmpty())
@@ -209,6 +212,31 @@ void QDocIndexFiles::readIndexSection(const QDomElement& element,
location = Location(name);
node = qbtn;
}
+ else if (element.nodeName() == "qmlproperty") {
+ QmlClassNode* qcn = static_cast<QmlClassNode*>(parent);
+ QString type = element.attribute("type");
+ bool attached = false;
+ if (element.attribute("attached") == "true")
+ attached = true;
+ bool readonly = false;
+ if (element.attribute("writable") == "false")
+ readonly = true;
+ QmlPropertyNode* qpn = new QmlPropertyNode(qcn, name, type, attached);
+ qpn->setReadOnly(readonly);
+ node = qpn;
+ }
+ else if ((element.nodeName() == "qmlmethod") ||
+ (element.nodeName() == "qmlsignal") ||
+ (element.nodeName() == "qmlsignalhandler")) {
+ Node::Type t = Node::QmlMethod;
+ if (element.nodeName() == "qmlsignal")
+ t = Node::QmlSignal;
+ else if (element.nodeName() == "qmlsignalhandler")
+ t = Node::QmlSignalHandler;
+ bool attached = false;
+ FunctionNode* fn = new FunctionNode(t, parent, name, attached);
+ node = fn;
+ }
else if (element.nodeName() == "page") {
Node::SubType subtype;
Node::PageType ptype = Node::NoPageType;
@@ -476,17 +504,22 @@ void QDocIndexFiles::readIndexSection(const QDomElement& element,
InnerNode* inner = static_cast<InnerNode*>(node);
QDomElement child = element.firstChildElement();
while (!child.isNull()) {
- if (element.nodeName() == "class")
+ if (element.nodeName() == "class") {
readIndexSection(child, inner, indexUrl);
- else if (element.nodeName() == "qmlclass")
+ }
+ else if (element.nodeName() == "qmlclass") {
readIndexSection(child, inner, indexUrl);
- else if (element.nodeName() == "page")
+ }
+ else if (element.nodeName() == "page") {
readIndexSection(child, inner, indexUrl);
- else if (element.nodeName() == "namespace" && !name.isEmpty())
+ }
+ else if (element.nodeName() == "namespace" && !name.isEmpty()) {
// The root node in the index is a namespace with an empty name.
readIndexSection(child, inner, indexUrl);
- else
+ }
+ else {
readIndexSection(child, parent, indexUrl);
+ }
child = child.nextSiblingElement();
}
}
@@ -562,6 +595,8 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer,
return false;
QString nodeName;
+ QString qmlModuleName;
+ QString qmlModuleVersion;
switch (node->type()) {
case Node::Namespace:
nodeName = "namespace";
@@ -571,8 +606,11 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer,
break;
case Node::Document:
nodeName = "page";
- if (node->subType() == Node::QmlClass)
+ if (node->subType() == Node::QmlClass) {
nodeName = "qmlclass";
+ qmlModuleName = node->qmlModuleName();
+ qmlModuleVersion = node->qmlModuleVersion();
+ }
else if (node->subType() == Node::QmlBasicType)
nodeName = "qmlbasictype";
break;
@@ -687,6 +725,10 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer,
writer.writeAttribute("status", status);
writer.writeAttribute("name", objName);
+ if (!qmlModuleName.isEmpty()) {
+ writer.writeAttribute("qml-module-name", qmlModuleName);
+ writer.writeAttribute("qml-module-version", qmlModuleVersion);
+ }
QString fullName = node->fullDocumentName();
if (fullName != objName)
writer.writeAttribute("fullname", fullName);