aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/PySide6/glue/qtgui.cpp
diff options
context:
space:
mode:
authorCristián Maureira-Fredes <Cristian.Maureira-Fredes@qt.io>2023-07-14 15:38:45 +0200
committerCristian Maureira-Fredes <cristian.maureira-fredes@qt.io>2023-07-25 19:01:43 +0000
commit12ba61a242312edb3fe6a19f9f03f578d55336a5 (patch)
treeaf8eada37caea3336d900f9225765395805e8516 /sources/pyside6/PySide6/glue/qtgui.cpp
parentfde182c043e6366994175390df1e2dea1c65d768 (diff)
Fix stub and signature for QClipboard setPixmap and setImage
Incorrectly, the pyi file described that it was possible to pass a: Union[PySide6.QtGui.QPixmap, PySide6.QtGui.QImage, str] for setPixmap, and: Union[PySide6.QtGui.QImage, str] for setImage. This uses the typesystem entry to restrict the setPixmap to accept a QPixmap and only a QImage for setImage. Additionally, this enable a PyPathLike signature, so users can pass 'str', 'bytes', 'pathlib.Path' as well, so the accepted arguments are: setImage(...) - PySide6.QtGui.QImage - Union[str, bytes, os.PathLike] setPixmap(...): - PySide6.QtGui.QPixmap - Union[str, bytes, os.PathLike] Pick-to: 6.5 Fixes: PYSIDE-2395 Change-Id: I521980dbc781a72e54f49fc84af5349733385133 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
Diffstat (limited to 'sources/pyside6/PySide6/glue/qtgui.cpp')
-rw-r--r--sources/pyside6/PySide6/glue/qtgui.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/sources/pyside6/PySide6/glue/qtgui.cpp b/sources/pyside6/PySide6/glue/qtgui.cpp
index 38e01f24c..443495389 100644
--- a/sources/pyside6/PySide6/glue/qtgui.cpp
+++ b/sources/pyside6/PySide6/glue/qtgui.cpp
@@ -371,6 +371,16 @@ const auto path = PySide::pyPathToQString(%PYARG_1);
%CPPSELF->addPixmap(path);
// @snippet qicon-addpixmap
+// @snippet qclipboard-setpixmap
+const auto path = PySide::pyPathToQString(%PYARG_1);
+%CPPSELF->setPixmap(QPixmap(path));
+// @snippet qclipboard-setpixmap
+
+// @snippet qclipboard-setimage
+const auto path = PySide::pyPathToQString(%PYARG_1);
+%CPPSELF->setImage(QImage(path));
+// @snippet qclipboard-setimage
+
// @snippet qimage-decref-image-data
static void imageDecrefDataHandler(void *data)
{