From f68e83d7634c929bef57fc534861768bb9785c74 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Wed, 15 Jul 2020 14:15:25 +0200 Subject: qdoc: Introduce \required command and handle REQUIRED for QML properties Q_PROPERTY macro now supports the REQUIRED keyword. This is relevant for QML types, where the type cannot be instatiated without declaring all required properties. Make QDoc parse the REQUIRED keyword, set associated QML property as required, and introduce a new command, \required, to do this explicitly in the docs. Likewise in QML visitor, check for the 'required' keyword for properties. [ChangeLog][qdoc] Support marking QML properties as required in the generated documentation. Fixes: QTBUG-85597 Change-Id: Ib8a25c5ebc1183812aec6e672b557c8fb1196741 Reviewed-by: Paul Wicking --- src/qdoc/cppcodeparser.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/qdoc/cppcodeparser.cpp') diff --git a/src/qdoc/cppcodeparser.cpp b/src/qdoc/cppcodeparser.cpp index 2847d238c..73936ed36 100644 --- a/src/qdoc/cppcodeparser.cpp +++ b/src/qdoc/cppcodeparser.cpp @@ -593,6 +593,11 @@ void CppCodeParser::processMetaCommand(const Doc &doc, const QString &command, node->markDefault(); } else if (command == COMMAND_QMLREADONLY) { node->markReadOnly(true); + } else if (command == COMMAND_QMLREQUIRED) { + if (!node->isQmlProperty()) + doc.location().warning(QStringLiteral("Ignored '\\%1'").arg(COMMAND_QMLREQUIRED)); + else + static_cast(node)->setRequired(); } else if ((command == COMMAND_QMLABSTRACT) || (command == COMMAND_ABSTRACT)) { if (node->isQmlType() || node->isJsType()) node->setAbstract(true); -- cgit v1.2.1