diff options
Diffstat (limited to 'sources/pyside6/PySide6')
| -rw-r--r-- | sources/pyside6/PySide6/QtGui/typesystem_gui_common.xml | 4 | ||||
| -rw-r--r-- | sources/pyside6/PySide6/glue/qtgui.cpp | 16 | ||||
| -rw-r--r-- | sources/pyside6/PySide6/templates/gui_common.xml | 9 |
3 files changed, 15 insertions, 14 deletions
diff --git a/sources/pyside6/PySide6/QtGui/typesystem_gui_common.xml b/sources/pyside6/PySide6/QtGui/typesystem_gui_common.xml index 29c5b11e5..49399bc72 100644 --- a/sources/pyside6/PySide6/QtGui/typesystem_gui_common.xml +++ b/sources/pyside6/PySide6/QtGui/typesystem_gui_common.xml @@ -365,9 +365,7 @@ <enum-type name="StandardKey"/> <add-function signature="__repr__" return-type="PyObject*"> - <inject-code class="target" position="beginning"> - <insert-template name="qkeysequence_repr"/> - </inject-code> + <inject-code class="target" position="beginning" file="../glue/qtgui.cpp" snippet="qkeysequence-repr"/> </add-function> <add-function signature="__reduce__" return-type="PyObject*"> diff --git a/sources/pyside6/PySide6/glue/qtgui.cpp b/sources/pyside6/PySide6/glue/qtgui.cpp index 22c5d70fc..52bf78151 100644 --- a/sources/pyside6/PySide6/glue/qtgui.cpp +++ b/sources/pyside6/PySide6/glue/qtgui.cpp @@ -306,10 +306,22 @@ if (_i < 0 || _i >= %CPPSELF.count()) { PyErr_SetString(PyExc_IndexError, "index out of bounds"); return 0; } -int item = (*%CPPSELF)[_i]; -return %CONVERTTOPYTHON[int](item); +QKeyCombination item = (*%CPPSELF)[_i]; +if (usingNewEnum()) + return %CONVERTTOPYTHON[QKeyCombination](item); +auto combined = item.toCombined(); +return %CONVERTTOPYTHON[int](combined); // @snippet qkeysequence-getitem +// @snippet qkeysequence-repr +auto ObTuple_Type = reinterpret_cast<PyObject *>(&PyTuple_Type); +auto ObSelf_Type = reinterpret_cast<PyObject *>(Py_TYPE(%PYSELF)); +Shiboken::AutoDecRef surrogate(PyObject_CallFunctionObjArgs(ObTuple_Type, %PYSELF, nullptr)); +Shiboken::AutoDecRef argstr(PyObject_Repr(surrogate)); +Shiboken::AutoDecRef name(PyObject_GetAttrString(ObSelf_Type, "__name__")); +return PyUnicode_Concat(name, argstr); +// @snippet qkeysequence-repr + // @snippet qpicture-data %PYARG_0 = Shiboken::Buffer::newObject(%CPPSELF.data(), %CPPSELF.size()); // @snippet qpicture-data diff --git a/sources/pyside6/PySide6/templates/gui_common.xml b/sources/pyside6/PySide6/templates/gui_common.xml index 94538dd63..c059a2a3d 100644 --- a/sources/pyside6/PySide6/templates/gui_common.xml +++ b/sources/pyside6/PySide6/templates/gui_common.xml @@ -93,15 +93,6 @@ } </template> - <template name="qkeysequence_repr"> - QString result; - QDebug debug(&result); - debug.noquote(); - debug.nospace(); - debug << (*%CPPSELF); - %PYARG_0 = Shiboken::String::fromCString(result.toUtf8().constData()); - </template> - <template name="validator_conversionrule"> QValidator::State %out; |
