From 58bca83555914cacf124acf0a687312bb547b85c Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Mon, 26 Oct 2020 23:37:08 +0100 Subject: qdoc: Fix handling of \fn signatures with unnamed parameters A misplaced 'i++' caused an error where names of documented parameters were shifted around if one or more of the parameters were unnamed. Fixing the above uncovered issues with handling of \fn commands with [tag] argument; improve and simplify related code. Finally, avoid redundant space characters when generating signatures with unnamed parameters or in 'All Members' page where parameter names are omitted. Fixes: QTBUG-87855 Change-Id: I526c89c10c66572b8c71106660f43346a4751e4e Reviewed-by: Paul Wicking --- src/qdoc/cppcodemarker.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'src/qdoc/cppcodemarker.cpp') diff --git a/src/qdoc/cppcodemarker.cpp b/src/qdoc/cppcodemarker.cpp index 3f3eedab2..341b8b651 100644 --- a/src/qdoc/cppcodemarker.cpp +++ b/src/qdoc/cppcodemarker.cpp @@ -143,15 +143,10 @@ QString CppCodeMarker::markedUpSynopsis(const Node *node, const Node * /* relati QString name = parameters.at(i).name(); QString type = parameters.at(i).type(); QString value = parameters.at(i).defaultValue(); - QString paramName; - if (!name.isEmpty()) { - synopsis += typified(type, true); - paramName = name; - } else { - paramName = type; - } - if (style != Section::AllMembers || name.isEmpty()) - synopsis += "<@param>" + protect(paramName) + ""; + bool trailingSpace = style != Section::AllMembers && !name.isEmpty(); + synopsis += typified(type, trailingSpace); + if (style != Section::AllMembers && !name.isEmpty()) + synopsis += "<@param>" + protect(name) + ""; if (style != Section::AllMembers && !value.isEmpty()) synopsis += " = " + protect(value); } -- cgit v1.2.1