aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/tests/pysidetest
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* PyEnum: Define a fixed list of Int(Enum|Flag) decisionsChristian Tismer2022-08-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | This was "PyEnum: Write a default Int decisor for Enum and Flag". Historically, C++ enums were all compatible with int. The new Python enums are more diverse here. There are the basic types Enum/IntEnum and Flag/IntFlag. We have tried a lot to come up with a sensible default heuristic computed from the data. In the end, this was reverted and replaced by a fixed list that was collected from similar implementations. By the move away from Int inheritance, a few classes needed extra support. Python 3.11.0b5 also required the Flag creation parameter "boundary=KEEP". It is not clear if this is correct, yet. [ChangeLog][shiboken6] Most former IntEnum/IntFlag are replaced by pure Enum/Flag classes in a generally compatible way to other implementations. Change-Id: I1dbe7b0556a3375df89eb40e9d9f495f14bf42b1 Pick-to: 6.3 Task-number: PYSIDE-1735 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* build: Fix a weird build problem on macOS and other platformsChristian Tismer2022-08-021-7/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There was a long existing bug in the PySide build system that had a weird effect on macOS: * building PySide with Limited API and testing worked fine. * building PySide without Limited API worked fine too, but gave crashes when testing pysidetest. It appears that macos duplicates a static Python build, one of them uninitialized. After a month with no solution, a Linux build had problems, too, but complained already in the build. It was solved by passing `--enable-shared` to the Python build. This `--enable-shared` solved the macOS problem as well. Further analysis by Alexandru led to the suggestion that the Python libraries in pysidetest are not needed at all, and by removing them, the whole problem went away. This is now confirmed on other platforms as well. The option `--enable-shared` is no longer needed in any configuration. The problem was caused by 22e359bc19daf19033332aa2d7bb9726c7f4be14 from 2020-02-18. Task-number: PYSIDE-1735 Change-Id: I08b8628e75ef9c664be30200ae295cd2e6004370 Pick-to: 6.3 Reviewed-by: Christian Tismer <tismer@stackless.com>
* PyEnum: Simplify the test-cases with the new forgiveness modeChristian Tismer2022-07-141-10/+4
| | | | | | | | | | | | | | | | | | | | | | With the new forgiveness, all the "normal" uses of old enums are working with the new enums, too. What does not work are range violations and inheritance of enums from other enums. Also, the implemented trick does not work for enums which do not belong to a class. The induced bugs are easy to find, because they should normally break at import time. [ChangeLog][PySide6] The new forgiveness mode of Python enums allows to use old enum code, most of the time. Much changed test code was reverted. Change-Id: I9c081831309f1b2358fe86e6107b0f4d78fd48cf Pick-to: 6.3 Task-number: PYSIDE-1735 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* PyEnum: Increase compatibility by allowing defaults and old flag namesChristian Tismer2022-07-141-0/+115
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch supports to write Qt.Alignment() instead of Qt.AlignmentFlag(0) Also supported is Qt.AlignmentFlag() which is mapped to Qt.AlignmentFlag(0) This trickery was quite involved since the Python opcodes needed to be analyzed if we have a parameterless call. Only in that case, we insert a partial object which supplies the missing value=0 default. Changing the implementation of PyEnum was not desired because this is highly complicated, not portable and even not possible. The change has been tested with Python 3.6 to 3.11.0b3 . [ChangeLog][shiboken6] The new Python enums are made as compatible to the old ones as possible. It is again allowed to use Qt.Alignment() instead of Qt.AlignmentFlag(0), and a default of 0 is always allowed. Change-Id: If6a93f8210ff6cae4e38251420e1ad5fffbe42cb Pick-to: 6.3 Task-number: PYSIDE-1735 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Use SPDX license identifiersLucie Gérard2022-05-2743-1204/+87
| | | | | | | | | | | 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: Prepare Enum tests for both old and new enumsChristian Tismer2022-05-221-4/+10
| | | | | | | | | | | | | | | | | | These tests are now completely identical to the old tests and have an adapted Python Enum version if suitable. Both versions can be selected once at runtime. Having both test versions available as a runtime option is a nice feature that really helps understanding the consequences of the PyEnum move. [ChangeLog][PySide6] The QEnum tests are enabled for both the old Qt Enums and the new Python Enums. Change-Id: I78a7473f4a86f8d2115acc56e4ed11cf135eb000 Pick-to: 6.3 Task-number: PYSIDE-1735 Reviewed-by: Christian Tismer <tismer@stackless.com>
* __feature__: improve the feature module by a reset functionChristian Tismer2022-04-271-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The __feature__ tests need a stronger way to reset the feature selection reliably. Some cross-talk was observed when running multiple tests together with PyTest. This effect was hidden because our unit-tests are isolated in individual processes by CTest. - Remove all special 0x80 cases of TearDown functions - introduce a new feature module function `reset` that completely uninitializes the features, including the `pyside_feature_dict`. - drop the artificial naming of `__feature__` in favor of `feature`. This is less confusing for people examining the implementation. [ChangeLog][PySide6] Feature switching was improved by avoiding cross-talk between multiple test runs. Task-number: PYSIDE-1019 Change-Id: I28550f293763ac58df72b8ce5c0a613c2067f6ba Pick-to: 6.3 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Fix include conventionsFriedemann Kleint2022-04-221-4/+4
| | | | | | | | | Reorder includes such that local includes are first, followed by Qt and C/C++ system includes. Pick-to: 6.3 6.2 Change-Id: Ib801d34de7242befce4be429bfb099ccabe1f987 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Write smart pointer constructors/reset methodsFriedemann Kleint2022-04-201-1/+23
| | | | | | | | | | Enable the generation and invalidate the pointee passed in in case it is a wrapped class. Task-number: PYSIDE-454 Change-Id: I4c751d9e8731a6f70e4ecc0f808cb204f010f9b2 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Tismer <tismer@stackless.com>
* Add a test for QSharedPointerFriedemann Kleint2022-04-076-0/+172
| | | | | | | Pick-to: 6.2 Task-number: PYSIDE-454 Change-Id: I2cb352390a9c6fcc32f8ef871a6de3023ab03237 Reviewed-by: Christian Tismer <tismer@stackless.com>
* PyPySide: disable __feature__ completely, temporarilyChristian Tismer2022-03-111-3/+11
| | | | | | | | | | | | | | | | | | | PyPy is currently not able to handle feature switching. This was disabled, internally only. Be more consequent and avoid a misleading feature that does not work. This will be re-enabled as soon as PyPy is able to exchange class dictionaries. [ChangeLog][PySide6] Feature switching is not only disabled, but also syntactically not allowed in PyPy. Task-number: PYSIDE-535 Change-Id: Ic6a9ef3233db787e050a1ee5c913c24ae6650168 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* __feature__: rework constructor handling of both featuresChristian Tismer2022-02-221-6/+60
| | | | | | | | | | | | | | | | | | | | | | This is a quite complicated patch that tries to do the right thing in all cases with snake_case and true_property. Special is that a property can be a true property that is really turned into a property object, or it can be a pseudo-property which is not a property but should be treated as such. Exhaustive tests for all cases are added. [ChangeLog][PySide6] Properties are now usable in constructors of classes in any combination of snake_case and true_property. Task-number: PYSIDE-1019 Fixes: PYSIDE-1705 Pick-to: 6.2 Change-Id: I1c6b6a24e0bb2e906ecbed225953ac782fed48f7 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Fix the multimap/hash conversion and add the testFriedemann Kleint2022-02-211-0/+1
| | | | | | | | | | | | Avoid iterating over end by removing the increment from the outer loop. Amends 20b207f41b72f857acc1a747ea06f4f657d7d1ea. Pick-to: 6.2 Change-Id: I1adba4c847fa060f594e6eb0c7d2e48356bd1746 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>