aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/PySide6/glue/qtgui.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Expose QNativeInterface::QWaylandApplicationFriedemann Kleint8 days1-1/+7
| | | | | | | | | | [ChangeLog][PySide6] Bindings for QNativeInterface.QWaylandApplication have been added. Initial-patch-by: Mark Harfouche <[email protected]> Fixes: PYSIDE-2787 Change-Id: I3484fbd37cb4cd0ae70fde770eb9195a78f4b061 Reviewed-by: Shyamnath Premnadh <[email protected]>
* Move native interfaces out of the QtGui type system fileFriedemann Kleint2025-08-011-2/+3
| | | | | | | | | | | | It is bound to grow as more interfaces with more modifications are added. Rename the code snippet used for int conversion. Also add a test for X11. Task-number: PYSIDE-2787 Change-Id: Ia5f5cf7f0fbb551c38367d80e9fdb4b004db9085 Reviewed-by: Shyamnath Premnadh <[email protected]>
* PySide6: Change some templates to be snippetsFriedemann Kleint2025-02-201-0/+72
| | | | | | | | Brush up the code and remove unused templates. Pick-to: 6.8 Change-Id: Ic9a0a6fb941e0d110124df7f02b2fc3c91664656 Reviewed-by: Shyamnath Premnadh <[email protected]>
* shiboken6: Enable code snippets for templatesFriedemann Kleint2025-02-201-0/+118
| | | | | | | | | | | Prototypically move some template code from QtGui into snippets. [ChangeLog][shiboken6] It is now possible to use file snippets for XML template content. Change-Id: Ifb23407819c843e9059225a5bd269d954f837ee3 Reviewed-by: Shyamnath Premnadh <[email protected]>
* PySide6: Add QFont.Tag(str), QFont.Tag.fromString(), QFont.Tag.fromValue()Friedemann Kleint2025-02-131-0/+38
| | | | | | | | | | The constructor is a non-type template that checks the string length. Add a function for it. Pick-to: 6.8 Fixes: PYSIDE-3013 Change-Id: I35626c29edddf38c04c5b913a35b36c540c45d6a Reviewed-by: Cristian Maureira-Fredes <[email protected]>
* Adapt to 6.9Friedemann Kleint2025-02-061-0/+4
| | | | | | Fixes: PYSIDE-2862 Change-Id: I7cef186d1fb1e1b23cb62daa659db6fab2f460d9 Reviewed-by: Cristian Maureira-Fredes <[email protected]>
* limited api: Remove PyTuple_GET_ITEM, PyTuple_SET_ITEM, and PyTuple_GET_SIZE ↵Cristián Maureira-Fredes2024-11-081-15/+15
| | | | | | | | | | | macros Removing old macros for compatibility with the limited api, and refactoring some of their usages Change-Id: I33954199d2ef9884c64b963863b97aed851c440f Pick-to: 6.8 Reviewed-by: Friedemann Kleint <[email protected]>
* limited api: Remove PyList_GET_ITEM, PyList_SET_ITEM and PyList_GET_SIZE macrosCristián Maureira-Fredes2024-11-081-1/+1
| | | | | | | | | Removing old compatibility macros for the initial limited api implementation. Change-Id: Iced149450bd9bda18e43ac0acea0061cdcdb211e Pick-to: 6.8 Reviewed-by: Friedemann Kleint <[email protected]>
* limited api: replace PySequence_Fast_GET_SIZE by PySequence_SizeCristián Maureira-Fredes2024-11-081-1/+1
| | | | | | | | | | | | | | | | PySequence_Fast_GET_SIZE is defined as: (PyList_Check(o) ? PyList_GET_SIZE(o) : PyTuple_GET_SIZE(o)) and when using the Limited API we re-define the _GET_SIZE macro to be the _Size function, and considering this is our standard use case, the macro could be replaced directly by the function. Replacing also some cases were int was used instead of Py_ssize_t when using PySequence_Size. Pick-to: 6.8 Change-Id: I31aecd571a1d8ea82a3441f0b9e16ee19f026b05 Reviewed-by: Friedemann Kleint <[email protected]>
* limited api: replace PySequence_Fast_GET_ITEM by PySequence_GetItemCristián Maureira-Fredes2024-11-081-3/+3
| | | | | | | | | | | | | | | | | PySequence_Fast_GET_ITEM is defined as: (PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i)) and when using the Limited API we re-define the _GET_ITEM macro to be the _GetItem function, and considering this is our standard use case, the macro could be replaced directly by the function. However, the function returns a new reference, so we need to manually drecrease a reference after the usage, to avoid reference counting issues. Change-Id: If361e80b9e40b033e009ad46b2b9430e5b4c8eaa Pick-to: 6.8 Reviewed-by: Friedemann Kleint <[email protected]>
* shiboken6: Refactor __getitem__/__setitem__ code generationFriedemann Kleint2024-09-111-5/+9
| | | | | | | | | | | | - Introduce a shiboken message with parameters, reducing strings generated into code. - Return nullptr from __getitem__. - Adapt injected code. Task-number: PYSIDE-2859 Task-number: PYSIDE-2701 Change-Id: I4de98e40609cab400e4d7e11fe00f07594702b3a Reviewed-by: Cristian Maureira-Fredes <[email protected]>
* Shiboken: Simplify Python Error MessagesChristian Tismer2024-05-101-4/+2
| | | | | | | | | | | | | | | | | | | The function PyErr_SetString is used quite often, which has no return value. The bracketed sequence PyErr_SetString(...); return nullptr; can in most cases be replaced by a single call to return PyErr_Format(...); To simplify matters, PyErr_Format is now used everywhere. Task-number: PYSIDE-2404 Change-Id: I5988fcd2430be700415d14d7a5cc740211e61d08 Pick-to: 6.7 Reviewed-by: Adrian Herrmann <[email protected]>
* Add public native interface classesFriedemann Kleint2024-02-281-0/+33
| | | | | | | | | | Some native interface classes were included in public headers. Task-number: PYSIDE-2497 Task-number: PYSIDE-1568 Change-Id: I2e61ed8cd1a8dfc7d5d04d2730d456ec800eb446 Reviewed-by: Cristian Maureira-Fredes <[email protected]> Reviewed-by: Adrian Herrmann <[email protected]>
* Adapt to glue code to namespaced Qt buildsFriedemann Kleint2024-01-301-0/+2
| | | | | | Task-number: PYSIDE-2590 Change-Id: I7269b0f1c1758a9d26579267fc0b423c6a0422ac Reviewed-by: Shyamnath Premnadh <[email protected]>
* Add QQuaternion getAxisAndAngle()/getEulerAngles()Friedemann Kleint2023-12-211-0/+18
| | | | | | | | Address a fixme-comment in the typesystem file. Change-Id: I9242a04cab75229480efa81a98dc0bbef9bb4e61 Reviewed-by: Qt CI Bot <[email protected]> Reviewed-by: Shyamnath Premnadh <[email protected]>
* Add QRhi and related classesFriedemann Kleint2023-11-021-0/+11
| | | | | | | | | | | | CMake logic borrowed from the native interface patch. [ChangeLog][PySide6] QRhi and related classes have been added. Pick-to: 6.6 Task-number: QTBUG-113331 Change-Id: I9dd8b0b92f71027fc9f2c170af2993a5b09a4cfd Reviewed-by: Qt CI Bot <[email protected]> Reviewed-by: Cristian Maureira-Fredes <[email protected]>
* Fix stub and signature for QClipboard setPixmap and setImageCristián Maureira-Fredes2023-07-251-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <[email protected]> Reviewed-by: Friedemann Kleint <[email protected]> Reviewed-by: Shyamnath Premnadh <[email protected]>
* PyEnum: Shortcut old Enum code and generate Python enums directlyChristian Tismer2023-06-301-4/+1
| | | | | | | | | | | | | | | | | The amalgamation of old and new enums is slowly unraveling from the inside. This meanwhile actually removes the old code. Included a change by Friedemann to improve enum value handling. After the signed/unsigned problem was fixed, there was only one case left where Qt and Clang parser disagreed which could be fixed. The final solution uses overloaded functions to generate all necessary cases with minimal footprint in the executable. Task-number: PYSIDE-1735 Change-Id: I3741ce8621e783a750f3c05241c916008f78f39b Done-with: [email protected] (+2 squashed commits) Reviewed-by: Friedemann Kleint <[email protected]>
* Fix compiling with OpenGL ESFriedemann Kleint2022-09-201-0/+2
| | | | | | | | | | | | Add some #ifdefs for GL only constants. Amends 39821c9265ca15373725e408b5ede19794b9e419. Task-number: PYSIDE-2013 Fixes: PYSIDE-2060 Change-Id: I8cd5e0d297db18de094ade3acbb61dfa39aa0f4c Reviewed-by: Shyamnath Premnadh <[email protected]> Reviewed-by: Cristian Maureira-Fredes <[email protected]>
* PySide6: Add QtGui function qt_set_sequence_auto_mnemonic()Friedemann Kleint2022-09-161-0/+4
| | | | | | | | | | | The function is exported, but not declared in Qt; requiring some declarations. Fixes: PYSIDE-2059 Change-Id: I682483553ea1a46b978f57e991cabe4b303607f3 Reviewed-by: Shyamnath Premnadh <[email protected]> Reviewed-by: Qt CI Bot <[email protected]> Reviewed-by: Christian Tismer <[email protected]>
* PyEnum: Fix QKeySequence to stay correct when switching IntEnum to EnumChristian Tismer2022-08-091-2/+14
| | | | | | | | | | | | | | | | | | | | | | Most PyEnum types will no longer be compatible with int, when we change from IntEnum to Enum. This has a number of consequences and leads to improvements in type representations. The repr of QKeySequence was actually wrong and misleading, see the test qkeysequence_test.py . We change the repr and the indexing to return QKeyCombination like our competitor does since a long time. [ChangeLog][PySide6] QKeySequence returns now QKeyCombination instances when indexed and the new PyEnums are used. Change-Id: Idaaeb44ca3b6103b3e0416eaeb691ad954745f73 Pick-to: 6.3 Task-number: PYSIDE-1735 Fixes: PYSIDE-2021 Reviewed-by: Christian Tismer <[email protected]>
* Add glGet(Boolean|Integer)i_v() to QtGui's QOpenGLExtraFunctionsFriedemann Kleint2022-08-091-0/+54
| | | | | | | | | | | These functions are similar to the glGet(Boolean|Integer)v() versions, but take an additional index parameter and may return arrays of different sizes. Task-number: PYSIDE-2013 Task-number: PYSIDE-2017 Change-Id: I900ce989416ed00e7662769347e9469be313d82c Reviewed-by: Christian Tismer <[email protected]>
* Add glGet(Boolean|Float|Integer)v() to QtGui's QOpenGLFunctionsFriedemann Kleint2022-08-051-0/+72
| | | | | | | | | | | | The function return varying numbers of return values in an array. Add a helper function to determine the number. Depending on it, a single value or a numpy array is returned, matching the behavior of PyOpenGL. Task-number: PYSIDE-2013 Task-number: PYSIDE-2017 Change-Id: I8a91e491939e668932ea03eda64d83ed08ab28b3 Reviewed-by: Shyamnath Premnadh <[email protected]> Reviewed-by: Christian Tismer <[email protected]>
* Use SPDX license identifiersLucie Gérard2022-05-271-38/+2
| | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: I065150015bdb84a3096b5b39c061cf0a20ab637d Reviewed-by: Friedemann Kleint <[email protected]> Reviewed-by: Cristian Maureira-Fredes <[email protected]>
* QAction: Add setMenu() and menu()Cristián Maureira-Fredes2022-04-081-0/+6
| | | | | | | | | | | | | | | | | | | | After the changes in Qt6 related to moving QAction completely to QtGui, the 'on-demand' functions associated to QMenu were not properly exposed. This patch manually adds setMenu()/menu() using QObject's. A simple test case was added. [ChangeLog] QAction.setMenu() and QAction.menu() were implemented. Done-with: Friedemann Kleint <[email protected]> Pick-to: 6.2 Fixes: PYSIDE-1627 Change-Id: Ib8102a9cf513ee2e13ff71751b1167ca0146af31 Reviewed-by: Shyamnath Premnadh <[email protected]> Reviewed-by: Cristian Maureira-Fredes <[email protected]> Reviewed-by: Qt CI Bot <[email protected]>
* Add a context manager for override cursorsFriedemann Kleint2022-03-181-0/+6
| | | | | | | | | | [ChangeLog][PySide] A context manager for override cursors has been added. It is now possible to write code like: with QApplication.setOverrideCursor(Qt.WaitCursor):... Change-Id: I443ce82389b48656f21c98df17d97e1b3b3323b5 Reviewed-by: Qt CI Bot <[email protected]> Reviewed-by: Cristian Maureira-Fredes <[email protected]>
* Port code to use size() instead of count() of Qt containersFriedemann Kleint2022-03-171-1/+1
| | | | | | | | | | | count() will be deprecated. Fix some integer types in loops and modernize code in changed lines. Pick-to: 6.2 Change-Id: Idf21927661ea6c8866ee36e7c623043271e21620 Reviewed-by: Cristian Maureira-Fredes <[email protected]>
* PyPySide: Implement a context manager for QPainterChristian Tismer2022-01-261-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | Context managers existed in Python since 2005 (PEP 343). They were invented to support resource management for different Python implementations that cannot rely on immediate object destruction. PyPy is the first alternate Python implementation that can run PySide. QPainter does not work in PyPy without an explicit end() call. For convenience, we supply a context manager that handles this. Like in file I/O, we now prefer instead of painter = QPainter(paintable) the new indented form with QPainter(paintable) as painter: [ChangeLog][PySide6] QPainter has become a context manager. Using a with statement saves the need to call painter.end() . Task-number: PYSIDE-535 Change-Id: Ib8bebbe121dc08334d31c9663a1e5bc8042c3b62 Reviewed-by: Friedemann Kleint <[email protected]>
* PySide6: Add a sequence protocol for QRegionFriedemann Kleint2021-11-191-0/+14
| | | | | | | Pick-to: 6.2 Fixes: PYSIDE-1714 Change-Id: I581e8088e25ab31afdfc6cd5a15c55a5b418ffdc Reviewed-by: Christian Tismer <[email protected]>
* Fix QIcon.addPixmap() to accept a PyPathLike argumentFriedemann Kleint2021-10-271-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <[email protected]>
* PySide6: Add QAccessible::installFactory()Friedemann Kleint2021-08-311-0/+95
| | | | | | Fixes: PYSIDE-1650 Change-Id: I05926888aa4de8c3a34c712ed2000ba59e524833 Reviewed-by: Cristian Maureira-Fredes <[email protected]>
* Shiboken: Remove cheating macrosChristian Tismer2021-08-061-2/+2
| | | | | | | | | | | | | | | There are a number of cheating macros that allow to use the same code in Python 2 and 3. Because Python 2 is gone, remove these macros. This conversion was partially difficult since certain types collapsed in the XML files and generated functions contained substrings of the macros. This is actually the fourth attempt. Task-number: PYSIDE-1019 Pick-to: 6.1 Change-Id: I116877afc8aa36f4710a40df1769f600b6b750ea Reviewed-by: Christian Tismer <[email protected]>
* PySide6: Use constData() in snippets where applicableFriedemann Kleint2021-07-271-1/+1
| | | | | | Pick-to: 6.1 Change-Id: Iafa3a7f4e0a81733c5a99a907e808391270ce8c6 Reviewed-by: Christian Tismer <[email protected]>
* PySide6: Add QKey support for the setShortcut methodCristian Maureira-Fredes2021-06-181-0/+4
| | | | | | | | | | | | | | | | | | When this method is used in Qt/C++, the argument gets internally cast to a QKeyCombination if it is a QKey, but in Python land this is not automatically covered. A workaround was for the users to manually cast the QKey, but this adds an extra step to achieve the same. This patch adds a new method to QAction and QAbstractButton to use setShortcut with a QKey as an argument. Pick-to: 6.1 Change-Id: I9e9ebe16a65cb5aeb26a367faecbbbd414d80e03 Fixes: PYSIDE-907 Reviewed-by: Christian Tismer <[email protected]> Reviewed-by: Qt CI Bot <[email protected]>
* Fix error about not holding the GIL when releasing QImage memoryFriedemann Kleint2021-06-031-0/+3
| | | | | | | | | | | | | | Fix: "Fatal Python error: Python memory allocator called without holding the GIL" when running sources/pyside6/tests/QtWidgets/qimage_test.py Acquire the GIL for releasing. Amends a97698f0a5d011fd206db94cf73dba6353f39b29. Pick-to: 6.1 5.15 Task-number: PYSIDE-1563 Change-Id: Idf8dbf857f6dde76f80a78f581dacb3cf5fea16b Reviewed-by: Christian Tismer <[email protected]>
* Fix crashes when using the QImage(uchar *) data constructors, take 2Friedemann Kleint2021-05-251-0/+7
| | | | | | | | | | | | | | | The constructors expect a range of memory that remains valid through the lifetime of the image and may also modify it. Crashes occurred since apparently the Py_Buffer was released before it. To fix this, inject code to increase the reference count and decrease it in the cleanup function. Pick-to: 6.1 5.15 Fixes: PYSIDE-1563 Change-Id: Ic4a47e0f458ed5b59b88813139102a9f1490a9df Reviewed-by: Christian Tismer <[email protected]>
* Enable the exec() functionsCristian Maureira-Fredes2021-05-041-0/+45
| | | | | | | | | | | With Qt6, PySide dropped support for Python 2.7, thus it does not make sense to keep our exec_() renaming inplace. This patch will enable the exec() functions, and adds a deprecation note for exec_(), which will enable us to safely remove it in the future. Change-Id: I7375e10632e7ab534ca264304a5a65f380b9b1bb Reviewed-by: Christian Tismer <[email protected]>
* Add a numpy overload for some functions taking lists of QPointFFriedemann Kleint2021-04-211-0/+5
| | | | | | | | | | | | | | | | | | | | Add functions taking x,y data in the form of numpy-vectors (as common for matplotlib, etc) for: QPainter::drawPoints() QXYSeries::append(), QXYSeries::replace() They are added as separate functions instead of overloads since there is a restriction in that numpy arrays cause an error: FIXME Subscripted generics cannot be used with class and instance checks when passed to other type check macros. Task-number: PYSIDE-1540 Task-number: PYSIDE-1503 Change-Id: Ie1521ce19127bb0641fbdb4f7320a8707682724e Reviewed-by: Christian Tismer <[email protected]> Reviewed-by: Cristian Maureira-Fredes <[email protected]>
* Remove const_cast<char *> which are no longer needed in Python 3Friedemann Kleint2021-03-151-3/+1
| | | | | | | | Remove from code as well as from the generator. Change-Id: Ia863788bfa57d52258836c1cbcccb8c9815b7421 Reviewed-by: Qt CI Bot <[email protected]> Reviewed-by: Christian Tismer <[email protected]>
* PySide6: Move injected code snippets where they belongFriedemann Kleint2021-03-101-10/+14
| | | | | | | | Adapt to the restructuring in Qt 6. Change-Id: I3cd65b8ee428fcc75de010efaa3595664a00eb97 Reviewed-by: Qt CI Bot <[email protected]> Reviewed-by: Cristian Maureira-Fredes <[email protected]>
* PySide6: Brush up the injected code snippets and templatesFriedemann Kleint2021-03-101-7/+8
| | | | | | | | | | | - Use qsizetype (or equivalent Py_ssize_t) for containers - Introduce some auto - Use constData() for QByteArray - Use Qt 5 connection syntax - Use nullptr Change-Id: Ie9134a4f756219d6e5c5710ab64c09a236febd4d Reviewed-by: Cristian Maureira-Fredes <[email protected]>
* PySide6: Remove unused glue codeFriedemann Kleint2021-03-101-5/+0
| | | | | Change-Id: I3f5adb202722aecbd34766e782c218720926b73d Reviewed-by: Cristian Maureira-Fredes <[email protected]>
* Fix broken return type conversions of QOpenGLExtraFunctions::glGetStringi()Friedemann Kleint2021-03-101-0/+4
| | | | | | | | | | | | | | | The function returns const unsigned char*, which was converted using the wrong snippet (QString conversion of parameter 1). Add a new snippet using the char *conversion of the return value at the end. Fixes warning: PySide6/QtGui/PySide6/QtGui/qopenglextrafunctions_wrapper.cpp:4630:35: warning: unused variable cppResunused-variable] const unsigned char * cppResult = cppSelf->glGetStringi(cppArg0, cppArg1); Pick-to: 6.0 5.15 Change-Id: Iae3f0abd4a34fb3b6a41534508fb5d64a3eae224 Reviewed-by: Cristian Maureira-Fredes <[email protected]>
* PySide6: Add QOpenGLFunctions.glShaderSource()/glGetShaderSource()Friedemann Kleint2021-03-041-0/+22
| | | | | | | | | Add a simple signature taking and returning a string. Fixes: PYSIDE-1511 Pick-to: 5.15 Change-Id: Ie52d5f55f168075ee6ee71fdb35463895f768c04 Reviewed-by: Christian Tismer <[email protected]>
* Rename PySide2 to PySide6Friedemann Kleint2020-11-021-0/+547
Adapt CMake files, build scripts, tests and examples. Task-number: PYSIDE-904 Change-Id: I845f7b006e9ad274fed5444ec4c1f9dbe176ff88 Reviewed-by: Christian Tismer <[email protected]>