summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCristian Maureira-Fredes <cristian.maureira-fredes@qt.io>2018-12-03 16:25:12 +0100
committerCristian Maureira-Fredes <cristian.maureira-fredes@qt.io>2018-12-04 08:57:51 +0000
commitf9d4a28fef8b234b6ef173fc3d21408f67b37472 (patch)
tree81f90f9ec3a3ea199e2c4763c8160ce03e70b145
parentd50f02b661698243fbeb556bb407c13da9ae4718 (diff)
Cast PyLongs to WId
QScreen.grabWindow and QWindow.fromWinId have an WId as an argument. WId is treated as a PyLong internally, but with methods that need a WId we need to manually transform them to long. Change-Id: I97651704f37ae268455990a13884b92e8f1b643c Fixes: PYSIDE-863 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
-rw-r--r--sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml15
-rw-r--r--sources/pyside2/PySide2/glue/qtgui.cpp12
2 files changed, 26 insertions, 1 deletions
diff --git a/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml b/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml
index 16bce9d3..2181ff07 100644
--- a/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml
+++ b/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml
@@ -2515,6 +2515,12 @@
<insert-template name="return_native_eventfilter"/>
</inject-code>
</modify-function>
+ <modify-function signature="fromWinId(WId)">
+ <modify-argument index="1">
+ <replace-type modified-type="long"/>
+ </modify-argument>
+ <inject-code file="../glue/qtgui.cpp" snippet="qwindow-fromWinId"/>
+ </modify-function>
</object-type>
<object-type name="QGuiApplication">
@@ -2971,7 +2977,14 @@
<modify-function signature="glyphIndexesForChars(const QChar*,int,quint32*,int*)const" remove="all"/>
</value-type>
<object-type name="QRasterWindow"/>
- <object-type name="QScreen"/>
+ <object-type name="QScreen">
+ <modify-function signature="grabWindow(WId,int,int,int,int)">
+ <modify-argument index="1">
+ <replace-type modified-type="long"/>
+ </modify-argument>
+ <inject-code file="../glue/qtgui.cpp" snippet="qscreen-grabWindow"/>
+ </modify-function>
+ </object-type>
<object-type name="QStyleHints"/>
</typesystem>
diff --git a/sources/pyside2/PySide2/glue/qtgui.cpp b/sources/pyside2/PySide2/glue/qtgui.cpp
index a34bcff4..4ae3eef7 100644
--- a/sources/pyside2/PySide2/glue/qtgui.cpp
+++ b/sources/pyside2/PySide2/glue/qtgui.cpp
@@ -510,6 +510,18 @@ if (!PyTuple_SetItem(empty, 0, PyList_New(0))) {
}
// @snippet qguiapplication-2
+// @snippet qscreen-grabWindow
+WId id = %1;
+%RETURN_TYPE retval = %CPPSELF.%FUNCTION_NAME(id, %2, %3, %4, %5);
+%PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](retval);
+// @snippet qscreen-grabWindow
+
+// @snippet qwindow-fromWinId
+WId id = %1;
+%RETURN_TYPE retval = %CPPSELF.%FUNCTION_NAME(id);
+%PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](retval);
+// @snippet qwindow-fromWinId
+
/*********************************************************************
* CONVERSIONS
********************************************************************/