aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2021-02-08 21:33:07 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2021-02-09 09:10:10 +0100
commit2e43fc4cfd997de48eae352a8a42936f6e4b3785 (patch)
tree6b0a34afc22927d9853e32111f28295f0c6c5560
parent13e63be261a89ed9c051028225d63a30b1f005af (diff)
shiboken6/Documentation: Fix the extra sections
The file filter used for filtering the extra documents did not include the '.', so, the module description QtXmlPatterns.rst was added as an extra document for QtXml. Add the dot to the filter and sort the result. Use QDir::entryInfoList() since it is faster and gives the full path. Pick-to: 6.0 Task-number: PYSIDE-841 Change-Id: I173979b9a527121b95bcb0190f603c02565bc282 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
-rw-r--r--sources/shiboken6/generator/qtdoc/qtdocgenerator.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/sources/shiboken6/generator/qtdoc/qtdocgenerator.cpp b/sources/shiboken6/generator/qtdoc/qtdocgenerator.cpp
index 0061237f2..1d4381e3f 100644
--- a/sources/shiboken6/generator/qtdoc/qtdocgenerator.cpp
+++ b/sources/shiboken6/generator/qtdoc/qtdocgenerator.cpp
@@ -848,8 +848,10 @@ void QtDocGenerator::writeModuleDocumentation()
// Store the it.key() in a QString so that it can be stripped off unwanted
// information when neeeded. For example, the RST files in the extras directory
// doesn't include the PySide# prefix in their names.
- const QString moduleName = it.key();
+ QString moduleName = it.key();
const int lastIndex = moduleName.lastIndexOf(QLatin1Char('.'));
+ if (lastIndex >= 0)
+ moduleName.remove(0, lastIndex + 1);
// Search for extra-sections
if (!m_extraSectionDir.isEmpty()) {
@@ -857,21 +859,23 @@ void QtDocGenerator::writeModuleDocumentation()
if (!extraSectionDir.exists())
qCWarning(lcShibokenDoc) << m_extraSectionDir << "doesn't exist";
- QStringList fileList = extraSectionDir.entryList(QStringList() << (moduleName.mid(lastIndex + 1) + QLatin1String("?*.rst")), QDir::Files);
- QStringList::iterator it2 = fileList.begin();
- for (; it2 != fileList.end(); ++it2) {
- QString origFileName(*it2);
- it2->remove(0, moduleName.indexOf(QLatin1Char('.')));
- QString newFilePath = outputDir + QLatin1Char('/') + *it2;
+ // Filter for "QtCore.Property.rst", skipping module doc "QtCore.rst"
+ const QString filter = moduleName + QLatin1String(".?*.rst");
+ const auto fileList =
+ extraSectionDir.entryInfoList({filter}, QDir::Files, QDir::Name);
+ for (const auto &fi : fileList) {
+ // Strip to "Property.rst" in output directory
+ const QString newFileName = fi.fileName().mid(moduleName.size() + 1);
+ it.value().append(newFileName);
+ const QString newFilePath = outputDir + QLatin1Char('/') + newFileName;
if (QFile::exists(newFilePath))
QFile::remove(newFilePath);
- if (!QFile::copy(m_extraSectionDir + QLatin1Char('/') + origFileName, newFilePath)) {
+ if (!QFile::copy(fi.absoluteFilePath(), newFilePath)) {
qCDebug(lcShibokenDoc).noquote().nospace() << "Error copying extra doc "
- << QDir::toNativeSeparators(m_extraSectionDir + QLatin1Char('/') + origFileName)
+ << QDir::toNativeSeparators(fi.absoluteFilePath())
<< " to " << QDir::toNativeSeparators(newFilePath);
}
}
- it.value().append(fileList);
}
writeFancyToc(s, it.value());
@@ -885,7 +889,8 @@ void QtDocGenerator::writeModuleDocumentation()
<< "Detailed Description\n--------------------\n\n";
// module doc is always wrong and C++istic, so go straight to the extra directory!
- QFile moduleDoc(m_extraSectionDir + QLatin1Char('/') + moduleName.mid(lastIndex + 1) + QLatin1String(".rst"));
+ QFile moduleDoc(m_extraSectionDir + QLatin1Char('/') + moduleName
+ + QLatin1String(".rst"));
if (moduleDoc.open(QIODevice::ReadOnly | QIODevice::Text)) {
s << moduleDoc.readAll();
moduleDoc.close();