aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2/PySide2/typesystem_templates.xml
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2018-10-25 10:30:50 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2018-10-26 09:19:40 +0000
commitf4a6d74852b0ba6711195a9c3fc9356e677a3409 (patch)
treee35347e8819a7d1aed00846d4ec24611930a164c /sources/pyside2/PySide2/typesystem_templates.xml
parent33bb2851ffbdc2f22cca1293ac2a5c185bf799e2 (diff)
PySide2: Re-enable native event filters
Add QAbstractNativeEventFilter. Re-add the native event filter functions on QWindow and QWidget, modified to return a tuple bool/long, using a modification from PySide. Task-number: PYSIDE-790 Change-Id: I86fef1a0c168e69fb3391cd882ea05190985384d Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'sources/pyside2/PySide2/typesystem_templates.xml')
-rw-r--r--sources/pyside2/PySide2/typesystem_templates.xml20
1 files changed, 20 insertions, 0 deletions
diff --git a/sources/pyside2/PySide2/typesystem_templates.xml b/sources/pyside2/PySide2/typesystem_templates.xml
index 1a140906b..a7a7bfc9d 100644
--- a/sources/pyside2/PySide2/typesystem_templates.xml
+++ b/sources/pyside2/PySide2/typesystem_templates.xml
@@ -361,6 +361,26 @@
Py_INCREF(%PYARG_0);
</template>
+ <!-- Helpers for modifying "bool nativeEventFilter(QByteArray, void*, long *result)"
+ to return a tuple of bool,long -->
+ <template name="return_native_eventfilter_conversion_variables">
+ long resultVar{0};
+ long *%out = &amp;resultVar;
+ </template>
+ <template name="return_native_eventfilter_conversion">
+ %RETURN_TYPE %out = false;
+ if (PySequence_Check(%PYARG_0) &amp;&amp; (PySequence_Size(%PYARG_0) == 2)) {
+ Shiboken::AutoDecRef pyItem(PySequence_GetItem(%PYARG_0, 0));
+ %out = %CONVERTTOCPP[bool](pyItem);
+ }
+ </template>
+
+ <template name="return_native_eventfilter">
+ %PYARG_0 = PyTuple_New(2);
+ PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](%0));
+ PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[long](*result_out));
+ </template>
+
<!-- templates for __reduce__ -->
<template name="reduce_code">
%PYARG_0 = Py_BuildValue("(N(%REDUCE_FORMAT))", PyObject_Type(%PYSELF), %REDUCE_ARGS);