diff options
author | Topi Reinio <topi.reinio@qt.io> | 2019-05-07 13:42:41 +0200 |
---|---|---|
committer | Jani Heikkinen <jani.heikkinen@qt.io> | 2019-05-08 11:37:58 +0000 |
commit | 92dda82f52b8ff58e06a58dc9ebeaf15b8affa1b (patch) | |
tree | 5f120e20b6212a9595381ac6f484c3028e6f032a /src/qdoc | |
parent | 72eac2f5f3d8ea839c915455e4eed66118d06505 (diff) | |
download | qttools-92dda82f52b8ff58e06a58dc9ebeaf15b8affa1b.tar.gz |
qdoc: Fix issues with shared comments for QML properties/methods
There were multiple issues with QML properties, methods, or property
groups that share comments:
As we don't handle \qmlpropertygroup anymore, QDoc assumed that every
\qmlproperty that shares a comment belongs to a property group, and
tried to resolve the group name. But for some properties, there is no
group name as they are just properties sharing a doc.
For details section of QML reference page, any shared comment was
assigned to 'Method Documentation', which is clearly wrong.
Also, fix a typo where we looked for C++ functions when generating
QML method documentation.
Fixes: QTBUG-75647
Change-Id: I11cef407b39fdc926a5410b867e8b17a8d769937
Reviewed-by: Martin Smith <martin.smith@qt.io>
Diffstat (limited to 'src/qdoc')
-rw-r--r-- | src/qdoc/htmlgenerator.cpp | 20 | ||||
-rw-r--r-- | src/qdoc/sections.cpp | 15 |
2 files changed, 17 insertions, 18 deletions
diff --git a/src/qdoc/htmlgenerator.cpp b/src/qdoc/htmlgenerator.cpp index f51e358a2..e9711851a 100644 --- a/src/qdoc/htmlgenerator.cpp +++ b/src/qdoc/htmlgenerator.cpp @@ -4305,19 +4305,21 @@ void HtmlGenerator::generateDetailedQmlMember(Node *node, QString qmlItemFooter("</table></div>\n</div>"); out() << "<div class=\"qmlitem\">"; - QString nodeRef = refForNode(node); + QString nodeRef; if (node->isPropertyGroup()) { const SharedCommentNode* scn = static_cast<const SharedCommentNode*>(node); QVector<Node*>::ConstIterator p = scn->collective().constBegin(); out() << "<div class=\"qmlproto\">"; out() << "<div class=\"table\"><table class=\"qmlname\">"; - - QString heading = scn->name() + " group"; - out() << "<tr valign=\"top\" class=\"even\" id=\"" << nodeRef << "\">"; - out() << "<th class=\"centerAlign\"><p>"; - out() << "<a name=\"" + nodeRef + "\"></a>"; - out() << "<b>" << heading << "</b>"; - out() << "</p></th></tr>"; + if (!scn->name().isEmpty()) { + nodeRef = refForNode(scn); + QString heading = scn->name() + " group"; + out() << "<tr valign=\"top\" class=\"even\" id=\"" << nodeRef << "\">"; + out() << "<th class=\"centerAlign\"><p>"; + out() << "<a name=\"" + nodeRef + "\"></a>"; + out() << "<b>" << heading << "</b>"; + out() << "</p></th></tr>"; + } while (p != scn->collective().constEnd()) { if ((*p)->isQmlProperty() || (*p)->isJsProperty()) { qpn = static_cast<QmlPropertyNode*>(*p); @@ -4361,7 +4363,7 @@ void HtmlGenerator::generateDetailedQmlMember(Node *node, out() << "<div class=\"fngroup\">\n"; out() << qmlItemHeader; for (const auto m : collective) { - if (m->isFunction(Node::CPP) || m->isFunction(Node::JS)) { + if (m->isFunction(Node::QML) || m->isFunction(Node::JS)) { out() << qmlItemStart.arg(nodeRef, "tblQmlFuncNode", refForNode(m)); generateSynopsis(m, relative, marker, Section::Details, false); out() << qmlItemEnd; diff --git a/src/qdoc/sections.cpp b/src/qdoc/sections.cpp index 452be566a..e0324b347 100644 --- a/src/qdoc/sections.cpp +++ b/src/qdoc/sections.cpp @@ -870,7 +870,7 @@ void Sections::distributeQmlNodeInDetailsVector(SectionVector &dv, Node *n) dv[QmlMethods].insert(fn); } } else if (n->isSharedCommentNode() && n->hasDoc()) { - dv[QmlMethods].insert(n); // incorrect? + dv[n->isPropertyGroup() ? QmlProperties : QmlMethods].insert(n); } } @@ -901,14 +901,11 @@ void Sections::distributeQmlNodeInSummaryVector(SectionVector &sv, Node *n) } } else if (n->isSharedCommentNode()) { SharedCommentNode *scn = static_cast<SharedCommentNode*>(n); - if (scn->isPropertyGroup()) { - if (scn->name().isEmpty()) { - foreach (Node *n, scn->collective()) { - sv[QmlProperties].insert(n); - } - } else { - sv[QmlProperties].insert(scn); - } + if (scn->name().isEmpty()) { + for (auto child : scn->collective()) + sv[child->isFunction(Node::QML) ? QmlMethods : QmlProperties].insert(child); + } else { + sv[QmlProperties].insert(scn); } } } |