summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTopi Reinio <topi.reinio@theqtcompany.com>2016-04-05 13:16:48 +0200
committerTopi Reiniƶ <topi.reinio@theqtcompany.com>2016-04-05 12:20:59 +0000
commitb564cefa41ecbda498ad5f332673967fbec1c890 (patch)
treed2233972b0b687a9fbc1f8593f4c39fdd3de20de
parent62c59455b28ce685285a78da1f79ee7e0db9b88f (diff)
downloadqttools-b564cefa41ecbda498ad5f332673967fbec1c890.tar.gz
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 <martin.smith@theqtcompany.com>
-rw-r--r--src/qdoc/cppcodemarker.cpp18
1 files changed, 11 insertions, 7 deletions
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()) + "</@param>";
+ bool hasName = !(*p).name().isEmpty();
+ if (hasName)
+ synopsis += typified((*p).dataType(), true);
+ const QString &paramName = hasName ? (*p).name() : (*p).dataType();
+ if (style != Subpage || !hasName)
+ synopsis += "<@param>" + protect(paramName) + "</@param>";
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()) + "</@param>";
+ bool hasName = !(*p).name().isEmpty();
+ if (hasName)
+ synopsis += typified((*p).dataType(), true);
+ const QString &paramName = hasName ? (*p).name() : (*p).dataType();
+ synopsis += "<@param>" + protect(paramName) + "</@param>";
synopsis += protect((*p).rightType());
++p;
}