From 5dd444d42a4843f23d7d1dace642a13d10f750bb Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Mon, 15 Mar 2021 22:01:15 +0100 Subject: 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: ' attribute. The value is taken as-is from the argument passed to the command. Fixes: QTBUG-81525 Change-Id: I7a4395e6e96046facfc3d75cc62a3bd01d04935b Reviewed-by: Paul Wicking --- src/qdoc/cppcodeparser.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/qdoc/cppcodeparser.cpp') 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(node)->setDefaultValue(arg); + } } else if (command == COMMAND_QMLDEFAULT) { node->markDefault(); } else if (command == COMMAND_QMLREADONLY) { -- cgit v1.2.1