diff options
-rw-r--r-- | sources/pyside6/PySide6/QtCore/typesystem_core_common.xml | 4 | ||||
-rw-r--r-- | sources/pyside6/PySide6/QtGui/typesystem_gui_common.xml | 108 | ||||
-rw-r--r-- | sources/pyside6/PySide6/glue/qtcore.cpp | 6 | ||||
-rw-r--r-- | sources/pyside6/PySide6/templates/core_common.xml | 12 |
4 files changed, 119 insertions, 11 deletions
diff --git a/sources/pyside6/PySide6/QtCore/typesystem_core_common.xml b/sources/pyside6/PySide6/QtCore/typesystem_core_common.xml index f25385d7f..4f04d38af 100644 --- a/sources/pyside6/PySide6/QtCore/typesystem_core_common.xml +++ b/sources/pyside6/PySide6/QtCore/typesystem_core_common.xml @@ -2541,6 +2541,10 @@ </object-type> <object-type name="QEvent" polymorphic-id-expression="%1->type() == QEvent::None"> <enum-type name="Type"/> + <add-function signature="__repr__" return-type="PyObject"> + <inject-code class="target" position="beginning" + file="../glue/qtcore.cpp" snippet="repr-qevent"/> + </add-function> </object-type> <object-type name="QChildEvent" polymorphic-id-expression="%1->type() == QEvent::ChildAdded || %1->type() == QEvent::ChildPolished || %1->type() == QEvent::ChildRemoved"> <modify-function signature="child()const"> diff --git a/sources/pyside6/PySide6/QtGui/typesystem_gui_common.xml b/sources/pyside6/PySide6/QtGui/typesystem_gui_common.xml index 4ba90f58d..4c5a794ea 100644 --- a/sources/pyside6/PySide6/QtGui/typesystem_gui_common.xml +++ b/sources/pyside6/PySide6/QtGui/typesystem_gui_common.xml @@ -1390,20 +1390,49 @@ <value-type name="QEventPoint" since="6.0"> <enum-type name="State"/> </value-type> - <object-type name="QDragEnterEvent" polymorphic-id-expression="%1->type() == QEvent::DragEnter"/> - <object-type name="QDragLeaveEvent" polymorphic-id-expression="%1->type() == QEvent::DragLeave"/> - <object-type name="QDragMoveEvent" polymorphic-id-expression="%1->type() == QEvent::DragMove"/> + <object-type name="QDragEnterEvent" polymorphic-id-expression="%1->type() == QEvent::DragEnter"> + <add-function signature="__repr__" return-type="PyObject"> + <inject-code class="target" position="beginning"> + <insert-template name="repr_qdebug_gui"/> + </inject-code> + </add-function> + </object-type> + <object-type name="QDragLeaveEvent" polymorphic-id-expression="%1->type() == QEvent::DragLeave"> + <add-function signature="__repr__" return-type="PyObject"> + <inject-code class="target" position="beginning"> + <insert-template name="repr_qdebug_gui"/> + </inject-code> + </add-function> + </object-type> + <object-type name="QDragMoveEvent" polymorphic-id-expression="%1->type() == QEvent::DragMove"> + <add-function signature="__repr__" return-type="PyObject"> + <inject-code class="target" position="beginning"> + <insert-template name="repr_qdebug_gui"/> + </inject-code> + </add-function> + </object-type> <object-type name="QDropEvent" polymorphic-id-expression="%1->type() == QEvent::Drop"> <modify-function signature="source()const"> <modify-argument index="return"> <define-ownership class="target" owner="default"/> </modify-argument> </modify-function> + <add-function signature="__repr__" return-type="PyObject"> + <inject-code class="target" position="beginning"> + <insert-template name="repr_qdebug_gui"/> + </inject-code> + </add-function> </object-type> <object-type name="QEnterEvent" copyable="false" polymorphic-id-expression="%1->type() == QEvent::Enter"/> <object-type name="QExposeEvent" polymorphic-id-expression="%1->type() == QEvent::Expose"/> <object-type name="QFileOpenEvent" polymorphic-id-expression="%1->type() == QEvent::FileOpen"/> - <object-type name="QFocusEvent" polymorphic-id-expression="%1->type() == QEvent::FocusIn || %1->type() == QEvent::FocusOut"/> + <object-type name="QFocusEvent" polymorphic-id-expression="%1->type() == QEvent::FocusIn || %1->type() == QEvent::FocusOut"> + <add-function signature="__repr__" return-type="PyObject"> + <inject-code class="target" position="beginning"> + <insert-template name="repr_qdebug_gui"/> + </inject-code> + </add-function> + </object-type> <object-type name="QHelpEvent" copyable="false" polymorphic-id-expression="%1->type() == QEvent::ToolTip || %1->type() == QEvent::WhatsThis"/> <object-type name="QHideEvent" copyable="false" polymorphic-id-expression="%1->type() == QEvent::Hide"/> <object-type name="QHoverEvent" copyable="false" polymorphic-id-expression="%1->type() == QEvent::HoverEnter || %1->type() == QEvent::HoverLeave || %1->type() == QEvent::HoverMove"/> @@ -1415,35 +1444,75 @@ <value-type name="Attribute"> <include file-name="QInputMethodEvent" location="global"/> </value-type> + <add-function signature="__repr__" return-type="PyObject"> + <inject-code class="target" position="beginning"> + <insert-template name="repr_qdebug_gui"/> + </inject-code> + </add-function> <!-- endif ndef QT_NO_INPUTMETHOD --> </object-type> <object-type name="QInputMethodQueryEvent" copyable="false" polymorphic-id-expression="%1->type() == QEvent::InputMethodQuery"/> - <object-type name="QMoveEvent" copyable = "false" polymorphic-id-expression="%1->type() == QEvent::Move"/> + <object-type name="QMoveEvent" copyable = "false" polymorphic-id-expression="%1->type() == QEvent::Move"> + <add-function signature="__repr__" return-type="PyObject"> + <inject-code class="target" position="beginning"> + <insert-template name="repr_qdebug_gui"/> + </inject-code> + </add-function> + </object-type> <object-type name="QNativeGestureEvent" copyable="false" polymorphic-id-expression="%1->type() == QEvent::NativeGesture"/> <object-type name="QPlatformSurfaceEvent" copyable="false" polymorphic-id-expression="%1->type() == QEvent::PlatformSurface"> <enum-type name="SurfaceEventType"/> </object-type> - <object-type name="QResizeEvent" copyable = "false" polymorphic-id-expression="%1->type() == QEvent::Resize"/> + <object-type name="QResizeEvent" copyable = "false" polymorphic-id-expression="%1->type() == QEvent::Resize"> + <add-function signature="__repr__" return-type="PyObject"> + <inject-code class="target" position="beginning"> + <insert-template name="repr_qdebug_gui"/> + </inject-code> + </add-function> + </object-type> <object-type name="QShortcutEvent" copyable = "false" polymorphic-id-expression="%1->type() == QEvent::Shortcut"> </object-type> <object-type name="QShowEvent" copyable= "false" polymorphic-id-expression="%1->type() == QEvent::Show"/> <object-type name="QSinglePointEvent" copyable="false" since="6.0"/> <object-type name="QStatusTipEvent" copyable= "false" polymorphic-id-expression="%1->type() == QEvent::StatusTip"/> - <object-type name="QTabletEvent" copyable= "false" polymorphic-id-expression="%1->type() == QEvent::TabletMove || %1->type() == QEvent::TabletPress || %1->type() == QEvent::TabletRelease"/> + <object-type name="QTabletEvent" copyable= "false" polymorphic-id-expression="%1->type() == QEvent::TabletMove || %1->type() == QEvent::TabletPress || %1->type() == QEvent::TabletRelease"> + <add-function signature="__repr__" return-type="PyObject"> + <inject-code class="target" position="beginning"> + <insert-template name="repr_qdebug_gui"/> + </inject-code> + </add-function> + </object-type> <object-type name="QToolBarChangeEvent" polymorphic-id-expression="%1->type() == QEvent::ToolBarChange"/> <object-type name="QWhatsThisClickedEvent" copyable="false" polymorphic-id-expression="%1->type() == QEvent::WhatsThisClicked"/> - <object-type name="QWheelEvent" copyable= "false" polymorphic-id-expression="%1->type() == QEvent::Wheel"/> + <object-type name="QWheelEvent" copyable= "false" polymorphic-id-expression="%1->type() == QEvent::Wheel"> + <add-function signature="__repr__" return-type="PyObject"> + <inject-code class="target" position="beginning"> + <insert-template name="repr_qdebug_gui"/> + </inject-code> + </add-function> + </object-type> <!-- Qt5.5: suppress this nameless enum --> <suppress-warning text="enum 'QWheelEvent::DefaultDeltasPerStep' does not have a type entry or is not an enum"/> - <object-type name="QWindowStateChangeEvent" copyable="false" polymorphic-id-expression="%1->type() == QEvent::WindowStateChange"/> + <object-type name="QWindowStateChangeEvent" copyable="false" polymorphic-id-expression="%1->type() == QEvent::WindowStateChange"> + <add-function signature="__repr__" return-type="PyObject"> + <inject-code class="target" position="beginning"> + <insert-template name="repr_qdebug_gui"/> + </inject-code> + </add-function> + </object-type> <object-type name="QInputEvent" copyable="false"/> <object-type name="QKeyEvent" copyable= "false" polymorphic-id-expression="%1->type() == QEvent::KeyPress || %1->type() == QEvent::KeyRelease || %1->type() == QEvent::ShortcutOverride"> <add-function signature="operator!=(QKeySequence::StandardKey)"> <inject-code class="target" file="../glue/qtgui.cpp" snippet="qkeyevent-operatornotequal"/> </add-function> + <add-function signature="__repr__" return-type="PyObject"> + <inject-code class="target" position="beginning"> + <insert-template name="repr_qdebug_gui"/> + </inject-code> + </add-function> </object-type> <object-type name="QMouseEvent" copyable= "false" polymorphic-id-expression="%1->type() == QEvent::MouseButtonDblClick || %1->type() == QEvent::MouseButtonPress || %1->type() == QEvent::MouseButtonRelease || %1->type() == QEvent::MouseMove"> @@ -1456,12 +1525,23 @@ <modify-function signature="y() const" deprecated="yes"/> <modify-function signature="globalX() const" deprecated="yes"/> <modify-function signature="globalY() const" deprecated="yes"/> + <add-function signature="__repr__" return-type="PyObject"> + <inject-code class="target" position="beginning"> + <insert-template name="repr_qdebug_gui"/> + </inject-code> + </add-function> </object-type> <object-type name="QPaintEvent" copyable= "false" polymorphic-id-expression="%1->type() == QEvent::Paint"/> <object-type name="QScrollEvent" copyable="false" polymorphic-id-expression="%1->type() == QEvent::Scroll"> <enum-type name="ScrollState"/> </object-type> - <object-type name="QPointerEvent" copyable= "false" since="6.0"/> + <object-type name="QPointerEvent" copyable= "false" since="6.0"> + <add-function signature="__repr__" return-type="PyObject"> + <inject-code class="target" position="beginning"> + <insert-template name="repr_qdebug_gui"/> + </inject-code> + </add-function> + </object-type> <object-type name="QScrollPrepareEvent" copyable="false" polymorphic-id-expression="%1->type() == QEvent::ScrollPrepare"/> <object-type name="QTextFrame" > @@ -2366,7 +2446,13 @@ <modify-function signature="getEulerAngles(float*,float*,float*)const" since="5.5" remove="all"/> </value-type> - <object-type name="QTouchEvent" since="4.6"/> + <object-type name="QTouchEvent" since="4.6"> + <add-function signature="__repr__" return-type="PyObject"> + <inject-code class="target" position="beginning"> + <insert-template name="repr_qdebug_gui"/> + </inject-code> + </add-function> + </object-type> <object-type name="QInputDevice"> <enum-type name="Capability" flags="Capabilities"/> diff --git a/sources/pyside6/PySide6/glue/qtcore.cpp b/sources/pyside6/PySide6/glue/qtcore.cpp index 85d30053f..5452e9f7f 100644 --- a/sources/pyside6/PySide6/glue/qtcore.cpp +++ b/sources/pyside6/PySide6/glue/qtcore.cpp @@ -1560,3 +1560,9 @@ Py_INCREF(callable); %RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(cppCallback); %PYARG_0 = %CONVERTTOPYTHON[int](cppResult); // @snippet qthreadpool-trystart + +// @snippet repr-qevent +QString result; +QDebug(&result).nospace() << "<PySide6.QtCore.QEvent(" << %CPPSELF->type() << ")>"; +%PYARG_0 = Shiboken::String::fromCString(qPrintable(result)); +// @snippet repr-qevent diff --git a/sources/pyside6/PySide6/templates/core_common.xml b/sources/pyside6/PySide6/templates/core_common.xml index e26771461..d289f7665 100644 --- a/sources/pyside6/PySide6/templates/core_common.xml +++ b/sources/pyside6/PySide6/templates/core_common.xml @@ -249,6 +249,18 @@ %PYARG_0 = Shiboken::String::fromCString(qPrintable(format)); </template> + <template name="repr_qdebug"> + QString result; + QDebug(&result).nospace() << "<PySide6.MODULE." << %CPPSELF << '>'; + %PYARG_0 = Shiboken::String::fromCString(qPrintable(result)); + </template> + + <template name="repr_qdebug_gui"> + <insert-template name="repr_qdebug"> + <replace from="MODULE" to="QtGui"/> + </insert-template> + </template> + <template name="return_internal_pointer"> %PYARG_0 = reinterpret_cast<PyObject*>(%CPPSELF.%FUNCTION_NAME()); if (!%PYARG_0) |