diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2025-09-10 07:44:05 +0200 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2025-09-12 11:21:38 +0200 |
| commit | 4fa9f5bb010af6aabd8b3dfc8f0ee059fcb5620f (patch) | |
| tree | 7459658472870a803377732e942cd960436523a9 /sources/pyside6 | |
| parent | cc2a2ab9916699b83685f76afa4ad84952449301 (diff) | |
Expose enumerations of deprecated namespace QAudio to QtAudio
Retrieve the enumerations from the type dict of "QAudio" and set them
on the type dict of "QtAudio" as is done for example in
feature_01_addLowerNames().
Complements 8fb5639ce7025456b1410f63d1463682117fe2f5,
adapting to qtmultimedia/e6d969fc3889387f0bcc136521f932fd4913927f.
Pick-to: 6.10
Change-Id: Ie3998bb4d8acd97a7659568a2ced15d81f6dd280
Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
Diffstat (limited to 'sources/pyside6')
| -rw-r--r-- | sources/pyside6/PySide6/QtMultimedia/typesystem_multimedia.xml | 18 | ||||
| -rw-r--r-- | sources/pyside6/PySide6/glue/qtmultimedia.cpp | 12 |
2 files changed, 29 insertions, 1 deletions
diff --git a/sources/pyside6/PySide6/QtMultimedia/typesystem_multimedia.xml b/sources/pyside6/PySide6/QtMultimedia/typesystem_multimedia.xml index f2aacf065..f62b1ec7d 100644 --- a/sources/pyside6/PySide6/QtMultimedia/typesystem_multimedia.xml +++ b/sources/pyside6/PySide6/QtMultimedia/typesystem_multimedia.xml @@ -21,11 +21,27 @@ </namespace-type> <namespace-type name="QtAudio"> -<!-- FIXME Somehow expose the (typedef'ed) enums from QAudio in QtAudio? +<!-- FIXME PYSIDE7: Remove namespace "QAudio" and enable the enums. <enum-type name="Error"/> <enum-type name="State"/> <enum-type name="VolumeScale"/> --> + <inject-code class="target" position="end" + file="../glue/qtmultimedia.cpp" + snippet="qtaudio-namespace-import-enums"/> + <modify-field name="NoError" remove="true"/> + <modify-field name="OpenError" remove="true"/> + <modify-field name="IOError" remove="true"/> + <modify-field name="UnderrunError" remove="true"/> + <modify-field name="FatalError" remove="true"/> + <modify-field name="ActiveState" remove="true"/> + <modify-field name="SuspendedState" remove="true"/> + <modify-field name="StoppedState" remove="true"/> + <modify-field name="IdleState" remove="true"/> + <modify-field name="LinearVolumeScale" remove="true"/> + <modify-field name="CubicVolumeScale" remove="true"/> + <modify-field name="LogarithmicVolumeScale" remove="true"/> + <modify-field name="DecibelVolumeScale" remove="true"/> </namespace-type> <namespace-type name="QtVideo" since="6.7"> diff --git a/sources/pyside6/PySide6/glue/qtmultimedia.cpp b/sources/pyside6/PySide6/glue/qtmultimedia.cpp index 457621638..65cefa5fc 100644 --- a/sources/pyside6/PySide6/glue/qtmultimedia.cpp +++ b/sources/pyside6/PySide6/glue/qtmultimedia.cpp @@ -26,3 +26,15 @@ const auto size = %CPPSELF.byteCount(); const float result = QtAudio::convertVolume(%1, %2, %3); %PYARG_0 = %CONVERTTOPYTHON[float](result); // @snippet qaudio-convertvolume + +// @snippet qtaudio-namespace-import-enums +Shiboken::AutoDecRef qAudio(PyObject_GetAttrString(module, "QAudio")); +if (!qAudio.isNull()) { + Shiboken::AutoDecRef qAudioTypeDict(PepType_GetDict(reinterpret_cast<PyTypeObject *>(qAudio.object()))); + Shiboken::AutoDecRef qtAudioTypeDict(PepType_GetDict(pyType)); + for (const auto *oldEnum : {"Error", "State", "VolumeScale"}) { + if (auto *enumType = PyDict_GetItemString(qAudioTypeDict, oldEnum)) + PyDict_SetItemString(qtAudioTypeDict, oldEnum, enumType); + } +} +// @snippet qtaudio-namespace-import-enums |
