diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2025-08-27 12:43:17 +0200 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2025-08-29 15:16:30 +0200 |
| commit | 6a6cf8d6c66e130b541f3d041d0da609f8b97dd0 (patch) | |
| tree | 2709e90612ac344bec184734b591d78cd27e42e2 | |
| parent | 04b23db0cd3e6365e231cabfb43ea393694c6017 (diff) | |
shiboken6: Fix values of deprecated converter compatibility indexes
Somehow, by rearranging functions, the values of the converter
compatibility indexes were doubled, too, like the type indexes where
the underlying array was expanded. Maintain the correct value for the
converter compatibility indexes.
Amends 7f69d4d562e1d19efd2c505dceea387a4a87dcfe.
Pick-to: 6.9 6.8 6.5
Task-number: PYSIDE-2404
Change-Id: Iebd5b816090e5dcff3b122f17dbb18756f59e83a
Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
Reviewed-by: Ece Cinucen <ece.cinucen@qt.io>
| -rw-r--r-- | sources/shiboken6/generator/shiboken/headergenerator.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/sources/shiboken6/generator/shiboken/headergenerator.cpp b/sources/shiboken6/generator/shiboken/headergenerator.cpp index 8c8f72241..181f04a9d 100644 --- a/sources/shiboken6/generator/shiboken/headergenerator.cpp +++ b/sources/shiboken6/generator/shiboken/headergenerator.cpp @@ -728,17 +728,25 @@ HeaderGenerator::IndexValues HeaderGenerator::collectConverterIndexes() const } // PYSIDE-2404: Write the enums in unchanged case for reuse in type imports. -// For conpatibility, we create them in uppercase, too and with +// For compatibility, we create them in uppercase, too and with // doubled index for emulating the former type-only case. // // FIXME: Remove in PySide 7. (See the note in `parser.py`) -// -static IndexValue typeIndexUpper(struct IndexValue const &ti) + +static IndexValue indexUpper(IndexValue ti) // converter indexes (old macro compatibility) { QString modi = ti.name.toUpper(); if (modi == ti.name) - modi = u"// "_s + modi; - return {modi, ti.value * 2, ti.comment}; + modi.prepend("// "_L1); + ti.name = modi; + return ti; +} + +static IndexValue typeIndexUpper(const IndexValue &ti) // type indexes (PYSIDE-2404) +{ + IndexValue result = indexUpper(ti); + result.value *= 2; + return result; } bool HeaderGenerator::finishGeneration() @@ -788,7 +796,7 @@ bool HeaderGenerator::finishGeneration() const auto converterIndexes = collectConverterIndexes(); macrosStream << "// Converter indices\nenum [[deprecated]] : int {\n"; for (const auto &ci : converterIndexes) - macrosStream << typeIndexUpper(ci); + macrosStream << indexUpper(ci); macrosStream << "};\n\n"; macrosStream << "// Converter indices\nenum : int {\n"; |
