diff options
author | Topi Reinio <topi.reinio@qt.io> | 2020-01-17 14:21:46 +0100 |
---|---|---|
committer | Topi Reiniƶ <topi.reinio@qt.io> | 2020-01-20 12:11:44 +0000 |
commit | 03f1c6e3ed01f8270463ab8aa4afb4f7c2321cdb (patch) | |
tree | d4ce1dd46b47df7bab812196b4f9272d70a223f4 /src/qdoc/cppcodemarker.cpp | |
parent | f7ef0f5bc1d6b1e4ed9b0983c0e364bbf2654624 (diff) | |
download | qttools-03f1c6e3ed01f8270463ab8aa4afb4f7c2321cdb.tar.gz |
qdoc: Teach QDoc to output function and class template parameters
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ƶ <topi.reinio@qt.io>
Diffstat (limited to 'src/qdoc/cppcodemarker.cpp')
-rw-r--r-- | src/qdoc/cppcodemarker.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
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('('); |