diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-02-08 21:33:07 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-02-09 10:57:32 +0000 |
commit | a1808bb2c8c002c4aa2481ba9d553cf70c94d6b1 (patch) | |
tree | b41c1dc167288a15508e690fa1713b35a0f7b572 /sources | |
parent | 4114b61d9a18485aa024a44094dc405cc81a30a8 (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.
Task-number: PYSIDE-841
Change-Id: I173979b9a527121b95bcb0190f603c02565bc282
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
(cherry picked from commit 2e43fc4cfd997de48eae352a8a42936f6e4b3785)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'sources')
-rw-r--r-- | sources/shiboken6/generator/qtdoc/qtdocgenerator.cpp | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/sources/shiboken6/generator/qtdoc/qtdocgenerator.cpp b/sources/shiboken6/generator/qtdoc/qtdocgenerator.cpp index 06358862d..18536a639 100644 --- a/sources/shiboken6/generator/qtdoc/qtdocgenerator.cpp +++ b/sources/shiboken6/generator/qtdoc/qtdocgenerator.cpp @@ -861,8 +861,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()) { @@ -870,21 +872,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()); @@ -898,7 +902,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(); |