diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2024-06-05 10:27:11 +0200 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2024-09-05 09:34:39 +0200 |
| commit | 752c1161d75f8c01e2c6c6b07ba02e9a62e65b10 (patch) | |
| tree | 98ee15ed2be45f1ec29a8f5fba48a270fd07fc41 /sources/shiboken6/ApiExtractor/qtdocparser.cpp | |
| parent | 9b0dc50ff1e8d5234eac94263659c68c2cb9524f (diff) | |
Documentation: Adapt paths for 6.8
Adapt to qttools/c51980bb0d9658f2ade4de1900d07b08e88cb52d.
Task-number: QTBUG-77650
Task-number: PYSIDE-2620
Change-Id: Icc083c9b3d768093f45caa5d7a3c54aec5eb2d4f
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/shiboken6/ApiExtractor/qtdocparser.cpp')
| -rw-r--r-- | sources/shiboken6/ApiExtractor/qtdocparser.cpp | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/sources/shiboken6/ApiExtractor/qtdocparser.cpp b/sources/shiboken6/ApiExtractor/qtdocparser.cpp index 120422182..b72de8b9c 100644 --- a/sources/shiboken6/ApiExtractor/qtdocparser.cpp +++ b/sources/shiboken6/ApiExtractor/qtdocparser.cpp @@ -37,6 +37,27 @@ Documentation QtDocParser::retrieveModuleDocumentation() return retrieveModuleDocumentation(packageName()); } +// Return the qdoc dir "PySide6.QtGui.QPainter" -> "qtgui/webxml" (QTBUG-119500) +QString QtDocParser::qdocModuleDir(const QString &pythonType) +{ + QString package = pythonType; + if (package.startsWith("PySide6."_L1)) + package.remove(0, 8); + auto dot = package.indexOf(u'.'); + if (dot != -1) + package.truncate(dot); + return package.toLower() + "/webxml"_L1; +} + +static QString xmlFileNameRoot(const AbstractMetaClassPtr &metaClass) +{ + QString className = metaClass->qualifiedCppName().toLower(); + className.replace("::"_L1, "-"_L1); + + return QtDocParser::qdocModuleDir(metaClass->typeEntry()->targetLangPackage()) + + u'/' + className; +} + static void formatPreQualifications(QTextStream &str, const AbstractMetaType &type) { if (type.isConstant()) @@ -208,12 +229,15 @@ static QString extractBrief(QString *value) // Find the webxml file for global functions/enums // by the doc-file typesystem attribute or via include file. static QString findGlobalWebXmLFile(const QString &documentationDataDirectory, + const QString &package, const QString &docFile, const Include &include) { QString result; + const QString root = documentationDataDirectory + u'/' + + QtDocParser::qdocModuleDir(package) + u'/'; if (!docFile.isEmpty()) { - result = documentationDataDirectory + u'/' + docFile; + result = root + docFile; if (!result.endsWith(webxmlSuffix)) result += webxmlSuffix; return QFileInfo::exists(result) ? result : QString{}; @@ -221,8 +245,7 @@ static QString findGlobalWebXmLFile(const QString &documentationDataDirectory, if (include.name().isEmpty()) return {}; // qdoc "\headerfile <QtLogging>" directive produces "qtlogging.webxml" - result = documentationDataDirectory + u'/' + - QFileInfo(include.name()).baseName() + webxmlSuffix; + result = root + QFileInfo(include.name()).baseName() + webxmlSuffix; if (QFileInfo::exists(result)) return result; // qdoc "\headerfile <qdrawutil.h>" produces "qdrawutil-h.webxml" @@ -237,7 +260,7 @@ void QtDocParser::fillGlobalFunctionDocumentation(const AbstractMetaFunctionPtr return; const QString sourceFileName = - findGlobalWebXmLFile(documentationDataDirectory(), te->docFile(), te->include()); + findGlobalWebXmLFile(documentationDataDirectory(), te->targetLangPackage(), te->docFile(), te->include()); if (sourceFileName.isEmpty()) return; @@ -260,7 +283,7 @@ void QtDocParser::fillGlobalEnumDocumentation(AbstractMetaEnum &e) { auto te = e.typeEntry(); const QString sourceFileName = - findGlobalWebXmLFile(documentationDataDirectory(), te->docFile(), te->include()); + findGlobalWebXmLFile(documentationDataDirectory(), te->targetLangPackage(), te->docFile(), te->include()); if (sourceFileName.isEmpty()) return; @@ -288,9 +311,7 @@ void QtDocParser::fillDocumentation(const AbstractMetaClassPtr &metaClass) context = context->enclosingClass(); } - QString sourceFileRoot = documentationDataDirectory() + u'/' - + metaClass->qualifiedCppName().toLower(); - sourceFileRoot.replace(u"::"_s, u"-"_s); + QString sourceFileRoot = documentationDataDirectory() + u'/' + xmlFileNameRoot(metaClass); QFileInfo sourceFile(sourceFileRoot + webxmlSuffix); if (!sourceFile.exists()) |
