aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/tests
Commit message (Collapse)AuthorAgeFilesLines
...
* Upgrade Nuitka to 2.1.0Shyamnath Premnadh2024-03-111-2/+2
| | | | | | | Task-number: PYSIDE-1612 Change-Id: Ieab3a7c7fd43e50e83c30d97cb70f6f1135b69e3 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
* Fix connect() for QObject callablesAdrian Herrmann2024-03-112-0/+46
| | | | | | | | | | | | | | | The addition of the QObject.connect() overload that takes a context resulted in an automatic overload ordering that prevented the right overload from ever being called if the callable was a QObject. Set a manual order to fix this. Pick-to: 6.6 Fixes: PYSIDE-2627 Change-Id: I863f6caaed926b48bc412a29541c1d431ebd50b0 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> 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>
* Deployment: add permission support and create macOS bundle applicationShyamnath Premnadh2024-03-111-12/+15
| | | | | | | | | | | | | | | | | | - Look at the ast of the python files of the application to identify the permissions used by the application. Once the permissions are identified, pass the necessary NS property list key to be added to the Info.plist file to Nuitka. - For macOS, when deploying create a macOS application bundle (.app) by default. This makes it align more with Apple recommendations and Qt deployment. - Fix tests. - Fix wheel_tester.py to consider .app for macOS. Task-number: PYSIDE-1612 Task-number: PYSIDE-2468 Change-Id: Ie225c9a92c845b432a8e7eaa791a8aeb86ecd988 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Fix a crash when using struct.unpack() on a QByteArray with Limited APIFriedemann Kleint2024-03-071-0/+8
| | | | | | | | | | | Unconditionally setting view->strides on the Py_Buffer causes a crash. Update the code in our copy of PyBuffer_FillInfo() from CPython. Fixes: PYSIDE-2628 Pick-to: 6.6 6.5 Change-Id: I6f244090a65442003cecfce70c6f8164b41ba99a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Desktop Deployment: Optimize the plugins includedShyamnath Premnadh2024-03-071-13/+55
| | | | | | | | | | | | | | | | - Applications that use certain modules like Multimedia does not work because the plugins for it were not included. However, including all the plugins can make the application executable huge. This patch filters out the necessary plugins by looking at PySide6_Essentials.json and PySide6_Addons.json shipped with the wheels and only bundles these necessary plugins with the application. - Adjust tests. Task-number: PYSIDE-1612 Task-number: PYSIDE-2597 Change-Id: I35c74907a1782ae5101fb7c0861adcb97db5792d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Deployment: Find dependent modulesShyamnath Premnadh2024-03-063-9/+38
| | | | | | | | | | | | | | | | | | | | - Based on the desktop platform, find all the Qt module dependencies of the application just like Android. These dependencies can help in optimizing the plugins packaged with the application. - Desktop deployment has new cl arguments: --extra-ignore-dirs and --extra-modules that further complements finding the Qt modules used by the application. - Since the Qt dependencies are also required for desktop deployment, 'modules' field in pysidedeploy.spec is moved from under 'buildozer' key to 'qt' key. - dependency finding code moved to dependency_util.py. This also helps in list the imports without conflicts in deploy_lib/__init__.py. - Fix tests. Skip the deploy tests for macOS 11 as the CI does not include dyld_info either via XCode or CommandLineTools. Task-number: PYSIDE-1612 Change-Id: I3524e1996bfec76c5635d1b35ccbc4ecd6ba7b8d Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
* Enum: Move special Flag patch into a snippetChristian Tismer2024-03-052-34/+6
| | | | | | | | | | | | | | 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>
* Deployment Config: Remove Nuitka dependenciesShyamnath Premnadh2024-03-011-2/+2
| | | | | | | | | | | | - ordered_set and zstandard are installed along with Nuitka. We don't need to explicitly specify them anymore. If they are not existing, it means that the user might have explicitly removed them. - Adapt tests. Pick-to: 6.6 Task-number: PYSIDE-1612 Change-Id: I21657cb6df95f2d33f48a719a71f49efab84990c Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Deployment: More Refactoring and minor bug fixesShyamnath Premnadh2024-03-012-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | - setup_python() moved to constructor of PythonExecutable. -install_python_dependencies() moved under PythonExecutable in python_helper.py. - create_executable() of PythonExecutable removed. Instead, we call Nuitka.create_executable() directly. This removes unncessary import problems when using PythonExecutable class for Android Deployment. - nuitka==1.8.0 changed to Nuitka=1.8 in default.spec to match with the installed version. Otherwise, it forces the reinstall of Nuitka==1.8 every time (bug). - Remove recomputation of qt_plugins and local_libs. If the values exist in pysidedeploy.spec, then they should not be computed again. This serves the purposes of speeding up the deployment and also to no modifying the already existing pysidedeploy.spec. - find_pyside_modules() moved from python_helper.py to deploy_util.py. - Adapt tests. - Remove os.fspath wrapping from python.exe. This is not needed as python.exe is already pathlib.Path. Pick-to: 6.5 6.6 Task-number: PYSIDE-1612 Change-Id: Ic598e57cd2f2779c410b12fc9584cf60c5e94505 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Deployment: RefactoringShyamnath Premnadh2024-02-292-9/+23
| | | | | | | | | | | | | | | | | | | | | | | | - Functions in buildozer.py for finding the local_libs, plugin and Qt module dependencies of the application are related to the overall config of the application and not buildozer. Hence, these functions are moved to android_config.py. - `ALL_PYSIDE_MODULES` moved to a function under deploy_lib/__init__.py and `platform_map` moved to deploy_lib/android/__init__.py. - Enable the user to pass both arm64-v8a and aarch64 as the architecture type. Same for all the other architecures that are synonymous. - `verify_and_set_recipe_dir()` is now called explicitly from android_deploy.py due to `cleanup()` deleting the recipe directories during config initialization. - New property `dependency_files` for AndroidConfig class. - Fix --dry-run for Android Deployment. - Adapt tests. Pick-to: 6.6 Task-number: PYSIDE-1612 Change-Id: Icdf14001ae2b07dc8614af3f458f9cad11eafdac Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* signature: Add support for classmethodsCristián Maureira-Fredes2024-02-251-5/+4
| | | | | | | | | | | | | | | | | | | | Two tests were adapted, because now the missing signature error message: TypeError: xxx.__dict__['yyy'].fset(<class 'object'>) is wrong (missing signature) does not apply, and we get the usual message: TypeError: xxx.__dict__['yyy'].fset" called with wrong argument types: this comes from the fact that we are not getting the string representation of the signature, but the data type itself. Change-Id: Ib9c8b7f863063b384c41dea32e2b4b01f0695f82 Fixes: PYSIDE-1955 Pick-to: 6.6 6.5 6.2 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@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 benchmark script for lazy initialization, comment fixChristian Tismer2024-02-161-1/+0
| | | | | | | Change-Id: I3a8b6c8f708f97a1dc26540a23bdeb5c91d87ceb Pick-to: 6.6 Task-number: PYSIDE-2404 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Tests: Stop comparing QMimeType descriptionsFriedemann Kleint2024-02-161-4/+3
| | | | | | | | | Updates to freedesktop.org.xml in QMimeDatabase can break the test. Task-number: PYSIDE-2497 Change-Id: I812fafd37f98bd44f5b61c2c247eca34ebafa047 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Add benchmark script for lazy initializationFriedemann Kleint2024-02-151-0/+39
| | | | | | | | Pick-to: 6.6 Task-number: PYSIDE-2404 Change-Id: I0e9249504ba1dbcff7317413d9ad8c774e60fdd2 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* qmimedatabase_test.py: Fix for 6.7/WindowsFriedemann Kleint2024-02-151-2/+1
| | | | | | | | | | The mime type returns an upper case description on Windows. Task-number: PYSIDE-2497 Change-Id: I6d2254080d71feb9cd9a42c2f12c168ad3eae5e1 Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io> Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* QTimer: Call C++ function for singleShot timersAdrian Herrmann2024-02-131-1/+63
| | | | | | | | | | | | | The current implementation of singleshot timers is very old and bypasses the C++ function. Instead, a timer object is manually created and started. This incurs a performance penalty, as this bypasses the optimized code path for 0 timers that eschews a timer object in favor of directly calling QMetaObject::invokeMethod. This is now fixed, and for 0 timers, the C++ function is called directly. Change-Id: Idfed06d60eb34355242818ac2df46f75dd27353c Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* QTimer: Fix singleShot overload with contextAdrian Herrmann2024-02-072-1/+17
| | | | | | | | | | | The singleShot overload with context had a problem where if the functor was a slot of a QObject, it would not have a sender when it should. To fix this, the newly added QObject.connect() overload with context is used. Pick-to: 6.6 Change-Id: I654c09efb0d1b37ea0c014e9f17cd5e1913d1a96 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Android Deployment: Explicit android group in config fileShyamnath Premnadh2024-01-311-3/+3
| | | | | | | | | | | | | - Distinguishes the changes fields as only relevant for Android Deployment. - This distinguishing group makes it clearer when we finally have iOS wheels. Pick-to: 6.6 Task-number: PYSIDE-1612 Change-Id: I215d2deec0117ae855e6d9a061642984eccd36ef Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* flake8: deploy testsShyamnath Premnadh2024-01-312-8/+9
| | | | | | | | | | | - general flake8 fixes. - this prevents flake8 from reporting E402 error for `from init_paths import init_test_paths` not being in the top of the file. Pick-to: 6.6 Change-Id: Id21ef66979cb7e79db63c656cc150017751d1716 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* PySide6: Change QObject.disconnect() to return False with warning on failureFriedemann Kleint2024-01-161-1/+1
| | | | | | | | | | [ChangeLog][PySide6] QObject.disconnect() now returns False instead of raising an exception for non-fatal cases. Fixes: PYSIDE-1275 Change-Id: I860b69e1a7055c38f903ffafd7f816575c0d1f7a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Tismer <tismer@stackless.com>
* Fix imports of widget test bug_854.pyFriedemann Kleint2024-01-121-2/+2
| | | | | | | | The test is crashing on Windows due to a missing import. Pick-to: 6.6 6.5 Change-Id: Iec366a236c72185b2768c4d08a4eb2b7c982e237 Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
* PySide6: Add QQmlEgine.singletonInstance()Friedemann Kleint2024-01-091-12/+42
| | | | | | | | | [ChangeLog][PySide6] QQmlEgine.singletonInstance() has been added. Pick-to: 6.6 Change-Id: Ib1b48df49ca8a183dba415a04f414903f58e435c Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> 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>
* QtAsyncio: Shorten test durationsAdrian Herrmann2024-01-076-12/+15
| | | | | | | | | | | Most QtAsyncio tests are slow because they sleeps. Shorten their durations across the board by using shorter sleeps. E.g., this reduces the duration of the queue test from about 16 seconds to less than 6. Pick-to: 6.6 Task-number: PYSIDE-769 Change-Id: I5072bb71fbe28509427fb92390584ec1a4d1a128 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* QtAsyncio: Fix cancelling waiting tasksAdrian Herrmann2024-01-071-0/+46
| | | | | | | | | | A task that is awaiting a future must also cancel this future in order for the cancellation to be successful. Pick-to: 6.6 Task-number: PYSIDE-769 Change-Id: I22a9132fc8506e7a007fe625bc9217f0760bdc6b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Fix qCompress/qUncompress() taking a PyBuffer/len argumentsFriedemann Kleint2024-01-051-1/+23
| | | | | | | | | | | | | | | | | | | | | | | The overloads taking a uchar * data argument were generated using the converter for uchar, causing warnings: qbytearray.h:639: There's no user provided way (conversion rule, argument removal, custom code, etc) to handle the primitive type 'const uchar *' of argument 1 in function 'qCompress(const uchar * data, qsizetype nbytes, int compressionLevel)'. qbytearray.h:640: There's no user provided way (conversion rule, argument removal, custom code, etc) to handle the primitive type 'const uchar *' of argument 1 in function 'qUncompress(const uchar * data, qsizetype nbytes)'. This was never noticed since we have a conversion from PyBuffer to QByteArray and the overload decisor checks only whether the minimum argument is satifisfied, so, so qCompress(data,len,level) it called qCompress(bytearry,len), passing the length as level. To fix this, modify the argument to PyBuffer as is done for QImage and give it overload-number 0, so that PyBuffer is checked first without conversion to QByteArray. Add a test for both cases. Amends ae51319fa8a7c02642f5d35f5d613c22e9ce8ecb. Task-number: PYSIDE-838 Change-Id: Ib9b22a24257fcf93ce3458d8514cdda2e4843f64 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* PyPySide: Fix a problem with __warningregistry__Christian Tismer2023-12-281-2/+0
| | | | | | | | | | | | | The function `isolate_warnings` has a problem when called on a external module. Seen in `existence_test.py`. Improve the function to not touch irrelevant modules. Change-Id: Icb661717b111bd400abb30799fb97f630fdc3297 Pick-to: 6.6 Task-number: PYSIDE-535 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Add QtQuickTestFriedemann Kleint2023-12-246-0/+78
| | | | | | | | | | [ChangeLog][PySide6] QtQuickTest has been added. Fixes: PYSIDE-2543 Change-Id: I949a0e50a2e522589863ade1e2b2335be580a0d7 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Adrian Herrmann <adrian.herrmann@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>
* Add QQuaternion getAxisAndAngle()/getEulerAngles()Friedemann Kleint2023-12-211-1/+7
| | | | | | | | Address a fixme-comment in the typesystem file. Change-Id: I9242a04cab75229480efa81a98dc0bbef9bb4e61 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* Implement QLockFile::getLockInfo()Friedemann Kleint2023-12-201-0/+3
| | | | | | Change-Id: Idd19498383f3a785a6a393ff8e9d07b6d45bb14e Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Avoid converting to string for calculating the hash valueFriedemann Kleint2023-12-191-2/+33
| | | | | | | | | | | | | | | Partially revert bf8a60db4cdbfc3e7c9c98778b219e9c83746d44, which introduced a helper function converting to QString for Q(Date)(Time) and QUrl. For these classes, the qHash() function should be found by the code model after 9c37876d6f649b3c9bd1411d3c7ffe620786f1a8. Extend the test accordingly. Deprecate the QString-helper. Task-number: PYSIDE-1906 Change-Id: Ia210a2210bc6a43991d5b26374039f4e86d0e71e Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* QtAsyncio: Implement call_soon_threadsafe()Adrian Herrmann2023-12-141-0/+58
| | | | | | | | | | | | | | | Using the QTimer.singleShot(msec, context, functor) overload in QAsyncioHandle already turned call_soon() threadsafe, as that allowed callbacks to be scheduled from other threads. In order to follow the API and distinguish call_soon() and call_soon_threadsafe(), the former is reverted to using the old overload without the context argument, while the latter keeps the new overload. Pick-to: 6.6 Task-number: PYSIDE-769 Change-Id: Ib2591f994d082b46fe4ec747e590e4d8eb6ff24e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* Deployment: Update TestsShyamnath Premnadh2023-12-083-122/+214
| | | | | | | | | | | | - Use existing `BaseConfig` class instead of created a new class based on 'Configparser' for parsing .spec files. - Update and add Android deployment tests to CI. Pick-to: 6.6 Task-number: PYSIDE-1612 Change-Id: I32cd16e08781c71fb534bbfe7e3726818475366b Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Deployment: Add icon for applicationShyamnath Premnadh2023-12-041-4/+16
| | | | | | | | | | | | | | | | | | | | | | | | | - For Android deployment, by default kivy's icon is used when the application is deployed. This patch makes use of PySide icon as the default for all applications created with pyside6-android-deploy. - Icon formats accepted by Nutika windows: .ico macOS: .icns (contains a 128x128 .png file) linux: all standard image formats. We use .jpg - For Desktop deployment - change the option --linux-onefile-icon to --linux-icon. Both are the same. - Add icon options for macOS and Windows. - Adapt deployment test accordingly. - As an addition, add a default value to the --config-file option so that it picks up the one in the project directory automatically, if it exists. It aligns with the desktop deployment tool as per 6337e4a306babdb4015c248a14ad734b320ed2c1 - As another extra, remove an unused typing import from config.py Pick-to: 6.6 Task-number: PYSIDE-1612 Change-Id: Ia67ea96f94ddffe4bc65652f91c8b394c4e56a33 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Upgrade Nuitka to 1.8.0Shyamnath Premnadh2023-12-041-7/+7
| | | | | | | | | | | | - No more warning on 3.11. Still no support for 3.12. - As a drive by, remove deployment related packages from the project's requirements.txt file. Pick-to: 6.6 6.5 Task-number: PYSIDE-1612 Change-Id: I1d379b4241d3e40de107ceb8c8d28b893de39dec Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Enable connecting signals to slots with default parametersFriedemann Kleint2023-11-291-0/+20
| | | | | | | | | | | | | | | Find the number of default parameters using PyFunction_GetDefaults() and change the argCount() helper to return the min/max argument count. With that, try to match the slot using the most argument. [ChangeLog][PySide6] It is now possible to connect signals to slots/lambdas with more arguments provided they have default parameters. Fixes: PYSIDE-2524 Change-Id: I134d33e3ee78b62689fa36887a9acd41951c02e1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* Tests: Fix some flake warningsFriedemann Kleint2023-11-2856-72/+111
| | | | | | | | Mostly spacing related. Pick-to: 6.6 Change-Id: I748a8a06f456c5d4bafb94c397c43b3b2ee9e3e9 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* QtAsyncio: Add wrapper for calls in executorAdrian Herrmann2023-11-241-0/+46
| | | | | | | | | | | | | | | Executors require a bit of extra work for QtAsyncio, as we can't use naked Python threads, instead we must make sure that the thread created by executor.submit() has an event loop. This is achieved by submitting a small wrapper that attaches a QEventLoop to the executor thread, and then creates a singleshot timer to push the actual function for the executor into this new event loop. Pick-to: 6.6 Task-number: PYSIDE-769 Change-Id: I77569d8939d6040ddbe62a99448c6ced2785f27e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* QTimer: Implement singleShot signatures w/ contextAdrian Herrmann2023-11-241-2/+28
| | | | | | | | | | | | On C++, it is possible to call singleShot timers with a context object as an argument. This allows posting events to the event loop of the given context object's thread, instead of the thread of the current thread. Implement corresponding signatures to add this capability to Qt for Python. Pick-to: 6.6 Change-Id: I0c4e3ef4b859cdfaac07415ff64c440821e7f442 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Shiboken: Fix subtle bug caused by PyPy support and "bug_825"Christian Tismer2023-11-143-5/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When implementing PyPy support, all Shiboken types lost their hidden extra fields, because they were replaced by shadow dicts. This creates a problem with multiple inheritance. In Python < 3.12, the decision which base type will create the instance is driven simply by the size of the type. In class MetaC(MetaA, MetaB): pass when MetaA is derived from type and MetaB is derived from SbkObjectType, MetaA is not the type that should win. Fixed by simply adding 1 to the default size of PyType_Type. Caused by bug_825 corrected version. The old test is retained as bug_825_old.py . NOTE: This touches a Python 3.8 bug that was fixed in 3.9.12 and 3.10.4 - unfortunately CI Python is older in all cases. Task-number: PYSIDE-2230 Change-Id: I6e82cafb83c8351bbbeafcc80e11d5e45568f73d Pick-to: 6.2 6.5 6.6 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Add static create() function for decorated QML singletonsFriedemann Kleint2023-11-092-2/+22
| | | | | | | | | | | | | Check for static method named "create()" and use that as a singleton creation callback. [ChangeLog][PySide6] It is now possible to use a static method create(engine) for creating decorated QML singletons. Fixes: PYSIDE-2432 Change-Id: I76c47385a0064733a1949a30d22cc01c280d0423 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Add QMetaMethod::invoke()Friedemann Kleint2023-11-011-0/+21
| | | | | | | | | | [ChangeLog][PySide6] QMetaMethod.invoke() has been added. Pick-to: 6.6 Fixes: PYSIDE-2500 Change-Id: I270489ec9372ddfee19e9342c1312d8c446ee5d9 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* deploy: Apply fixes when using pyenv and provide readable errorsChristian Tismer2023-10-181-45/+86
| | | | | | | | | | | | | | | | | | | | When the patch for pyenv was applied, some tests in test_pyside6_deploy.py were broken, which shows up locally but not (yet) in CI. For better understanding, the test classes were further broken up into three groups (irrelevant, might be undone). Things became clearer by writing a special version of unittest.TestCase that handles long strings as lists. REMARK: We are at Python 3.8 and can use ":=" now :=) Task-number: PYSIDE-1612 Change-Id: I3a479f48b96dd5f95864b8a94af6d01b42ffc196 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Remove registry existence files of 5.15Friedemann Kleint2023-10-174-151055/+0
| | | | | | | Pick-to: 6.6 6.5 Change-Id: I5fef2da79500ca40400ba7943183ab22d85ad22d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Support running PySide on Python 3.12, cleanupChristian Tismer2023-10-161-0/+4
| | | | | | | | | | | | | | | | | In the course of fixing 3.12 issues, a 3.11 fix for PyEnum was missing that created a 3.11 error. A bug with deployment was fixed but not reflected in the tests. This was only visible for pyenv users. Also fixes a minor cosmetic bug introduced by "Python 3.12: Fix the structure of class property" Task-number: PYSIDE-2230 Change-Id: I3a6bd6426e23168dfccdda17b408f193aacd28a0 Pick-to: 6.2 6.5 6.6 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@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-093-2/+25
| | | | | | | | | | | | | | | | | | 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>