From b564cefa41ecbda498ad5f332673967fbec1c890 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Tue, 5 Apr 2016 13:16:48 +0200 Subject: qdoc: Fix incorrect formatting of QML method signatures This commit fixes an issue that was addressed previously by 694d3003 (qtbase), but that was reintroduced by dab4877a (qtbase). Some QML methods are documented as having parameters without data types: bool grabToImage(callback, targetSize) QDoc was incorrectly inserting spaces after each name: bool grabToImage(callback , targetSize ) Fix the above, and format the typeless parameter names correctly (in italics). Change-Id: I3b61f7b3531c2cbf0e70cd88a3e91e6f7b0eea95 Task-number: QTWEBSITE-691 Reviewed-by: Martin Smith --- src/qdoc/cppcodemarker.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/qdoc/cppcodemarker.cpp') diff --git a/src/qdoc/cppcodemarker.cpp b/src/qdoc/cppcodemarker.cpp index eb88346dc..c68012d2f 100644 --- a/src/qdoc/cppcodemarker.cpp +++ b/src/qdoc/cppcodemarker.cpp @@ -161,10 +161,12 @@ QString CppCodeMarker::markedUpSynopsis(const Node *node, while (p != func->parameters().constEnd()) { if (p != func->parameters().constBegin()) synopsis += ", "; - synopsis += typified((*p).dataType(), true); - if (style != Subpage && !(*p).name().isEmpty()) - synopsis += - "<@param>" + protect((*p).name()) + ""; + bool hasName = !(*p).name().isEmpty(); + if (hasName) + synopsis += typified((*p).dataType(), true); + const QString ¶mName = hasName ? (*p).name() : (*p).dataType(); + if (style != Subpage || !hasName) + synopsis += "<@param>" + protect(paramName) + ""; synopsis += protect((*p).rightType()); if (style != Subpage && !(*p).defaultValue().isEmpty()) synopsis += " = " + protect((*p).defaultValue()); @@ -342,9 +344,11 @@ QString CppCodeMarker::markedUpQmlItem(const Node* node, bool summary) while (p != func->parameters().constEnd()) { if (p != func->parameters().constBegin()) synopsis += ", "; - synopsis += typified((*p).dataType(), true); - if (!(*p).name().isEmpty()) - synopsis += "<@param>" + protect((*p).name()) + ""; + bool hasName = !(*p).name().isEmpty(); + if (hasName) + synopsis += typified((*p).dataType(), true); + const QString ¶mName = hasName ? (*p).name() : (*p).dataType(); + synopsis += "<@param>" + protect(paramName) + ""; synopsis += protect((*p).rightType()); ++p; } -- cgit v1.2.1