From d10045175f1a943e7e89fc43d15a276d6f0f9fcc Mon Sep 17 00:00:00 2001 From: Topi Reinio <topi.reinio@qt.io> Date: Mon, 14 Oct 2019 11:47:05 +0200 Subject: [PATCH] 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> --- src/qdoc/htmlgenerator.cpp | 7 +++++++ 1 file changed, 7 insertions(+) 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); -- GitLab