aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/PySide6/glue/qtgui.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2021-09-30 14:10:42 +0200
committerChristian Tismer <tismer@stackless.com>2021-10-27 16:22:34 +0200
commit3aab0899ef4f966d3a37c0e95b0e7d0f047de3e0 (patch)
tree20f31210538616eeb7759add719d918d2c716b33 /sources/pyside6/PySide6/glue/qtgui.cpp
parent73415e134b75876d547667c6eeb7052f76750687 (diff)
Fix QIcon.addPixmap() to accept a PyPathLike argument
By modifying functions to accept a PyPathLike argument, we saw the side-effect of disabling implicit conversions. In an alternative branch, we tried to re-enable implicit conversion by adding new functions with a PyPathLike argument. This worked, but had drawbacks: * the signatures become redundant, and some post-processing must be implemented * the implicit conversion works fine, but only with a string argument. Much better would be to supply a PyPathLike This patch leaves the modifications of function arguments and simply adds the missing icon.addPixmap(PyPathLike). Other implicit conversions which might be found missing should be added the same way. [ChangeLog][shiboken6] The implicit conversion of icon.addPixmap(str) was replaced by an explicit version which takes PyPathLike. Change-Id: I48a2887e28473718f027059df2aafdd516f66dc3 Fixes: PYSIDE-1669 Task-number: PYSIDE-1499 Pick-to: 6.2 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/pyside6/PySide6/glue/qtgui.cpp')
-rw-r--r--sources/pyside6/PySide6/glue/qtgui.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/sources/pyside6/PySide6/glue/qtgui.cpp b/sources/pyside6/PySide6/glue/qtgui.cpp
index 81181dac4..39d5bf0ae 100644
--- a/sources/pyside6/PySide6/glue/qtgui.cpp
+++ b/sources/pyside6/PySide6/glue/qtgui.cpp
@@ -255,6 +255,11 @@ for (Py_ssize_t i = 0; i < count; ++i){
%0 = new %TYPE(QPixmap::fromImage(%1));
// @snippet qpixmap
+// @snippet qicon-addpixmap
+const auto path = PySide::pyPathToQString(%PYARG_1);
+%CPPSELF->addPixmap(path);
+// @snippet qicon-addpixmap
+
// @snippet qimage-decref-image-data
static void imageDecrefDataHandler(void *data)
{