summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTopi Reinio <topi.reinio@qt.io>2019-10-14 11:47:05 +0200
committerTopi Reinio <topi.reinio@qt.io>2019-10-14 12:12:39 +0200
commitd10045175f1a943e7e89fc43d15a276d6f0f9fcc (patch)
treebd85e1d24242dbd3389907194875b1c15462c3d0
parent68967cba72b03b5d0a713204805ec5b399dd6fb1 (diff)
qdoc: Warn when writing QML import statement with incomplete information
The module import info for a QML type is provided by the QML module node, and the QML type documentation must include the \inqmlmodule command, unless QDoc was able to resolve it based on the 'project' name. Change-Id: I4bb3365c83de042597fb0b799329c814b9da5d3f Reviewed-by: Paul Wicking <paul.wicking@qt.io>
-rw-r--r--src/qdoc/htmlgenerator.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/qdoc/htmlgenerator.cpp b/src/qdoc/htmlgenerator.cpp
index 7810e7793..8bbdf3e9e 100644
--- a/src/qdoc/htmlgenerator.cpp
+++ b/src/qdoc/htmlgenerator.cpp
@@ -2419,6 +2419,13 @@ void HtmlGenerator::generateQmlRequisites(QmlTypeNode *qcn, CodeMarker *marker)
logicalModuleVersion = collection->logicalModuleVersion();
else
logicalModuleVersion = qcn->logicalModuleVersion();
+
+ if (logicalModuleVersion.isEmpty() || qcn->logicalModuleName().isEmpty())
+ qcn->doc().location().warning(tr("Could not resolve QML import "
+ "statement for type '%1'").arg(qcn->name()),
+ tr("Maybe you forgot to use the "
+ "'\\%1' command?").arg(COMMAND_INQMLMODULE));
+
text.clear();
text << "import " + qcn->logicalModuleName() + QLatin1Char(' ') + logicalModuleVersion;
requisites.insert(importText, text);