summaryrefslogtreecommitdiff
path: root/src/qdoc/cppcodeparser.cpp
diff options
context:
space:
mode:
authorTopi Reinio <topi.reinio@qt.io>2020-07-15 14:15:25 +0200
committerTopi Reinio <topi.reinio@qt.io>2020-07-15 20:35:27 +0200
commitf68e83d7634c929bef57fc534861768bb9785c74 (patch)
treec91ab0a68744b29461778c49bda059e310069e7b /src/qdoc/cppcodeparser.cpp
parent87fdeb7f99e08c5f670298fafa7e5a19ce8e71b8 (diff)
downloadqttools-f68e83d7634c929bef57fc534861768bb9785c74.tar.gz
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 <paul.wicking@qt.io>
Diffstat (limited to 'src/qdoc/cppcodeparser.cpp')
-rw-r--r--src/qdoc/cppcodeparser.cpp5
1 files changed, 5 insertions, 0 deletions
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<QmlPropertyNode *>(node)->setRequired();
} else if ((command == COMMAND_QMLABSTRACT) || (command == COMMAND_ABSTRACT)) {
if (node->isQmlType() || node->isJsType())
node->setAbstract(true);