summaryrefslogtreecommitdiffstats
path: root/src/tools/qdoc/qmlvisitor.cpp
diff options
context:
space:
mode:
authorMartin Smith <martin.smith@digia.com>2013-02-12 09:40:02 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-02-13 10:11:48 +0100
commitcd84491aad703f7b983a3d61277a27998e53396a (patch)
tree100eea8279ac95a47a9625fdd6c9951425137561 /src/tools/qdoc/qmlvisitor.cpp
parentd1fe252d6a5c62b702620fc7f0b4b6b05fcfe5e6 (diff)
qdoc: inherited members do not show up for QML components
This was a regression bug owing to a big qdoc cleanup for Qt5. But the way QML inheritance had been handled was not a good design, so it has been changed here. When a .qml file is parsed by qdoc, the base type of the QML component is detected, and its name is stored in qdoc's tree node for the component. After qdoc has parsed all the QML files, it traverses the tree, and for each QML component that has a base type name but no base type node pointer yet, it searches the tree for the base type node and stores the pointer to the node in the node for the components. Then when the output generator generates the doc page for the component, it has access to all the inherited members in the base type. Task-number: QTBUG-29569 Change-Id: Ib4958d05f55fa48a572f8ca51ffd57712f29bbc7 Reviewed-by: J-P Nurmi <jpnurmi@digia.com> Reviewed-by: Topi Reiniƶ <topi.reinio@digia.com> Reviewed-by: Martin Smith <martin.smith@digia.com>
Diffstat (limited to 'src/tools/qdoc/qmlvisitor.cpp')
-rw-r--r--src/tools/qdoc/qmlvisitor.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/tools/qdoc/qmlvisitor.cpp b/src/tools/qdoc/qmlvisitor.cpp
index 9dc15d56f1..15af03d9ba 100644
--- a/src/tools/qdoc/qmlvisitor.cpp
+++ b/src/tools/qdoc/qmlvisitor.cpp
@@ -106,7 +106,7 @@ QmlDocVisitor::~QmlDocVisitor()
}
/*!
- Returns the location of thre nearest comment above the \a offset.
+ Returns the location of the nearest comment above the \a offset.
*/
QQmlJS::AST::SourceLocation QmlDocVisitor::precedingComment(quint32 offset) const
{
@@ -322,11 +322,10 @@ void QmlDocVisitor::applyMetacommands(QQmlJS::AST::SourceLocation,
else if (command == COMMAND_QMLINHERITS) {
if (node->name() == args[0].first)
doc.location().warning(tr("%1 tries to inherit itself").arg(args[0].first));
- else {
- CodeParser::setLink(node, Node::InheritsLink, args[0].first);
- if (node->subType() == Node::QmlClass) {
- QmlClassNode::addInheritedBy(args[0].first,node);
- }
+ else if (node->subType() == Node::QmlClass) {
+ QmlClassNode *qmlClass = static_cast<QmlClassNode*>(node);
+ qmlClass->setQmlBaseName(args[0].first);
+ QmlClassNode::addInheritedBy(args[0].first,node);
}
}
else if (command == COMMAND_QMLDEFAULT) {
@@ -389,11 +388,9 @@ bool QmlDocVisitor::visit(QQmlJS::AST::UiObjectDefinition *definition)
QmlClassNode *component = new QmlClassNode(current, name);
component->setTitle(name);
component->setImportList(importList);
-
if (applyDocumentation(definition->firstSourceLocation(), component)) {
QmlClassNode::addInheritedBy(type, component);
- if (!component->links().contains(Node::InheritsLink))
- component->setLink(Node::InheritsLink, type, type);
+ component->setQmlBaseName(type);
}
current = component;
}