diff options
author | Venugopal Shivashankar <Venugopal.Shivashankar@qt.io> | 2019-02-26 12:54:02 +0100 |
---|---|---|
committer | Venugopal Shivashankar <Venugopal.Shivashankar@qt.io> | 2019-03-12 14:15:24 +0000 |
commit | 369bbbfb5aca70a7d1f8a32bd36a3d3c41721ffa (patch) | |
tree | cf226280d2659a1e4337b6ad82751910d16bfaf7 /src | |
parent | 177b92c4d499b6ffc5986d7c46c8c3c98d08f130 (diff) | |
download | qttools-369bbbfb5aca70a7d1f8a32bd36a3d3c41721ffa.tar.gz |
qdoc: Add support for documenting pyside examples
At the moment, qdoc cannot generate documentation
for python examples as it expects a .pro or
.qmlproject file for every \example command it
finds. Since Qt Creator v4.9, developers can create
a python project using the New Project wizard, which
means qdoc could use the .pyproject file to verify
the python example.
Change-Id: Idcecdffe4f798bd1409123f988e3b826247aed72
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Martin Smith <martin.smith@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/qdoc/cppcodeparser.cpp | 19 | ||||
-rw-r--r-- | src/qdoc/htmlgenerator.cpp | 5 |
2 files changed, 16 insertions, 8 deletions
diff --git a/src/qdoc/cppcodeparser.cpp b/src/qdoc/cppcodeparser.cpp index cc077f440..a4fb0fd93 100644 --- a/src/qdoc/cppcodeparser.cpp +++ b/src/qdoc/cppcodeparser.cpp @@ -909,12 +909,19 @@ void CppCodeParser::setExampleFileLists(PageNode *pn) exampleDirs, proFileName); if (fullPath.isEmpty()) { - QString details = QLatin1String("Example directories: ") + exampleDirs.join(QLatin1Char(' ')); - if (!exampleFiles.isEmpty()) - details += QLatin1String(", example files: ") + exampleFiles.join(QLatin1Char(' ')); - pn->location().warning(tr("Cannot find file '%1' or '%2'").arg(tmp).arg(proFileName), details); - pn->location().warning(tr(" EXAMPLE PATH DOES NOT EXIST: %1").arg(examplePath), details); - return; + proFileName = examplePath + QLatin1Char('/') + examplePath.split(QLatin1Char('/')).last() + ".pyproject"; + fullPath = Config::findFile(pn->doc().location(), + exampleFiles, + exampleDirs, + proFileName); + if (fullPath.isEmpty()) { + QString details = QLatin1String("Example directories: ") + exampleDirs.join(QLatin1Char(' ')); + if (!exampleFiles.isEmpty()) + details += QLatin1String(", example files: ") + exampleFiles.join(QLatin1Char(' ')); + pn->location().warning(tr("Cannot find file '%1' or '%2'").arg(tmp).arg(proFileName), details); + pn->location().warning(tr(" EXAMPLE PATH DOES NOT EXIST: %1").arg(examplePath), details); + return; + } } } } diff --git a/src/qdoc/htmlgenerator.cpp b/src/qdoc/htmlgenerator.cpp index c65d2d3ee..69e1d9852 100644 --- a/src/qdoc/htmlgenerator.cpp +++ b/src/qdoc/htmlgenerator.cpp @@ -4587,7 +4587,7 @@ void HtmlGenerator::generateManifestFile(const QString &manifest, const QString writer.writeAttribute("docUrl", docUrl); QStringList proFiles; foreach (const QString file, en->files()) { - if (file.endsWith(".pro") || file.endsWith(".qmlproject")) + if (file.endsWith(".pro") || file.endsWith(".qmlproject") || file.endsWith(".pyproject")) proFiles << file; } if (!proFiles.isEmpty()) { @@ -4600,7 +4600,8 @@ void HtmlGenerator::generateManifestFile(const QString &manifest, const QString for (int j = 0; j < proFiles.size(); j++) { if (proFiles[j].endsWith(QStringLiteral("%1/%1.pro").arg(exampleName)) - || proFiles[j].endsWith(QStringLiteral("%1/%1.qmlproject").arg(exampleName))) { + || proFiles[j].endsWith(QStringLiteral("%1/%1.qmlproject").arg(exampleName)) + || proFiles[j].endsWith(QStringLiteral("%1/%1.pyproject").arg(exampleName))) { writer.writeAttribute("projectPath", examplesPath + proFiles[j]); proWithExampleNameFound = true; break; |