aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/libpyside/pyside.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* shiboken6: Port some loop variables to qsizetypeFriedemann Kleint2022-10-131-1/+1
| | | | | | | | Where possible, used range-based for. Otherwise, use qsizetype for loop variables. Change-Id: I4773bee8468ce73722656ec73845369b7d40d4cd Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Add a logging category to libpysideFriedemann Kleint2022-08-261-0/+3
| | | | | | | | | | | | | | | | | | It provides: - Debug output for Qt meta calls (useful for debugging QML applications). - Warnings, for example about dynamic slot registration caused by missing decorators. It can be enabled for example by export QT_LOGGING_RULES="qt.pyside.libpyside.warning=true". [ChangeLog][PySide6] A logging category "qt.pyside.libpyside" with warnings has been added to libpyside. Task-number: PYSIDE-2033 Change-Id: Ie972b85b8e92d2f3e2cf00efbc1047a178d95241 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Shiboken: Optimize attribute access a bit moreChristian Tismer2022-06-201-2/+2
| | | | | | | | | | | Some leftover attributes can be turned into statics, too. The StaticMetaObject needs to be moved into Shiboken in preparation of the following enum checkin. Task-number: PYSIDE-1735 Change-Id: I2172bd785ae229ea5637588c53be660477fc2f0e Pick-to: 6.3 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-271-38/+2
| | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: I065150015bdb84a3096b5b39c061cf0a20ab637d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Move numpyview from libpyside into libshibokenFriedemann Kleint2022-05-131-2/+0
| | | | | | | | | | libpyside then no longer depends on numpy. There is only one place left where numpy is initialized, allowing for dynamic loading. Task-number: PYSIDE-1924 Change-Id: I50d02814f8cc6eb85d8cdb5330cfff3b586656ad Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* libpyside: Fix qMetaTypeFromPyType() for wrapped typesFriedemann Kleint2022-05-091-1/+1
| | | | | | | | | | | | Replace the type check by Shiboken::ObjectType::checkType(pyType) since it is inherited. Amends 6e26532b6b8430ba4d8a56aebeea5adf73501faf. Task-number: PYSIDE-1898 Change-Id: I6b32d678e9729112f9a475e5419bb976a5be553d Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* libpyside: Add QString to UNICODE conversionFriedemann Kleint2022-04-291-0/+6
| | | | | | | | Complements dffe483604d6371112da6ef5ad40c6dfcee20f76. Task-number: PYSIDE-1898 Change-Id: I65bf5631ca2507a6488db370dfc8972b1a1e3c5f Reviewed-by: Christian Tismer <tismer@stackless.com>
* libpyside: Add function to convert a PyTypeObject to a QMetaTypeFriedemann Kleint2022-04-281-0/+14
| | | | | | | | Move the snippet into the library for further use. Task-number: PYSIDE-1898 Change-Id: If04da23cb0a4890474810ca762cc2ee29de480f6 Reviewed-by: Christian Tismer <tismer@stackless.com>
* libpyside: Move the UNICODE conversion into the libraryFriedemann Kleint2022-04-281-5/+20
| | | | | | Task-number: PYSIDE-1898 Change-Id: I8ed11bb3f46a5e26adf8bcb7aa3f083adde40628 Reviewed-by: Christian Tismer <tismer@stackless.com>
* __feature__: rework constructor handling of both featuresChristian Tismer2022-02-221-50/+226
| | | | | | | | | | | | | | | | | | | | | | 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>
* __feature__: Do the renaming also in the hidden methodsChristian Tismer2022-02-151-11/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | It has taken quite a while until it was understood why mistyped (un-renamed) methods are still found when using `snake_case`. It is a very old patch that searches hidden objects via the QMetaObject when normal attribute retrieval fails. This implementation is used all the time, but it is easily overlooked because most generated wrapper objects use this implementation from QObjectWrapper by inheritance, and is not found in the source code. Renaming these hidden methods the same way as the normal methods are renamed solves this problem. As a side effect, the solution to PYSIDE-1765 becomes more complete, too, since these hidden attributes were really missing. [ChangeLog][PySide6] The snake_case feature is now more complete since it renames hidden methods, too. Change-Id: I8614314e417a40549ef09f3105a03f22cb575bab Fixes: PYSIDE-1753 Task-number: PYSIDE-1765 Pick-to: 6.2 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* PyPySide: Rename interface functions and classes to simplify debuggingChristian Tismer2022-02-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | The names of certain interface functions are not always following a simple scheme. Especially it is not easy to see immediately if we are dealing with a method of SbkObjectType or SbkObject Do a few renamings to simplify debugging and make the code easier to understand. When a function is used in a type spec and there is no other important reason, it should be named like {Py_<tpname>: reinterpret_cast<void *>(<TypeName>_<tpname>)}, Rename also all type functions ending on "TypeF()" to end in "_TypeF()". This is not always the case. Examples: SbkObjectTpNew -> SbkObject_tp_new SbkObjecttypeTpNew -> SbkObjectType_tp_new PyClassPropertyTypeF -> PyClassProperty_TypeF Task-number: PYSIDE-535 Change-Id: Icbd118852f2ee732b55d944ed57c7a8ef7d26139 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* libpyside: Move helper isCompiledMethod() to pysideutils.hFriedemann Kleint2022-01-191-0/+7
| | | | | | | | | | | It appears to be a general use helper function which could be useful outside signalmanager as well. Amends 56f66f128566bd08f027fee46bb42a6c4f57a26e. Task-number: PYSIDE-1755 Change-Id: I449243bb5d800ba4d271b3079ad394810d468312 Reviewed-by: Christian Tismer <tismer@stackless.com>
* PySide6: Move the mutex for locking QObject allocation helpers to libpysideFriedemann Kleint2021-12-081-0/+7
| | | | | | | | | | Qml and Quick were using 2 different mutexes, which does not make sense. Task-number: PYSIDE-1709 Change-Id: Id0ec0f780c1d24e40a7f072dea62964ecf92e9d2 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Pyside6: Move the QuickRegisterItem helpers into libpysideqmlFriedemann Kleint2021-12-081-12/+0
| | | | | | | | | libpyside had some variables that were only used by Qt Qml/Quick. Move them into libpysideqml. Task-number: PYSIDE-1709 Change-Id: I8d794c1149bc35f5bd0d8c6aec9b222bb7f73bf5 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* libpyside: Split up the pyside.h headerFriedemann Kleint2021-11-261-0/+5
| | | | | | | | | | | | | | | | Changing something in pyside.h caused excessive recompiling of all wrappers. Try to amend the situation by splitting up the header and include only what is needed. pyside.h remains as a header including the others which will be emptied out by further changes splitting out QML functionality. [ChangeLog][PySide6] The header pyside.h has been split into smaller headers. Task-number: PYSIDE-1709 Change-Id: I89ff3d9d9bc486f194ad3ec62ed372ff0be960f2 Reviewed-by: Christian Tismer <tismer@stackless.com>
* libpyside6: Add a convenience function to convert a PyObject * to a QObject *Friedemann Kleint2021-11-231-8/+34
| | | | | | | Pick-to: 6.2 Task-number: PYSIDE-1709 Change-Id: I137d7fd3ac84f50bb6a799e27e07b7523d943812 Reviewed-by: Christian Tismer <tismer@stackless.com>
* libpyside6: Use isEmpty() instead of empty() for Qt containersFriedemann Kleint2021-11-191-1/+1
| | | | | | Pick-to: 6.2 Change-Id: I0e2f7164bd89ae75eb2aa1cb82adcfa317aea309 Reviewed-by: Christian Tismer <tismer@stackless.com>
* PyPySide: check in the rest of PyPy changesChristian Tismer2021-11-121-0/+5
| | | | | | | | | | | | | | | | | | | The PyPy branch has been apart from the main branch for a long time. Meanwhile, almost everything has settled and can be merged into the main branch. This has the advantage of a single branch for both configurations. This project is still not ready. It will be called ready when the Mandelbrot example can be run without any changes. To achieve that, the current threading problem must be solved. The WIP branch is kept. It now holds only the pypy-blog.txt file. Task-number: PYSIDE-535 Change-Id: I317b0e921cc6810e1b76c69991a0f8e592135c65 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* PySide6: Remove QML includes from pyside.hFriedemann Kleint2021-11-111-2/+0
| | | | | | | | | | | Forward-declare QQmlPrivate::RegisterType. This requires adding some includes in dependent modules. [ChangeLog][PySide6] pyside.h no longer includes QML headers. Pick-to: 6.2 Change-Id: I7d7b703d46e45adbb714d817f05b5480b35d4a4c Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Remove SbkObjectType from the APIFriedemann Kleint2021-09-131-4/+4
| | | | | | | | | | Leave only a deprecated typedef. Complements a4311711eb89e3f9833a05edf3debdf7563a104f. Task-number: PYSIDE-535 Change-Id: Icab9e82e7bff99363c01e471db1c84ee8d6c0b6b Reviewed-by: Christian Tismer <tismer@stackless.com>
* Define SbkObjectType to be a PyTypeObjectFriedemann Kleint2021-09-111-6/+1
| | | | | | | | | | | | | | | SbkObjectType was a struct embedding a PyTypeObject after fec1611e9f42c1f0a13eb33474df2ed8ee480842. Remove that and make the types equvivalent, which allows for removing many reinterpret_casts. SbkObjectType is left as a typedef for client code snippets. [ChangeLog][shiboken6] SbkObjectType is now a typedef for PyTypeObject. Task-number: PYSIDE-535 Change-Id: I44812311ccbbe0988c38e34c47d16f6874f8d1cf Reviewed-by: Christian Tismer <tismer@stackless.com>
* Implement qmlRegisterSingletonInstanceCristián Maureira-Fredes2021-08-171-0/+11
| | | | | | | | | | | | Using a similar approach to the qmlRegisterSingletonType, but wrapping the instance (QObject) into a SingletonFunctor as described in Qt/C++. Add helper function PySide::isQObjectDerived Task-number: PYSIDE-487 Change-Id: Id0fd9da0351a9ba58eae006d7d882f9815f06742 Reviewed-by: Christian Tismer <tismer@stackless.com>
* pathlib: fix empty constructors in conversionCristián Maureira-Fredes2021-07-201-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | In some classes, like QDir, there is a default value for constructors that accept a QString: QDir(const QString &path = QString()) However this case was not considered in Python land when nothing is passed. Considering other classes might have a similar situation, we fix this at the level of the conversion and not per Qt class. To reproduce this issue, a simple: from PySide6.QtCore import QDir a = QDir() will segfault. Added a simple test case, and instructions to make the parameter optional (pyi). Task-number: PYSIDE-1499 Change-Id: I42156b87ca0aa60466c743a8cc8b42ea5eeb3559 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Fix assert when retrieving wrapper from different threadFriedemann Kleint2021-07-081-2/+5
| | | | | | | | | | | | | | Check if the thread matches before calling QObject::setProperty(), fixing: ASSERT failure in QCoreApplication::sendEvent: "Cannot send events to objects owned by a different thread. Current thread 0x0x1e2bd40. Receiver '' (of type 'QDBusConnectionInterface') was created in thread 0x0x7f54b3ce16e0", file qtbase/src/corelib/kernel/qcoreapplication.cpp, line 554 Task-number: PYSIDE-1570 Change-Id: Ib10984a03606bf2cf4dddb0dbd9dfaed3e4d09fe Reviewed-by: Christian Tismer <tismer@stackless.com>
* PySide6: Fix crashes in QObject.findChild()Friedemann Kleint2021-06-291-1/+15
| | | | | | | | | | | | | | | | | | | For all objects encountered in findChild(), a wrapper was created just to be able to retrieve its type object and check against it. As there is a name lookup involved, it happens that non-QObject wrappers are created for this (in the specific case, an enum wrapper), which leads to crashes later on. Refactor the code, extracting a helper function to PySide which finds the best-matching type object for a QObject to check on that. Rearrange the check so that the name is checked first. Pick-to: 6.1 5.15 Fixes: PYSIDE-1609 Change-Id: I026854201f3f6eca9e5905105127f0a4b4588fa9 Reviewed-by: Christian Tismer <tismer@stackless.com>
* build support for pathlib.Path, baselineChristian Tismer2021-06-121-1/+16
| | | | | | | | | | | | | [ChangeLog][PySide6] pathlib.Path gets additionally accepted for all function arguments which have a std::filesystem::path type. This is a first part that implements those modifications which have a std::filesystem::path entry. In a later patch, all the possible other Path insertions will be made. Task-number: PYSIDE-1499 Change-Id: I2dec04dbdb2aaff6ca56c39b28f60281262fe078 Reviewed-by: Christian Tismer <tismer@stackless.com>
* PyClassProperty: Correct the decorator and publish the classChristian Tismer2021-06-101-0/+2
| | | | | | | | | | | | | | PyClassProperty is now correctly published as a QtCore class and existing as an import. As a side effect, a bug was fixed where a syntax error occurred because of a missing signature count. Task-number: PYSIDE-1019 Fixes: PYSIDE-1593 Change-Id: Iae733280d9f9c23244e83a356011104bf527c329 Pick-to: 6.1 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* libpyside: Add helpers for numpyFriedemann Kleint2021-04-211-0/+2
| | | | | | | | | | | | Add utility functions for converting numpy vectors containing x,y data to list of QPoint, QPointF, respectively along with helpers for type checking and initialization. Task-number: PYSIDE-1540 Task-number: PYSIDE-1503 Change-Id: Idde5084434a36ec31eb87bf65dec3d637cff728b Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* libpyside: Fix some clang analzyer warningsFriedemann Kleint2021-03-111-5/+5
| | | | | | | | | | | | - Use nullptr - Initialize variables - Remove else after return - Remove C-style casts - Avoid constructing QString from const char * - Use emit for signals Change-Id: I6ba8cad51f4b2a22f94996d1a9d8c3ae87c35099 Reviewed-by: Christian Tismer <tismer@stackless.com>
* allow to use shiboken.delete() to delete Q*ApplicationChristian Tismer2021-01-111-0/+3
| | | | | | | | | | | | | | | | | | | | This function should initially not allow deleting Q*Application with a shiboken.delete() function, but unfortunately some competitor can do that, so we will as well. Deletion of qApp needs knowledge about qApp. We add a hook function that calls the pyside function `destroyQCoreApplication`. A special problem was testing interactively. See the error description for the days long journey :) Change-Id: I34862425c2cb2cc80d6cafc22d25a867f96f3e0a Fixes: PYSIDE-1470 Pick-to: 6.0 Pick-to: 5.15 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* feature: Disable selection while creating a typeChristian Tismer2021-01-061-0/+5
| | | | | | | | | | | | | | | | | | | PySide 6 suddenly has problems with feature switching during subtype initialization. We introduce an enable function that can temporarily suppress switching. This problem is solved so far. It is the question whether this will break again in another constellation. It might be considerable for the future to have something like Python's PyType_Ready function. Right now this is too much effort. Change-Id: If0ed786d4761cf2356f01f7478e4a0d750e88d3c Fixes: PYSIDE-1463 Pick-to: 6.0 Pick-to: 5.15 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* basewrapper: clear all traces of special Q*Application treatmentChristian Tismer2021-01-041-1/+0
| | | | | | | | | | | | | | | | | | After simplifying qApp so much, it is no longer necessary to treat Q*Application special. We now can allow garbage collection for all objects which simplifies the code quite much. Then it was easy to shrink the implementation to a single function `MakeQAppWrapper`, which made the whole "qapp_macro" files no longer necessary. This cosmetic change will probably not be back-ported to 5.15 . Task-number: PYSIDE-1447 Change-Id: I8ae3c5575e62bd7b5d6bac65c25775c712bb178f Pick-to: 6.0 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* cppgenerator: rework keyword handling regarding unknown keywordsChristian Tismer2020-11-231-23/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | PySide has a distinction between functions with simple arguments and functions with keyword arguments for optional keywords. When a function has keywords specified in one or more signature branch, it gets the METH_KEYWORDS flag. In this case, it is checked that no argument is given positional and per keyword at the same time. Completely forgotten was to check which keywords are allowed in that branch, if at all. The problem was much complicated because constructors can contain extra signals and properties. At the same time, all further error messages are generated with Python. This adds necessary flexibility when features are active. All PyBuildValue objects were refcount leaking. That has been replaced by static createStaticString expressions. The `argNames` structure is no longer needed by the improved algorithm. Change-Id: Ic297912c47231720f61c7d4b79b46a1e376a9941 Fixes: PYSIDE-1305 Task-number: PYSIDE-1019 Pick-to: 5.15 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Rename PySide2 to PySide6Friedemann Kleint2020-11-021-0/+616
Adapt CMake files, build scripts, tests and examples. Task-number: PYSIDE-904 Change-Id: I845f7b006e9ad274fed5444ec4c1f9dbe176ff88 Reviewed-by: Christian Tismer <tismer@stackless.com>