aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/tests/pysidetest
Commit message (Collapse)AuthorAgeFilesLines
* Remove unnecessary use of 'object' in class constructionremoteobjectsdevCristián Maureira-Fredes2024-12-183-7/+7
| | | | | | | | | | | Considering we are not compatible with Python 2 anymore, we can drop the 'object' explicit inheritance in the class declaration. Pick-to: 6.8 Change-Id: Iac3a95aa9721c3ff1a755f457c0936ca157a8470 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Fix trailing empty linesFriedemann Kleint2024-12-1310-10/+0
| | | | | | Pick-to: 6.8 Change-Id: I1a5964463f703ade0657816cb974206355a5ae5b Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* tests: handle unused imports and fix type issuesCristián Maureira-Fredes2024-12-126-19/+16
| | | | | | | | | | Many modules were imported but unused in our tests. Additionally, some type hint issues were solved. Pick-to: 6.8 Change-Id: Ic2368690e9a6ce0fffea812206185aa4f3dc3c58 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* Raise Python version to 3.8Friedemann Kleint2024-12-031-9/+0
| | | | | | | | | | | | | | Fix some oversights of previous changes: - Bump limited API - Fix CMake files - Remove outdated version checks from Python code - Adapt some documentation Pick-to: 6.8 Task-number: PYSIDE-2943 Change-Id: Id8d9c4c6bb0629948de28beb3c4274991f84ff08 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* type hints: add __hash__, fix __copy__, __repr__ and __dir__Christian Tismer2024-11-081-1/+3
| | | | | | | | | | | | | | | The other missing things are sequence and mapping methods which need some more support from cppgenerator. Will be added later. typing.Self is only known since Python 3.11 . We emulate that by patching it into typing and adjusting the Python version for mypy. Task-number: PYSIDE-2846 Change-Id: Icb1060c7bba355061d8f134c8e76fb14369d7dda Pick-to: 6.8 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Remove traces of Python 2: tests and flake fixesCristián Maureira-Fredes2024-11-052-38/+40
| | | | | | | | | Addressing a few comments from tests that were related to the Python 2 compatibility. Pick-to: 6.8 Change-Id: I88c614549cfb91f879fe3e0d82a6988362e0ce19 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* type hints: Make the mypy cache more permanent, amendedChristian Tismer2024-11-041-1/+9
| | | | | | | | | | | | | It turned out that mypy is not loaded by COIN tests when requirements_coin.txt is used. Also enforce mypy existence in COIN to prevent further configuration errors. As a drive-by, a new cache is used that is > 10% faster. Task-number: PYSIDE-2846 Change-Id: I75a27cfd0cb0fb0d7cd44c2a121291af052b0d8f Pick-to: 6.8 6.8.0 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* setup: fix PySide6.__all__ after the wheel split, amendment 3Christian Tismer2024-11-011-2/+10
| | | | | | | | | | | | | | | | | | | | The __all__ support for the PySide6 module works just fine. But there is a last incompatibility that might strike others as it did hit ourselves when using PySide6.__dict["__all__"]: Use a derived dict type and define a __missing__ attribute. Derive further a module type, then it works without problems. A little support function in Shiboken allows to replace the dict of PySide6 with this derived type. amends 703d975f16aff95bc9014a2689a3ae824b5a552f. Pick-to: 6.8 Task-number: PYSIDE-2895 Task-number: PYSIDE-1890 Change-Id: I018228116a5fdd1401c1ebd42ceb886f6829deeb Reviewed-by: Christian Tismer <tismer@stackless.com>
* type hints: Make the mypy cache more permanentChristian Tismer2024-11-011-1/+12
| | | | | | | | | | | | | | By default, mypy stores its cache data in $(pwd)/.mypy_cache . It is better to save it in the pyside_setup folder under a version specific name. This makes the cache survive full rebuilds. We tested that this folder is really writable. Task-number: PYSIDE-2846 Change-Id: I739e74cb24b5aaa1b2b457195e8a143b56a2bc44 Pick-to: 6.8 6.8.0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Lazy Init: Support Lazy Subtypes in star imports, amendment 2Christian Tismer2024-10-211-5/+9
| | | | | | | | | | | | | | After addition of subtypes support, filtering is necessary to exclude subtypes from resolving. Deleting the subtype was a bad idea with an unordered_map. Better is to use a list of names to resolve. Task-number: PYSIDE-2404 Change-Id: Ide5b13fbd37bab44881a25d4466ec30c89cd9918 Fixes: PYSIDE-2898 Pick-to: 6.8 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* type hints: Install a permanent test for error-free pyi filesChristian Tismer2024-10-172-0/+48
| | | | | | | | | | | | | | | | | Testing Mypy on the whole project costs some time, about 33 s on a Mac Studio Max M1 in debug mode. On CI with release Windows, this is about 8 sec. An option "--skip-mypy-test" is added to save time. The mypy tool is only enforced to exist in COIN. Otherwise it is optional. Task-number: PYSIDE-2846 Change-Id: Ibbabbf6b893537ac923fbbaba9ff832ebd675a21 Fixes: PYSIDE-2672 Fixes: PYSIDE-2886 Pick-to: 6.8 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Lazy Init: Support Lazy Subtypes, amendedChristian Tismer2024-10-142-4/+6
| | | | | | | | | | | | | | | The addition of nested types made it necessary to filter subtypes out of resolveLazyClasses because incarnateType should be called for toplevel types, only. Added a star test to pyenum_relax_options_test.py to test this case without using extra time. Task-number: PYSIDE-2404 Change-Id: I4b95c0f65c055376defb6a8e9ea888285c82a8e2 Fixes: PYSIDE-2888 Pick-to: 6.8 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* type hints: Fix some systematic problemsChristian Tismer2024-09-061-1/+1
| | | | | | | | | | | | | | __str__ and __repr__ are simply fixed by returning str instead of PyObject. __reduce__ actually has return type "str | tuple[Any, ...]", but using str here too fits the purpose. Errors before: 533 Errors after: 450 Change-Id: I6dd3527d3f5f3f035e667d0ca3c8f123e94e844f Task-number: PYSIDE-2846 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* shiboken6: Prevent converter name clashes between classes and partially ↵Friedemann Kleint2024-06-267-3/+61
| | | | | | | | | | | | | | | | | | | | | qualified aliases Change the behavior of registerConverterName() to always overwrite existing entries. It should then only be used for fully qualified names. Add a function registerConverterAlias() which does not overwrite existing entries for registering partially qualified names. Use registerConverterAlias() for the primitive types since they are re-registered in multiple modules. This prevents clashes when registering duplicate classes. For example, registering a globally scoped class "Connection" will then overwrite the partially qualified alias "Connection" of "QMetaObject::Connection". Fixes: PYSIDE-2792 Change-Id: I2bd3c0bff96da6d3ceddd46a2368fe6b94bbed68 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Python-3.10: Allow the new syntax for Python 3.9Christian Tismer2024-06-2034-0/+34
| | | | | | | | Add a future statement to all Python source files. Task-number: PYSIDE-2786 Change-Id: Icd6688c7795a9e16fdcaa829686d57792df27690 Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
* Do the transition to Python 3.13, GIL-partChristian Tismer2024-06-121-12/+29
| | | | | | | | | | | | | * opcodes have changed numbers. That made "import *" etc. fail. * PUSH_NULL is sometimes inserted before a call. * enum_test needed an overhaul due to opcode changes. Python 3.13 works fine. Supporting --disable-gil is a different issue. Task-number: PYSIDE-2751 Change-Id: I37b447148787e2923a58c091a5c8ac808d579bc0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Implement multiple inheritance correctly, 2nd. amendmentChristian Tismer2024-03-281-5/+35
| | | | | | | | | | | | | When a Python class does _not_ implement __init__, then we might get the default of object.__init__, which must be skipped like the object class alone. Change-Id: I0416c97854e8d1c9edf0b9ac44d3df58223fef84 Fixes: PYSIDE-2654 Task-number: PYSIDE-2294 Pick-to: 6.5 6.6 6.7 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* shiboken6: Register typedefs of container typesFriedemann Kleint2024-03-183-1/+24
| | | | | | | | | | | | | | | | | | For signals like QRemoteObjectRegistry.remoteObjectAdded(QRemoteObjectSourceLocation) where using QRemoteObjectSourceLocation = std::pair<QString,QRemoteObjectSourceLocationInfo> one needed to specify the fully qualified C++ name in @Slot() for the metaobject system to work and the shiboken converter to be found. Record the typedefs and register the container converters under the typedef name, too. Fixes: PYSIDE-2633 Change-Id: Ifc62f096277949a507957a0466adb47d082695c7 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Enum: Move special Flag patch into a snippetChristian Tismer2024-03-051-15/+4
| | | | | | | | | | | | | | A patch that corrects Qt.Modifier and Qt.KeyboardModifier causes early loading of QtCore.Qt . Move the patch into snippets, running it only when needed. Task-number: PYSIDE-1735 Task-number: PYSIDE-2404 Change-Id: I26cc7aa767d5474bf54a22fbad24fae62daafa5f Pick-to: 6.6 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Fix connecting to signals with QFlags<>Friedemann Kleint2024-03-013-2/+20
| | | | | | | | | | | | | | Additionally register the shiboken converter under the type alias name ("Qt::Alignment"), which appears in the meta method signature besides the full name ("QFlags<Qt::AlignmentFlag>"). Manifests as signal: QBluetoothDeviceDiscoveryAgent::deviceUpdated(QBluetoothDeviceInfo, QBluetoothDeviceInfo::Fields) Pick-to: 6.6 Fixes: PYSIDE-2613 Change-Id: I7ecce8e0b3f8ddf790c40260fc156184e83cad69 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Fix conversion of QVariant<->QMatrix<n>x<m>Friedemann Kleint2024-02-224-2/+24
| | | | | | | | | | | | | | | | QMatrix<n>x<m> is a template specialization of QGenericMatrix<n,m,float> which the type name of the QVariant contains. To find the proper Shiboken converter for this, change the name back. As a drive-by, fix @snippet conversion-sbkobject to return a PyObjectWrapper() with warning in cases where the QMetaType is valid but no converter can be found. Fixes: PYSIDE-2599 Pick-to: 6.6 Change-Id: I4f41dcbaa394fcc1732536c0b7a6569f694f3c45 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Add QLatin1StringFriedemann Kleint2024-01-083-0/+25
| | | | | | | | | It is needed For the QIcon::ThemeIcon fields. Task-number: PYSIDE-2497 Task-number: PYSIDE-2537 Change-Id: I11d94c150dfa614797038e56cd37128bf3e88cff Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* PyPySide: Fix some new bug that should ignore featuresChristian Tismer2023-12-212-3/+8
| | | | | | | Task-number: PYSIDE-535 Change-Id: I9dc87afba17ceed9bd24c54e468e634155877e61 Pick-to: 6.6 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Tests: Fix some flake warningsFriedemann Kleint2023-11-2810-16/+42
| | | | | | | | Mostly spacing related. Pick-to: 6.6 Change-Id: I748a8a06f456c5d4bafb94c397c43b3b2ee9e3e9 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* pysidetest: Fix some static code analysis warningsFriedemann Kleint2023-10-106-10/+13
| | | | | | Pick-to: 6.6 6.5 Change-Id: If0050eadfc36444300b61498e46034ad3b4c8cdd Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* Support running PySide on Python 3.12Christian Tismer2023-10-091-1/+18
| | | | | | | | | | | | | | | | | | Builtin types no longer have tp_dict set. We need to use PyType_GetDict, instead. This works without Limited API at the moment. With some great cheating, this works with Limited API, too. We emulate PyType_GetDict by tp_dict if that is not 0. Otherwise we create an empty dict. Some small changes to Exception handling and longer warm-up in leaking tests were found, too. Pick-to: 6.6 6.5 6.2 Task-number: PYSIDE-2230 Change-Id: I8a56de6208ec00979255b39b5784dfc9b4b92def Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Replace typedef by usingFriedemann Kleint2023-09-201-5/+3
| | | | | | | Pick-to: 6.6 6.5 Change-Id: I23d8ea03ec578a897352c2627417a706ca71ef82 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Clean up some unused suppression warningsFriedemann Kleint2023-08-011-8/+0
| | | | | | Pick-to: 6.5 Change-Id: I261ec7ec933e21658d357ad1ffbeb4de5b84d13f Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* PyEnum: Remove the now unreachable test cases for old enumsChristian Tismer2023-06-191-2/+0
| | | | | | | Task-number: PYSIDE-1735 Change-Id: I51e68c50872f1d1254218ae7556ba607f73c4ea9 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* PyEnum: Update docs and rename the optionChristian Tismer2023-06-162-7/+7
| | | | | | | | | | | | | The new Enum implementation can no longer be switched off. Individual features can still be deselected with the environment variable PYSIDE6_OPTION_PYTHON_ENUM which had the name PYSIDE63_OPTION_PYTHON_ENUM before. This change is meant for PySide 6.6 . Task-number: PYSIDE-1735 Change-Id: Iae5b7a9d42a0d7b005dbba20201a80713ef79be9 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Enum: Enable toInt for QVariant(PyEnum/SbkEnum)Shyamnath Premnadh2023-06-136-1/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | - For Python/Shiboken types not known to Qt that requires wrapping around a QVariant, we use the PyObjectWrapper type. This patch registers a toInt() QMetaType converter for PyObjectWrapper, which enables automatic conversion to int for a QVariant(PyObjectWrapper) within C++ i.e. QVariant(PyObjectWrapper).toInt() will work - This means that cases like QAbstractItemModel::data() that calls QtPrivate::legacyEnumValueFromModelData(const QVariant &data) would work without explicit conversion from QVariant(PyObjectWrapper) to QVariant(int). But for cases like QMetaProperty::write() explcit handling is still required. - This would also work for cases where the QVariant(PyObjectWrapper) is simply channeled from Python to C++, and from C++ back to Python without performing any operations on it. - Incase, the wrapped object is not a PyEnum/ShibokenEnum object, then toInt() would return a -1. Pick-to: 6.5 Task-number: PYSIDE-1930 Task-number: PYSIDE-2339 Change-Id: I983351f2ff88c79c29399c257e38421116efc7a3 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Implement multiple inheritance correctly, amendedChristian Tismer2023-04-121-0/+20
| | | | | | | | | | | | | | | | | | In multiple inheritance, it makes no sense to pass positional arguments into a mixin class. This was correctly implemented but later "corrected" because of wrong user input. Correct and compatible to the competitor's implementation is passing keyword arguments, only. This is rarely a problem since people should use keyword arguments only in multiple inheritance. Change-Id: If5eb19368a50ee2a5534f10081d84511453993e5 Fixes: PYSIDE-2294 Pick-to: 6.5 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* Implement multiple inheritance correctly, compatible versionChristian Tismer2023-03-212-0/+128
| | | | | | | | | | | | | | | | PySide does not implement multiple inheritance. Please see "About Multiple Inheritance in Python" at the issue. This patch just supports the `__init__` call. A more consequent implementation will follow that supports multiple inheritance with every method. [ChangeLog][pyside6] Cooperative multiple inheritance is now implemented for all __init__ methods. Fixes: PYSIDE-1564 Change-Id: I8df805d22c2052c3a9747420a86341f64e29a5ad Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* SignalInstance: Fix more very old errors due to unlucky exposureChristian Tismer2023-03-091-2/+11
| | | | | | | | | | | | | | | | | | | | | SignalInstance unfortunately can be created directly without a calling Signal. This is an old design error that cannot easily be reverted because that is now the API. Fixed by printing "(no signature)": * print(SignalInstance()) # prints "(no signature)" Fixed by producing a runtime error: * SignalInstance().connect(lambda: None) * SignalInstance().disconnect() * SignalInstance().emit() Thanks to <bers bers> who reported them all. Task-number: PYSIDE-79 Change-Id: I92598d963b9796453fbd17c1526a674fa007e5e8 Pick-to: 6.4 Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io> Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* CMakeLists.txt: Add header filesFriedemann Kleint2023-03-011-6/+8
| | | | | | | | | Hoping this will help the Qt Creator code completion. Change-Id: I0777f5c38e37d560cfc1942b8acd5c76c8d64d25 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* Add license headers to cmake filesFriedemann Kleint2023-02-161-0/+3
| | | | | | | | | | | | CMakeLists.txt and .cmake files of significant size (more than 2 lines according to our check in tst_license.pl) now have the copyright and license header. Task-number: QTBUG-105718 Task-number: QTBUG-88621 Change-Id: I98bd2e80f182d8bf7aef6b633f37a428e2dac69b Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* NoGIL: Disable opcode tests in enum_test.pyChristian Tismer2023-02-091-0/+2
| | | | | | | | | | | | The enum_test.py uses opcode inspection to make sure that changed opcodes hopefully trigger an error. For the immature NoGIL Python version, this makes no sense. Task-number: PYSIDE-2221 Change-Id: If101f49f97c5120a84672581d24336999718611a Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* __feature__: Fix a weird case of false metafunction lookupChristian Tismer2022-12-131-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | PySide implements duck-punching since 2010. This could create a problem with true_property since 06/2019, because a meta-function could be found in the instance dict of a QObject class, although the methods were replaced by a property object. This was an unexpected reaction of the `getMetaDataFromQObject` function. Meta methods were created and inserted into the instance dict, which caused very unrelated side effects like infinite recursion. The new implementation handles Python properties correctly and looks up the hidden methods if necessary without side effects. There are no longer meta functions involved. The function `getMetaDataFromQObject` is misleading and was replaced by `getHiddenDataFromQObject`, keeping the old name as an alias. It will be finally removed in version 6.5 . [ChangeLog][PySide6] A callback error when using true_property was fixed. Change-Id: Ie5234eab2106885f6edad24ae7d4c55fff43d62f Fixes: PYSIDE-1889 Pick-to: 6.4 Task-number: PYSIDE-1019 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Build system: Fix broken find_package() statementFriedemann Kleint2022-11-301-1/+1
| | | | | | | | | Amends c199b64bcbcaeb55ce78ce3f4e772fcdc68073f4. Pick-to: 6.4 Task-number: PYSIDE-962 Change-Id: Icb565007bf476b2512add35733409c026ab3d18f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* __feature__: heavily rework the context switchingChristian Tismer2022-11-293-0/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The example of the issue shows the qasync.py module which fails miserably when using snake_case. The reason: ----------- Reason is the way how feature switching is implemented. Modules like qasync get a default switching of "ignore". This ignores that the qasync module itself imports QtCore, and feature switching is of course relevant, suggesting a default setting of "normal" (explicitly no features). The real problem: ----------------- Testing the simple approach showed a serious problem with feature switching: The functions get switched when a certain function (getattr etc.) is called. But the switching is sometimes not done due to a caching problem. This fix removes caching that was wrong. Optimization will be done in a different step with a different approach. This Change was not qasync specific, but happens with PySide imports. Actions done: - adjust the inline structure - implement a feature_imported callback - identify Python functions that use PySide during import [ChangeLog][PySide6] __feature__ switching now works even with recursive imports like in the qasync module. Fixes: PYSIDE-2029 Change-Id: I3340f54f293083a09fb509383688f73bbd9b60ae Pick-to: 6.4 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Build system: Use modern form of finding and linking Qt librariesFriedemann Kleint2022-11-291-8/+3
| | | | | | | Pick-to: 6.4 Task-number: PYSIDE-962 Change-Id: I91aed62a8e14bbc1101b4f23e25f57a5d6bca173 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* __feature__: Fix true_property inheritanceChristian Tismer2022-11-232-0/+39
| | | | | | | | | | | | | | | | | | The wrapping process creates wrapper functions for all C functions, also for those which are meant as virtual functions promoting an inherited function. Because properties appear as such additional functions, we need to convert not only according to the property strings, but also use the mro to reach the extra functions indirectly. [ChangeLog][PySide6] true_property was fixed to work with inherited properties as well. Change-Id: I176a30df77f550504f3aaf71e0c20de3e0707792 Fixes: PYSIDE-2042 Pick-to: 6.4 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Purge remaining uses of old Qt string literalsFriedemann Kleint2022-11-222-10/+14
| | | | | | | | | | Amends a3e882b06eda8f9a63cf3834a99640034775269b. Pick-to: 6.4 Task-number: QTBUG-98434 Change-Id: I23ad60d6e4201aa2d8dbf3fa8892d3df3c56c5fc Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Tismer <tismer@stackless.com>
* Add .pyproject files for the testsFriedemann Kleint2022-11-111-0/+33
| | | | | | | | Makes navigation with Qt Creator easier. Change-Id: I40c6bc641faddcdbd265d6e886c2f3bd3b271be5 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* CMake: Execute shiboken with appropriate PATH on WindowsAlexandru Croitor2022-11-091-5/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously one had to add the Qt bin dir and libclang.dll dir to PATH manually to ensure shiboken successfully runs when building Qt for Python using CMake without setup.py. This should not be necessary though, because the build system knows where Qt is (usually via the --qtpaths option) and where libclang is (via LLVM_INSTALL_DIR and friends). Introduce a CMake function that generates a batch shell script wrapper for a given tool. The wrapper will have PATH set to the Qt bin dir and libclang dir. Generate such a wrapper for shiboken and use it everywhere we call shiboken to generate bindings. The wrapper is only created on Windows. All mentions of Shiboken6::shiboken in custom commands now need to be wrapped in $<TARGET_FILE> because automatic target path conversion only happens if the target appears as the first argument to a custom command, and that is not the case anymore with the wrapper script being at the front. As a drive-by, the indentation of custom commands is now adjusted for easier readability and to conform with the indentation used in the Qt build system. Pick-to: 6.4 Fixes: PYSIDE-1844 Change-Id: I287adeedf234d0272c2963e96ae2aa5c4c0f0c83 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> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Build system: Bump versionsFriedemann Kleint2022-10-251-1/+1
| | | | | | | | | | | | State CMake 3.18+ and Python >= 3.7 Task-number: PYSIDE-2091 Pick-to: 6.4 Change-Id: Iad906a48bf4378ceeeebe5a55aeaa3f27ea0a61f Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Fix smart pointers of type <const Pointee>Friedemann Kleint2022-10-063-0/+19
| | | | | | | | | | | | | | | | | Use the right function to strip the qualifications from the type since <const Pointee> and <Pointee> are treated identically. Fixes a regression introduced by change a262e9bae5dbdef92d5caa0e058a1ad07fa974d3. This is in principle tested in the smart binding test, but occurs depending on the order the types are seen, so, add another test. Fixes: PYSIDE-2071 Pick-to: 6.3 Change-Id: I838b1ae1dd607095b41018c973093a380f51ab6b Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* PyEnum: Relax the Impact of New Enums and Make Everything OptionalChristian Tismer2022-09-302-0/+131
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch makes every PyEnum feature of PySide optional. It allows to test the whole functionality. Some flags might also make sense for people who cannot use the new enums without modifications. Maybe this should be there for now for internal use, only. The flags for PYSIDE63_OPTION_PYTHON_ENUM are (hex) 1 (True) the default for PySide 6.4, full implementation 2 turn all Enum into IntEnum and Flag into IntFlag 4 re-add shortcuts for global enums 8 re-add shortcuts for scoped enums 10 don't fake shortcuts (forgiveness mode) 20 don't fake rename (forgiveness mode) 40 don't use zero default (forgiveness mode) 80 don't allow missing values in Enum A startup setting of for instance PYSIDE63_OPTION_PYTHON_ENUM=6 should work in most cases, avoiding the fall-back to old enums. Task-number: PYSIDE-1735 Change-Id: I636c4d9f8e671f5185058820605da73f688c16b0 Pick-to: 6.3 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* PyEnum: Improve the handling of QKeyCombination, amendedChristian Tismer2022-09-021-0/+1
| | | | | | | | | | | The new QKeyCombination calls are implemented for the new enums, only. Add a @skipUnless Explicitly no pick because 6.3 has that fix. Task-number: PYSIDE-1735 Change-Id: Icf154fe9c3334e6f18ffc5dc675ed01c651785f5 Reviewed-by: Christian Tismer <tismer@stackless.com>
* PyEnum: Improve the handling of QKeyCombinationChristian Tismer2022-09-011-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | After turning IntEnum into Enum, a few classes need more attention because the simple int coercion is no more sufficient. Instead, a bit of help is necessary to make the usage of the __or__ operator consistent, again. On first sight, this coercion to KeyCombination looks slightly unpythonic. But this originates in the complex matters. If you observe what types are actually added, this is very correct. Using the IntEnum version instead is not better. It is just hiding the ongoings by using int, which would also allow to combine two characters as a bad side effect. [ChangeLog][PySide6] PyEnum now handles QKeyCombination correctly with "|" or (deprecated) "+" operators, without falling back to using IntEnum. Task-number: PYSIDE-1735 Change-Id: I08b93b8b7ece75ca650f2916ec6f6f5bb711a70b Pick-to: 6.3 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>