aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/libpyside/pysideqflags.cpp
Commit message (Collapse)AuthorAgeFilesLines
* PyEnum: Get rid of the no longer needed flags typeChristian Tismer2023-07-031-200/+0
| | | | | | | | | | | | | | | | | As a welcome unexpected gift, we now even get rid of the flags class. The builtin Qt flags are still touched when creating properties. This needs an extra registration of the single flag converter name but no extra functions. See testQObjectProperty of qlabel_test.py . [ChangeLog][PySide6] After removal of the old enums, also the complex flags structure could be removed. Change-Id: Ie531a7470330af41eb491e8b1e37939f1afcb9a0 Task-number: PYSIDE-1735 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* 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: Friedemann.Kleint@qt.io (+2 squashed commits) Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* libpyside: Rename namespace PySide::QFlagsFriedemann Kleint2022-12-161-1/+1
| | | | | | | | | When doing using namespace PySide; it clashes with the QFlags class with CMake UNITY_BUILD (jumbo) builds. Task-number: PYSIDE-2155 Change-Id: Ida37600956a740bd920dacc821c4e232df6e7026 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Fix redefinition of type name PySideQFlagsTypePrivateFriedemann Kleint2022-12-161-2/+2
| | | | | | | | It causes clashes with CMake UNITY_BUILD (jumbo) builds. Task-number: PYSIDE-2155 Change-Id: Idad32c4741dbdb7fe9b7d202446c490e7bbd6b42 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Fix TypeError when comparing Qt.Flags and objectsAdrian Herrmann2022-09-081-2/+8
| | | | | | | | | | | | | Comparing a QtCore.Qt.Flags object with any other object calls the PySideQFlags_tp_richcompare() function. This function always threw a TypeError when comparing to a non-numerical object, causing undesired effects. Account for these cases now by returning True or False if the compare operator is != or ==, respectively. Pick-to: 6.3 6.2 Fixes: PYSIDE-2048 Change-Id: Ic81a65ace743b57e90ffe7883e42eb8330b78832 Reviewed-by: Christian Tismer <tismer@stackless.com>
* 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 <Friedemann.Kleint@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* PyEnum: Implement Switchable Qt Enums Using Python EnumsChristian Tismer2022-05-221-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The mapping from Qt Enum to Python Enum was considered to be difficult. Actually, it is easier than thought. As a minimum invasive approach, this implementation changes very little in the first place. The generation process of enums stays almost unchanged, which simplifies handling of the generated code very much. At the end of each generated Enum, we call a special function that grabs the newly generated enum, reads all items and produces a Python class that replaces the enum in-place. We don't generate Python code, but the functional API to create the new enums. There are lots of more optimizations possible, but this concept solves the issue nice and quickly. A harder problem was the need to map all QFlag structures to enum.Flag structures from Python. This caused a sometimes hacky coding because both the old and the new version are supported. This will be totally cleaned up when we remove the old implementation. Pick-to: 6.3 Task-number: PYSIDE-1735 Change-Id: I66991312f2d7b137f110a4db30702b8f3bf518dd Reviewed-by: Christian Tismer <tismer@stackless.com>
* PyEnum: Prepare to support both implementationsChristian Tismer2022-05-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | The enum implementation should be switchable between the old and the new version. This switching is possible only before PySide import. This patch prepares the switching capability for the signature module and installs fields that will affect the global header files. The new version can be selected by setting the environment variable PYSIDE63_OPTION_PYTHON_ENUM=1 or setting sys.pyside63_option_python_enum=1 [ChangeLog][PySide6] The signature module was prepared to support both C++ enums and Python enums. This can be selected at startup. Task-number: PYSIDE-1735 Pick-to: 6.3 Change-Id: I14999e1049fbaaccd00f00d1b7b1257bc9287255 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* PyPySide: Rename interface functions and classes to simplify debuggingChristian Tismer2022-02-031-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | The names of certain interface functions are not always following a simple scheme. Especially it is not easy to see immediately if we are dealing with a method of SbkObjectType or SbkObject Do a few renamings to simplify debugging and make the code easier to understand. When a function is used in a type spec and there is no other important reason, it should be named like {Py_<tpname>: reinterpret_cast<void *>(<TypeName>_<tpname>)}, Rename also all type functions ending on "TypeF()" to end in "_TypeF()". This is not always the case. Examples: SbkObjectTpNew -> SbkObject_tp_new SbkObjecttypeTpNew -> SbkObjectType_tp_new PyClassPropertyTypeF -> PyClassProperty_TypeF Task-number: PYSIDE-535 Change-Id: Icbd118852f2ee732b55d944ed57c7a8ef7d26139 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* PySide6: Fix QFlags comparison to selfFriedemann Kleint2021-10-271-4/+9
| | | | | | | | | | The result was set to true unconditionally when self == other. Fix and rearrange the code. Fixes: PYSIDE-1696 Pick-to: 6.2 5.15 Change-Id: I8892d0f6439186d8629c5a24347fc1ce700ecb58 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Shiboken: Change type(SbkType_FromSpec) to PyType_ObjectChristian Tismer2021-09-131-7/+1
| | | | | | | | | | | | This step prepares the transition of type generation to PyPy compatibility. [ChangeLog][shiboken6] SbkType_FromSpec() has been changed to return a PyType_Object *. Task-number: PYSIDE-535 Change-Id: I74e2e527e66a41f1a9f3f911f44d641139371889 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Shiboken: Remove cheating macrosChristian Tismer2021-08-061-1/+1
| | | | | | | | | | | | | | | 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 <tismer@stackless.com>
* shiboken: clean-up after replacing the type extension macros by functionsChristian Tismer2021-07-071-5/+0
| | | | | | | | | | | | | | | | | | | | | | [ChangeLog][PySide6] During replacement of type extender macros by functions, a hidden enum/flags alias error was detected and fixed. After macros were replaced by functions, redundant extension-fields could be removed. This was possible in steps, removing `converterPtr` from PySideQFlagsTypePrivate and SbkEnumTypePrivate, individually. That means the structures are really distinct, now and no structural overlapping is left. The enum/flag alias bug is reported here, as a follow-up to the "replace the type extension macros by functions" change. The involved `setTypeConverter` function interface was fixed and the unused `getTypeConverter` function was removed. Change-Id: Ieee111465ab5fc2f5ae23f9e488b12883a509bcd Task-number: PYSIDE-535 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* PyPySide: Replace the type extension macros by functionsChristian Tismer2021-07-061-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | [ChangeLog][PySide6] The type extension macros are replaced by normal function calls. This is not only a pre-requisite for PyPy support but also an improvement of type safety. PyPy cannot stand macro extensions to type objects, because we are unable to patch the object size during initialization. This suggested to re-implement the type extension in a clean way using functions. The first idea was to keep the macro version for the limited API, while the function version would be for PyPy and no limited API, but the function version is much nicer and allows further refinements. The enum/flag alias problem is solved. Unfortunately, this still does not fix the PYSIDE-229 problem. Task-number: PYSIDE-535 Change-Id: I39270c6d326cb7d54bd58ceed601f5e1e9b0a8d6 Pick-to: 6.1 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* libpyside: Fix some clang analzyer warningsFriedemann Kleint2021-03-111-15/+14
| | | | | | | | | | | | - Use nullptr - Initialize variables - Remove else after return - Remove C-style casts - Avoid constructing QString from const char * - Use emit for signals Change-Id: I6ba8cad51f4b2a22f94996d1a9d8c3ae87c35099 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Rename PySide2 to PySide6Friedemann Kleint2020-11-021-0/+205
Adapt CMake files, build scripts, tests and examples. Task-number: PYSIDE-904 Change-Id: I845f7b006e9ad274fed5444ec4c1f9dbe176ff88 Reviewed-by: Christian Tismer <tismer@stackless.com>