aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/tests
Commit message (Collapse)AuthorAgeFilesLines
...
* PySide6: Prevent crash when connecting to temporary signal sourcesFriedemann Kleint2023-05-171-1/+6
| | | | | | | | | Add a check to the connect function. Pick-to: 6.5 Fixes: PYSIDE-2328 Change-Id: I62a10ef5710487f8ab23cc46c1cc4a34fab5e2b1 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* Fix anonymous slot memory leak testAdrian Herrmann2023-05-151-32/+15
| | | | | | | | | | | - Remove LeakerExternal test. - Use the right assert. - General simplifications. Task-number: PYSIDE-2299 Pick-to: 6.5 Change-Id: I0851b2b75ff5658d0ced18b73a4a4b175397cc88 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Numpy support: Fix 64bit support and compiler warning about potentially ↵Friedemann Kleint2023-05-111-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | uninitialized value The size for long long was incorrect. Fix it and expand the test to check values as well. For really bizarre long types, the variable might be uninitialized, causing shiboken6/libshiboken/sbknumpyview.cpp:82:12: warning: type may be used uninitialized in this function [-Wmaybe-uninitialized] Fix by introducing a helper returning a std::optional. Amends 499832abfdf13eac5aa35f84a62166fb5aa2e034. Task-number: PYSIDE-2313 Pick-to: 6.5 Change-Id: Ie7d22a728a42f644fa84cba811c4e35e7db7ebb5 Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Tismer <tismer@stackless.com>
* Fix leak connecting signals to anonymous functionsAdrian Herrmann2023-05-111-0/+72
| | | | | | | | | | | | | | | | | When connecting a signal to the same anonymous function repeatedly, a new GlobalReceiverV2 object would be created after each call. Each GlobalReceiverV2 would have a unique callback object despite all these callback objects sharing the same code. This would lead to a large number of GlobalReceiverV2 and callback objects, each never reaching a refcount of 0 and thus never being released. The remedy is that we only need one GlobalReceiverV2 object, whose corresponding GlobalReceiverKey references not the outer callback object, but the code object associated with it. Pick-to: 6.5 Fixes: PYSIDE-2299 Change-Id: I474284dc5ce08dc6601636f2e7ac5e5a10ed8560 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Numpy support: Handle short/long/long long integer typesFriedemann Kleint2023-05-052-0/+44
| | | | | | | | | | | | | | | The default type of numpy is int64 on Linux and long in Windows these days. As numpy is still based on the old long/long long scheme for the types, add some mapping. [ChangeLog][shiboken6] numpy support has been extended to handle short/long long integer types. Fixes: PYSIDE-2313 Pick-to: 6.5 Change-Id: I75d9277ae0867401c2c188efb3a50f4c53c4fc24 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QML reference examples: Add notify signals and final attribute to propertiesFriedemann Kleint2023-05-034-4/+4
| | | | | | | | Task-number: PYSIDE-2206 Task-number: QTBUG-111033 Pick-to: 6.5 Change-Id: I0541a3bbb4e5696962802da7f91ab79682700124 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Move the QML reference examples around to match the structure in QtFriedemann Kleint2023-05-026-10/+12
| | | | | | | | | | | Adapt the tests accordingly. Task-number: PYSIDE-2206 Task-number: QTBUG-111033 Pick-to: 6.5 Change-Id: I332d6467da56b88ecbf9282d23092d8d47b730e0 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* Android Deployment: testsShyamnath Premnadh2023-04-172-0/+180
| | | | | | | Pick-to: 6.5 Task-number: PYSIDE-1612 Change-Id: Icd4a6efc828f2b4843ec40d4766788120ed6789e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Deployment: RefactoringShyamnath Premnadh2023-04-171-1/+1
| | | | | | | | | | | | - Fix --dry-run in Android deployment - Add option to control raising a warning when adding new entries to config file - Remove unnecessary code and comments Pick-to: 6.5 Task-number: PYSIDE-1612 Change-Id: I5975d76024d6289fe6b9af1caeca374acb81e8cc 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>
* Deployment tool: extensive testsShyamnath Premnadh2023-04-032-0/+176
| | | | | | | | | - Extensive testing scripts to test different scenarios. This will not be added to the CI. Task-number: PYSIDE-1612 Change-Id: Ibb9d1046d1e2b6999c50372d1aeffb2dd34b9781 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Deployment: Fix Nuitka Qml IssueShyamnath Premnadh2023-03-301-2/+2
| | | | | | | | | | | | | | | | | - Nuitka tries to do patchelf on all files in the 'Qt/qml' plugins folder. Although this is a Nuitka bug, the file qtquickcontrols2.conf that cause patchelf errors comes from the newly added MaterialEditor Qml plugin, which has no relevance to PySide6. Hence, removing it. - Some of the Qml issues were fixed by upgrading Nuitka to 1.5.4 - Adapt test Fixes: PYSIDE-2260 Task-number: PYSIDE-1612 Pick-to: 6.5 Change-Id: Ibc274769251e0533d960346a9d8271b2f65dcae9 Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Deployment: Change "desktop_packages" back to "packages"Shyamnath Premnadh2023-03-301-2/+2
| | | | | | | | | | - breaks source compatibility otherwise Task-number: PYSIDE-1612 Pick-to: 6.5 Change-Id: Ie0fd353872b7a93c94b650b09aa0fa53692e2455 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
* Deployment: Refactor to enable Android supportShyamnath Premnadh2023-03-291-2/+2
| | | | | | | | | | | | | | | | | | - moving code into functions so that Android can re-use them - new file "deploy_util.py" to store all the common utility functions that can be reused for Android deployment tool - new option "--name" to set the application name - Change some print statements to log statements - Adapt depoyment tests - In default.spec, rename "packages" to "desktop_packages" - Fix relative Qml file error in config.py i.e. it errors when the path is already relative Task-number: PYSIDE-1612 Pick-to: 6.5 Change-Id: Iaaea8837cc362b3cc8035b96247194c4a9679579 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Deployment Tool: Remove create_venv + fix --dry-run/--initShyamnath Premnadh2023-03-271-6/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | - As the deployment tool's code base grows larger, I realized that the ability to create a venv using pyside6-deploy was a bit of over engineering. There are instances where I have to use the current Python interpreter to fetch some information from the newly created venv Python, which results in weird code. Note: The tool would still work even if the user is using a globally installed Python interpreter with PySide6 installed. - Now, the user is warned if he is not in a virtual environment and prompted the requirement to install further Python packages. If the user input's "no", then the tool exits. - dry_run used to create an empty 'pysidedeploy.spec' which can wreck the normal deployment process. This is fixed by pyside6-deploy using the 'default.spec' instead of creating a new 'pysidedeploy.spec'. Fixes: PYSIDE-2258 Task-number: PYSIDE-1612 Pick-to: 6.4 6.5 Change-Id: I376d2a6aea9f93582eab7a904a81f48426bfee18 Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@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>
* test qtexttospeech_test.py: Run with "mock" engine as last resort onlyFriedemann Kleint2023-03-181-0/+2
| | | | | Change-Id: Ib45fd4b8769d66036f1f0ae5c8caa1ccf345808b Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Expose QAbstractTextDocumentLayout::PaintContextFriedemann Kleint2023-03-171-4/+37
| | | | | | | | | Extend the QRasterWindowTest to test it. Fixes: PYSIDE-2252 Change-Id: If36253d00edab4dc9026ccd483485b2ba6d3f69e Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io> Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* Fix test qtexttospeech_test.py to run in 6.4Friedemann Kleint2023-03-171-0/+1
| | | | | | | | | | | | The test was missing an application import, which did not show in 6.5 since there, no text to speech engine can be found any more. Amends 52e3888582ac3f3db322d7113734ce43dc325099. Pick-to: 6.4 Task-number: PYSIDE-1564 Change-Id: I5c7855889b2e1b5e6a836bd99c10ac761c0802ac Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* testing: modernize UsesQApplication and remove other versionsChristian Tismer2023-03-1671-244/+190
| | | | | | | | | | | | The last change to UsesQApplication can be generalized to be able to remove the QtCore and QtGui versions. Instead, the module and class to use are computed from the content of sys.modules . Task-number: PYSIDE-1564 Change-Id: Iac1fe3a2d6bb5a9f7638eb889f55b079cb55c272 Pick-to: 6.4 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Deployment: Specify Package VersionShyamnath Premnadh2023-03-161-2/+2
| | | | | | | | | | | | | | | - Specific package versions can be specified as {package_name}=={version} - Nuitka 1.5.1 breaks with PySide6, so use version 1.4.8 - new package "importlib_metadata" required to find a python package's version at run time. This is added to Python from 3.8, but since we support 3.7 the package "importlib_metadata" is required - modify test accordingly Task-number: PYSIDE-1612 Pick-to: 6.4 Change-Id: Ie74273ba2a116f0f94f3a3e10120b2de78482724 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* testing: make usesqapplication work with any libraryChristian Tismer2023-03-141-3/+6
| | | | | | | | | | | | For comparison reasons, it is nice to use the same helper module, regardless which library is used. Task-number: PYSIDE-1564 Change-Id: I94de9400dded1fd709156abae7d4f05adee768a1 Pick-to: 6.4 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io> 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>
* PySide: Add QRunnable create()Shyamnath Premnadh2023-02-272-0/+46
| | | | | | Fixes: PYSIDE-2234 Change-Id: I3fc1c669c3985a8aad57785927fb4e48e69431a4 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Add QMetaMethod.fromSignal()Friedemann Kleint2023-02-271-2/+8
| | | | | | Fixes: PYSIDE-2236 Change-Id: Ibf516529799b35982c8c210f657983d511b622a0 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Mangle field name "from"Friedemann Kleint2023-02-271-1/+12
| | | | | | | Fixes: PYSIDE-2237 Pick-to: 6.4 Change-Id: I9993bbaf545e2868a5be900f793e5ae23f17235f Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* Add license headers to cmake filesFriedemann Kleint2023-02-1613-0/+39
| | | | | | | | | | | | 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>
* testing: make multiple_feature_test.py less verboseChristian Tismer2023-02-131-4/+8
| | | | | | | | | | | | The test writes out very much when there is any error happening in CI. With NoGIL, this becomes very boring. It now only prints if the "-v" flag is given. Task-number: PYSIDE-2221 Change-Id: I511b1fd56407a875797cfec958f5e0beff42f7a3 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Adrian Herrmann <adrian.herrmann@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>
* Adapt to Qt 6.5Friedemann Kleint2023-02-091-1/+1
| | | | | | | | | | | | | | | | | | | | - Add new enums - Hide field QMetaMethod::mobj made protected by qtbase/0b701ec0cd86afbf6bb0d0abb361cfb6500c2e1b - Adapt to PDF qtwebengine/6769bd1544c56a514fe35bf16d05614605a49bea - Adapt to qhttpserver/55d10201dc7a47b239825548e053c1fb0de61115, adding a virtual method with rvalue reference to QAbstractHttpServer - create_wheels.py: Adapt to changed location of the metatypes directory in Qt after qtbase/4234ce12dc819b9ca76c8dc4c251f5bd4fe0bc9c. - Adapt error column in QDomDocument test - Fix QMetaObject::invoke() to work after qtbase/fe92b080658f0d8609e2a2a69e5ec2b51dd7bf9d by making the cast of the helper types to Q(Generic)ReturnArgument explicit in the snippets Change-Id: Ifb514878e999ad4c9ef00ff83172626eff112a3d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* signals: Introduce Weak Reference to protect lost SignalInstanceChristian Tismer2023-02-021-1/+26
| | | | | | | | | | | | | | | | This first solution detects the vanishing object and raises an exception. Trying to revive the object was unsuccessful. Since this happens only when no signals are connected, it is ok to leave it this way. Change-Id: Ib47f85657363b675cec3616b5550ce41d93fb4d3 Fixes: PYSIDE-2201 Pick-to: 6.4 Task-number: PYSIDE-79 Task-number: PYSIDE-68 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* shiboken6: Add order depending on type range for C++ primitive types to the ↵Friedemann Kleint2023-01-091-0/+5
| | | | | | | | | | overload sorter Task-number: PYSIDE-2168 Task-number: PYSIDE-2133 Change-Id: I81e9d3369b1f4533239a172f48d11f52731f8484 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* PySide6: Fix negative values causing an error in QLocale.toString()Friedemann Kleint2023-01-091-0/+6
| | | | | | | | | | | Apply the same filtering as introduced for toCurrencyString() by 52e3b960b30950ac7bb59bb31e00d6d1038828f1 to prevent unsigned overloads from being generated. Fixes: PYSIDE-2168 Pick-to: 6.4 6.2 Change-Id: I3b74e9db238e9b4f34fd7bc1ff7a3a5ac7682d37 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Fix test_pyside6_qml.pyShyamnath Premnadh2023-01-051-1/+1
| | | | | | | | | | - has dependency on QtQuick when running the rest - removed QtQml check for disabling the test because QtQuick should cover QtQml automatically Pick-to: 6.4 Change-Id: I762669290bf8e9ab282024f1a040548ebfcf2297 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Deploy tool: Reduce QML executable size + testsShyamnath Premnadh2022-12-291-16/+111
| | | | | | | | | | | | | | - Added more Nuitka options to reduce the size of QML executable. Some binaries which cause the QML executable to become heavy eg: QtWebEngine are removed, if they are not used - Add new log messages for --verbose option - Add deploy.pyproject file - Modifies pyside6-deploy tests to consider the QML options, by mocking pyside6-qmlimportscanner Task-number: PYSIDE-1612 Change-Id: Id2e94217e99eedbf41ecfc8de1a37e94c7edaa52 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* deploy tool: fix dry_run testShyamnath Premnadh2022-12-292-50/+32
| | | | | | | | | | - instead of using subprocess module to execute the deploy.py file directly, call the main() in deploy.py. This also enables mocking deploy tool functions. Task-number: PYSIDE-1612 Change-Id: Ia4eb43ff9f514a732399ea406ee15f94b4ffdf6d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@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>
* Fix QObject::sender() for non-C++ slotsFriedemann Kleint2022-12-122-0/+64
| | | | | | | | | | | | | | | For non-C++ slots routed via GlobalReceiverV2, sender() of the receiving QObject returns 0. To fix this, store the sender obtained in GlobalReceiverV2::qt_metacall() temporarily in a special dynamic property of the receiver and inject code checking it into QObject::sender(). This fixes at least the synchronous calls. Fixes: PYSIDE-2144 Fixes: PYSIDE-1295 Change-Id: Ia111162eb1404914ecfb7f19fadb8a1b63ae8b4a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Remove pyqt_diff.pyShyamnath Premnadh2022-12-071-39/+0
| | | | | | | | | | - don't see the use case of this with the missing_bindings tool supporting all the available cases of comparing PySide6 and PyQt6 Change-Id: Ia77755b892620d60bfbdccb97008e6a846bd5ef0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* PySide Tools: Deploy Tool TestsShyamnath Premnadh2022-12-052-0/+184
| | | | | | | | | | | | - test --dry-run in different scenarios for widgets and qml In this particular case, running --dry-run is equivalent to mocking Nuitka because the output command is the command run by Nuitka - tests the contents on config file for widgets and qml deployments Pick-to: 6.4 Task-number: PYSIDE-1612 Change-Id: I4624bdc71f9ccd027147ca10a942037d6c43fbfc Reviewed-by: Christian Tismer <tismer@stackless.com>
* 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>
* PySide6: Fix float type overloads of QLocale.toCurrencyString()Friedemann Kleint2022-11-251-0/+6
| | | | | | | | | | | | | | | | | | | QLocale.toCurrencyString() has a plethora of overloads from short/ushort to long long and float types. Since the overload sorter currently has no rules for preferring float over unsigned integer types, an unsigned conversion was done for float types with decimals, resulting in decimals being lost. This could arguably be fixed by adding rules for preferring float over unsigned integer types. However, since Python only knows int and float, it does not really make sense to generate a complex overload logic. Remove the unsigned and short overloads instead. Fixes: PYSIDE-2133 Pick-to: 6.4 6.2 Change-Id: Id2ef2ec02f4f962606851faf237d80196872eed2 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@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-1132-0/+562
| | | | | | | | 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>
* Fix passing dicts as QVariantMap to QMLFriedemann Kleint2022-11-082-0/+150
| | | | | | | | | | | Add the name to the known types for signal/slot signatures, preventing it from falling through to the PyObject default converter, which causes reference leaks. Fixes: PYSIDE-2098 Change-Id: Id95d8a352dd1913bd10578f1ec11de0c533e8f40 Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>