summaryrefslogtreecommitdiff
path: root/src/qdoc/cppcodeparser.cpp
diff options
context:
space:
mode:
authorTopi Reinio <topi.reinio@qt.io>2021-03-15 22:01:15 +0100
committerTopi Reinio <topi.reinio@qt.io>2021-03-17 14:53:20 +0100
commit5dd444d42a4843f23d7d1dace642a13d10f750bb (patch)
treeb69c631ec52959769b51ff285b7d61d354444072 /src/qdoc/cppcodeparser.cpp
parentb7fd470a5b0fad2193bcfcb415e35f393250722d (diff)
downloadqttools-5dd444d42a4843f23d7d1dace642a13d10f750bb.tar.gz
qdoc: Re-implement \default command
Marking a QML property as a default property is now done with \qmldefault command; repurpose the \default command to set a default value for a property. The default value is visible in the detailed property documentation as an extra 'default: <value>' attribute. The value is taken as-is from the argument passed to the command. Fixes: QTBUG-81525 Change-Id: I7a4395e6e96046facfc3d75cc62a3bd01d04935b Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'src/qdoc/cppcodeparser.cpp')
-rw-r--r--src/qdoc/cppcodeparser.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/qdoc/cppcodeparser.cpp b/src/qdoc/cppcodeparser.cpp
index c3f673b8d..106e5f75d 100644
--- a/src/qdoc/cppcodeparser.cpp
+++ b/src/qdoc/cppcodeparser.cpp
@@ -602,6 +602,16 @@ void CppCodeParser::processMetaCommand(const Doc &doc, const QString &command,
QStringLiteral("C++ class %1 not found: \\instantiates %1").arg(arg));
} else
doc.location().warning(QStringLiteral("\\instantiates is only allowed in \\qmltype"));
+ } else if (command == COMMAND_DEFAULT) {
+ if (!node->isQmlProperty()) {
+ doc.location().warning(QStringLiteral("Ignored '\\%1', applies only to '\\%2'")
+ .arg(command, COMMAND_QMLPROPERTY));
+ } else if (arg.isEmpty()) {
+ doc.location().warning(QStringLiteral("Expected an argument for '\\%1' (maybe you meant '\\%2'?)")
+ .arg(command, COMMAND_QMLDEFAULT));
+ } else {
+ static_cast<QmlPropertyNode *>(node)->setDefaultValue(arg);
+ }
} else if (command == COMMAND_QMLDEFAULT) {
node->markDefault();
} else if (command == COMMAND_QMLREADONLY) {