summaryrefslogtreecommitdiff
path: root/src/qdoc/cppcodeparser.cpp
diff options
context:
space:
mode:
authorTopi Reinio <topi.reinio@qt.io>2019-10-15 14:44:06 +0200
committerPaul Wicking <paul.wicking@qt.io>2019-10-16 15:16:02 +0200
commitd3c05eb7e943ca8d4bd55e5eea236eaf08ce5cf5 (patch)
tree635a6b0c0202bab086dbba0e728d380da7931d94 /src/qdoc/cppcodeparser.cpp
parentd5ba63896d2509dfd2b9cde0fdf1014f239c8e12 (diff)
downloadqttools-d3c05eb7e943ca8d4bd55e5eea236eaf08ce5cf5.tar.gz
qdoc: Fix issues with shared comment nodes
QDoc stores <sharedcomment> elements to the .index correctly, but the nodes that were sharing a comment were added after the shared comment. This meant that a shared comment node (SCN) could not find any of its members as they hadn't been read in yet. Fix this by delaying the creation of a new SCN until we have a list of sharing nodes. Also fix other related issues: - Generate content also for non-function SCN members. - Make SCN adopt the genus of a member when adding one. - Fix Node::isPropertyGroup() to return true for actual property groups (not all QML properties that share a comment) and fix usage of that method. - Fix linking to property groups when searching by the group name. - Restore indentation of property group members both in the summary section and in the All Members file. Fixes: QTBUG-79204 Change-Id: I1702f39b178f52444436b800d4fe9cb99f976a60 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Martin Smith <martin.smith@qt.io>
Diffstat (limited to 'src/qdoc/cppcodeparser.cpp')
-rw-r--r--src/qdoc/cppcodeparser.cpp36
1 files changed, 17 insertions, 19 deletions
diff --git a/src/qdoc/cppcodeparser.cpp b/src/qdoc/cppcodeparser.cpp
index 47f3f52a6..b05e2ab3c 100644
--- a/src/qdoc/cppcodeparser.cpp
+++ b/src/qdoc/cppcodeparser.cpp
@@ -458,22 +458,11 @@ void CppCodeParser::processQmlProperties(const Doc &doc, NodeList &nodes, DocLis
group = property.left(i);
}
+ NodeList sharedNodes;
QmlTypeNode *qmlType = qdb_->findQmlType(module, qmlTypeName);
if (qmlType == nullptr)
qmlType = new QmlTypeNode(qdb_->primaryTreeRoot(), qmlTypeName);
- SharedCommentNode *scn = nullptr;
- if (topics.size() > 1) {
- scn = new SharedCommentNode(qmlType, topics.size(), group);
- scn->setLocation(doc.startLocation());
- if (jsProps)
- scn->setGenus(Node::JS);
- else
- scn->setGenus(Node::QML);
- nodes.append(scn);
- docs.append(doc);
- }
-
for (int i=0; i<topics.size(); ++i) {
QString cmd = topics.at(i).topic;
arg = topics.at(i).args;
@@ -492,20 +481,29 @@ void CppCodeParser::processQmlProperties(const Doc &doc, NodeList &nodes, DocLis
continue;
}
QmlPropertyNode *qpn = new QmlPropertyNode(qmlType, property, type, attached);
- if (scn != nullptr)
- qpn->setSharedCommentNode(scn);
qpn->setLocation(doc.startLocation());
- if (jsProps)
- qpn->setGenus(Node::JS);
- else
- qpn->setGenus(Node::QML);
+ qpn->setGenus(jsProps ? Node::JS : Node::QML);
nodes.append(qpn);
docs.append(doc);
+ sharedNodes << qpn;
}
} else {
doc.startLocation().warning(tr("Command '\\%1'; not allowed with QML/JS property commands").arg(cmd));
}
}
+
+ // Construct a SharedCommentNode (scn) if multiple topics generated
+ // valid nodes. Note that it's important to do this *after* constructing
+ // the topic nodes - which need to be written to index before the related
+ // scn.
+ if (sharedNodes.count() > 1) {
+ SharedCommentNode *scn = new SharedCommentNode(qmlType, sharedNodes.count(), group);
+ scn->setLocation(doc.startLocation());
+ nodes.append(scn);
+ docs.append(doc);
+ for (const auto n : sharedNodes)
+ scn->append(n);
+ }
}
/*!
@@ -1005,7 +1003,7 @@ void CppCodeParser::processTopicArgs(const Doc &doc, const QString &topic, NodeL
bool found = false;
for (SharedCommentNode *scn : sharedCommentNodes) {
if (scn->parent() == node->parent()) {
- node->setSharedCommentNode(scn);
+ scn->append(node);
found = true;
break;
}