diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-11-26 18:20:21 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-11-27 16:07:14 +0100 |
commit | 6fd1e6619b0aeef1f7e916e474693157450e765f (patch) | |
tree | 023f5c29867010d5fec8a6b1b17e279898aab0f8 /sources | |
parent | 742a39962f1ba9c0e42f387394768c13793144c0 (diff) |
snippets_translate: Handle header files as well
Use suffix .h.py for them to distinguish them from .cpp files.
Pick-to: 6.2
Task-number: PYSIDE-1721
Change-Id: Iea4bfa770833f319b65c1ea7f83fb1a325ce8c62
Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources')
-rw-r--r-- | sources/shiboken6/generator/qtdoc/qtxmltosphinx.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sources/shiboken6/generator/qtdoc/qtxmltosphinx.cpp b/sources/shiboken6/generator/qtdoc/qtxmltosphinx.cpp index ce0f794b0..13a8026ae 100644 --- a/sources/shiboken6/generator/qtdoc/qtxmltosphinx.cpp +++ b/sources/shiboken6/generator/qtdoc/qtxmltosphinx.cpp @@ -489,10 +489,12 @@ QString QtXmlToSphinx::readFromLocations(const QStringList &locations, const QSt const QString &identifier, QString *errorMessage) { QString resolvedPath; - if (path.endsWith(QLatin1String(".cpp"))) { - const QString pySnippet = path.left(path.size() - 3) + QLatin1String("py"); - resolvedPath = resolveFile(locations, pySnippet); - } + // Try Python snippets first. + if (path.endsWith(u".cpp")) + resolvedPath = resolveFile(locations, path.left(path.size() - 3) + u"py"_qs); + else if (path.endsWith(u".h")) + resolvedPath = resolveFile(locations, path + u".py"_qs); + if (resolvedPath.isEmpty()) resolvedPath = resolveFile(locations, path); if (resolvedPath.isEmpty()) { |