diff options
author | Martin Smith <martin.smith@digia.com> | 2013-02-21 12:53:06 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-02-22 18:34:35 +0100 |
commit | bfce04fe5bef507ed1360198d1b0b71665aa8a25 (patch) | |
tree | 1d6423248b7f87f2df99486ae66044bb6aecaf6c /src/tools/qdoc | |
parent | 298f0b65736adf21572fab022b71dfd18c847aec (diff) |
doc: QML Inheritance is not resolved correctly.
qdoc did not resolve QML Inheritance correctly and the result was that
QML inheritance was not shown correctly in the documentation. Part of
the problem was that information was missing for QML types in the .index
files produced by qdoc. qdoc also did not show inheritance properly
when one of its base types was marked internal. These problems have
now been fixed.
This update also fixes the problem that caused qdoc to slow down to a
snail's pace over time. The group members list for certain group pages
was getting longer and longer, because qdoc added the same member to
the member list an additional time every time qdoc was run in -prepare
mode if you didn't clear the index files first. Now, qdoc only adds a
member to the member list if it isn't already in the member list.
Task-number: QTBUG-29778
Change-Id: Ie4f0458a2ea4ceb1a64cdcd7f60f16b124a20790
Reviewed-by: Topi Reiniƶ <topi.reinio@digia.com>
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
Diffstat (limited to 'src/tools/qdoc')
-rw-r--r-- | src/tools/qdoc/cppcodemarker.cpp | 9 | ||||
-rw-r--r-- | src/tools/qdoc/node.cpp | 24 | ||||
-rw-r--r-- | src/tools/qdoc/node.h | 4 | ||||
-rw-r--r-- | src/tools/qdoc/qdocdatabase.cpp | 15 | ||||
-rw-r--r-- | src/tools/qdoc/qdocindexfiles.cpp | 7 |
5 files changed, 48 insertions, 11 deletions
diff --git a/src/tools/qdoc/cppcodemarker.cpp b/src/tools/qdoc/cppcodemarker.cpp index ff7d9254fc..f0cfc18515 100644 --- a/src/tools/qdoc/cppcodemarker.cpp +++ b/src/tools/qdoc/cppcodemarker.cpp @@ -1259,7 +1259,6 @@ QList<Section> CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, Syno } else { FastSection all(qmlClassNode,QString(),QString(),"member","members"); - const QmlClassNode* current = qmlClassNode; while (current != 0) { NodeList::ConstIterator c = current->childNodes().constBegin(); @@ -1271,9 +1270,9 @@ QList<Section> CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, Syno if ((*p)->type() == Node::QmlProperty) { QString key = current->name() + "::" + (*p)->name(); key = sortName(*p, &key); - if (!all.memberMap.contains(key)) + if (!all.memberMap.contains(key)) { all.memberMap.insert(key,*p); - //insert(all,*p,style,Okay); + } } ++p; } @@ -1281,9 +1280,9 @@ QList<Section> CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, Syno else { QString key = current->name() + "::" + (*c)->name(); key = sortName(*c, &key); - if (!all.memberMap.contains(key)) + if (!all.memberMap.contains(key)) { all.memberMap.insert(key,*c); - //insert(all,*c,style,Okay); + } } ++c; } diff --git a/src/tools/qdoc/node.cpp b/src/tools/qdoc/node.cpp index abb348eb51..c293d48673 100644 --- a/src/tools/qdoc/node.cpp +++ b/src/tools/qdoc/node.cpp @@ -662,6 +662,16 @@ bool InnerNode::hasMembers() const } /*! + Appends \a node to the members list, if and only if it + isn't already in the members list. + */ +void InnerNode::addMember(Node* node) +{ + if (!members_.contains(node)) + members_.append(node); +} + +/*! Returns true if this node's members collection contains at least one namespace node. */ @@ -2188,6 +2198,20 @@ bool Node::setQmlModuleInfo(const QString& arg) } /*! + If this QML type node has a base type node, + return the fully qualified name of that QML + type, i.e. <QML-module-name>::<QML-type-name>. + */ +QString QmlClassNode::qmlFullBaseName() const +{ + QString result; + if (baseNode_) { + result = baseNode_->qmlModuleIdentifier() + "::" + baseNode_->name(); + } + return result; +} + +/*! The name of this QML class node might be the same as the name of some other QML class node. If so, then this node's parent will be a NameCollisionNode.This function sets the diff --git a/src/tools/qdoc/node.h b/src/tools/qdoc/node.h index f76b115416..4802b6de54 100644 --- a/src/tools/qdoc/node.h +++ b/src/tools/qdoc/node.h @@ -240,6 +240,7 @@ public: QString guid() const; QString extractClassName(const QString &string) const; virtual QString qmlTypeName() const { return name_; } + virtual QString qmlFullBaseName() const { return QString(); } virtual QString qmlModuleName() const { return qmlModuleName_; } virtual QString qmlModuleVersion() const { return qmlModuleVersionMajor_ + "." + qmlModuleVersionMinor_; } virtual QString qmlModuleIdentifier() const { return qmlModuleName_ + qmlModuleVersionMajor_; } @@ -332,7 +333,7 @@ public: const NodeList & childNodes() const { return children_; } const NodeList & relatedNodes() const { return related_; } - virtual void addMember(Node* node) { members_.append(node); } + virtual void addMember(Node* node); const NodeList& members() const { return members_; } virtual bool hasMembers() const; virtual bool hasNamespaces() const; @@ -563,6 +564,7 @@ public: virtual bool isAbstract() const { return abstract_; } virtual void setAbstract(bool b) { abstract_ = b; } virtual bool isInternal() const { return (status() == Internal); } + virtual QString qmlFullBaseName() const; const ImportList& importList() const { return importList_; } void setImportList(const ImportList& il) { importList_ = il; } const QString& qmlBaseName() const { return baseName_; } diff --git a/src/tools/qdoc/qdocdatabase.cpp b/src/tools/qdoc/qdocdatabase.cpp index 256bc62dd2..58c674de7a 100644 --- a/src/tools/qdoc/qdocdatabase.cpp +++ b/src/tools/qdoc/qdocdatabase.cpp @@ -886,11 +886,16 @@ void QDocDatabase::resolveQmlInheritance(InnerNode* root) QmlClassNode* qcn = static_cast<QmlClassNode*>(child); if ((qcn->qmlBaseNode() == 0) && !qcn->qmlBaseName().isEmpty()) { QmlClassNode* bqcn = 0; - const ImportList& imports = qcn->importList(); - for (int i=0; i<imports.size(); ++i) { - bqcn = findQmlType(imports[i], qcn->qmlBaseName()); - if (bqcn) - break; + if (qcn->qmlBaseName().contains("::")) { + bqcn = qmlTypeMap_.value(qcn->qmlBaseName()); + } + else { + const ImportList& imports = qcn->importList(); + for (int i=0; i<imports.size(); ++i) { + bqcn = findQmlType(imports[i], qcn->qmlBaseName()); + if (bqcn) + break; + } } if (bqcn == 0) { bqcn = findQmlType(QString(), qcn->qmlBaseName()); diff --git a/src/tools/qdoc/qdocindexfiles.cpp b/src/tools/qdoc/qdocindexfiles.cpp index 63d8639d0f..466742ee3a 100644 --- a/src/tools/qdoc/qdocindexfiles.cpp +++ b/src/tools/qdoc/qdocindexfiles.cpp @@ -193,6 +193,9 @@ void QDocIndexFiles::readIndexSection(const QDomElement& element, QString qmlModuleName = element.attribute("qml-module-name"); QString qmlModuleVersion = element.attribute("qml-module-version"); qdb_->addToQmlModule(qmlModuleName + " " + qmlModuleVersion, qcn); + QString qmlFullBaseName = element.attribute("qml-base-type"); + if (!qmlFullBaseName.isEmpty()) + qcn->setQmlBaseName(qmlFullBaseName); if (element.hasAttribute("location")) name = element.attribute("location", QString()); if (!indexUrl.isEmpty()) @@ -597,6 +600,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, QString nodeName; QString qmlModuleName; QString qmlModuleVersion; + QString qmlFullBaseName; switch (node->type()) { case Node::Namespace: nodeName = "namespace"; @@ -610,6 +614,7 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, nodeName = "qmlclass"; qmlModuleName = node->qmlModuleName(); qmlModuleVersion = node->qmlModuleVersion(); + qmlFullBaseName = node->qmlFullBaseName(); } else if (node->subType() == Node::QmlBasicType) nodeName = "qmlbasictype"; @@ -728,6 +733,8 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, if (!qmlModuleName.isEmpty()) { writer.writeAttribute("qml-module-name", qmlModuleName); writer.writeAttribute("qml-module-version", qmlModuleVersion); + if (!qmlFullBaseName.isEmpty()) + writer.writeAttribute("qml-base-type", qmlFullBaseName); } QString fullName = node->fullDocumentName(); if (fullName != objName) |