From 03f1c6e3ed01f8270463ab8aa4afb4f7c2321cdb Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Fri, 17 Jan 2020 14:21:46 +0100 Subject: qdoc: Teach QDoc to output function and class template parameters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a visitor functor that reconstructs template parameters from the Clang AST, and use it when either a class or a method template is detected. Store this information in the node - for now, they are used only in the class reference page subtitle (for classes), and detailed section of function documentation. Template parameters are not considered when searching/linking to entities, they are for display only. [ChangeLog][qdoc] Added capability to display class/method template parameters in the generated documentation. Fixes: QTBUG-17456 Change-Id: I300cc63b9fa20d4f6efaeaa27ea3769635a7b32c Reviewed-by: Topi Reiniƶ --- src/qdoc/cppcodemarker.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/qdoc/cppcodemarker.cpp') diff --git a/src/qdoc/cppcodemarker.cpp b/src/qdoc/cppcodemarker.cpp index b23312d19..25c2f630b 100644 --- a/src/qdoc/cppcodemarker.cpp +++ b/src/qdoc/cppcodemarker.cpp @@ -136,9 +136,13 @@ QString CppCodeMarker::markedUpSynopsis(const Node *node, const Node * /* relati break; case Node::Function: func = (const FunctionNode *)node; - + if (style == Section::Details) { + QString templateDecl = node->templateDecl(); + if (!templateDecl.isEmpty()) + synopsis = templateDecl + QLatin1Char(' '); + } if (style != Section::AllMembers && !func->returnType().isEmpty()) - synopsis = typified(func->returnType(), true); + synopsis += typified(func->returnType(), true); synopsis += name; if (!func->isMacroWithoutParams()) { synopsis += QLatin1Char('('); -- cgit v1.2.1