aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2
Commit message (Collapse)AuthorAgeFilesLines
...
* | Merge remote-tracking branch 'origin/5.15' into devFriedemann Kleint2020-10-066-22/+44
|\| | | | | | | Change-Id: I7b4ff138799ee81940c36e68a105cb42bb38a3ff
| * Move the annotations for parsing Qt-based headers to shiboken2Friedemann Kleint2020-10-024-5/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is one of the lesser known things that any project generating bindings for Qt-based code needs to include pyside2_global.h in order for signals, slots and properties to be recognized, since the annotation macro definitions are in this file. Move the definitions over to shiboken2 to remove the need to include it. [ChangeLog][shiboken2] Projects generating bindings for Qt-based code no longer need to include pyside2_global.h. Change-Id: I531bb7444561ccfc352f3be09ecdf854f9f7dd3d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
| * Consolidate export/import macrosFriedemann Kleint2020-10-012-17/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For the 3 libraries that need to export symbols, (libshiboken, libpyside, pysidetest), fix up the export/import macros to follow the Qt convention: - Define generic export/import macros LIBSHIBOKEN_EX/IMPORT equivalent to Q_DECL_EX/IMPORT. Remove definitions for the ancient g++ 4.X. - Reuse those in libpyside, pysidetest as PYSIDE_EX/IMPORT and PYSIDETEST_EX/IMPORT. - While building, define some BUILD_ macro indicating export. - Define the _API macros depending on the BUILD_ macro to be export or import, respectively as is done in Qt. Remove the ugly hack in pysidetest that tried to re-use the PYSIDE_API macro. - Brush up the headers a bit. Change-Id: I635891b7eec5a52a1dcf45022f7bfb6a9cfee83f Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Merge remote-tracking branch 'origin/5.15' into devFriedemann Kleint2020-10-0111-62/+137
|\| | | | | | | Change-Id: Idaf124ad5e1d6a41d52918cecba47499be5e7324
| * Fix up the generated flag operator methodsFriedemann Kleint2020-09-301-11/+11
| | | | | | | | | | | | | | | | Remove space and use reinterpret_cast. Task-number: PYSIDE-1326 Change-Id: I1adfc545c97278eb7da01aec550cb6e2e15945ba Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
| * shiboken2: Generate functions from invisible namespaces into their parent ↵Friedemann Kleint2020-09-305-1/+18
| | | | | | | | | | | | | | | | | | | | | | namespaces Add them in ShibokenGenerator::getFunctionGroupsImpl() with some helpers. Fixes: PYSIDE-1075 Change-Id: Ie627c6e12f82e40cdb4f306ddac6b682e77124c5 Reviewed-by: Christian Tismer <tismer@stackless.com>
| * shiboken2: Generate functions from invisible top level namespaces as global ↵Friedemann Kleint2020-09-307-6/+34
| | | | | | | | | | | | | | | | | | | | | | functions Mainly add those in ShibokenGenerator::getGlobalFunctionGroups() with some adaptions. Task-number: PYSIDE-1075 Change-Id: I6dabac72c204904e76162542b5aa3ea1ac3b56ec Reviewed-by: Christian Tismer <tismer@stackless.com>
| * shiboken2: Refactor handling of invisible top level namespacesFriedemann Kleint2020-09-307-31/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To avoid having to add a ShibokenGenerator::lookForFunctionsInClassesNotToBeGenerated() to fix the function issue, replace ShibokenGenerator::lookForEnumsInClassesNotToBeGenerated() by several helper functions: - Add a list of top level invisible namespace to the generators - Add functions to retrieve enumerations of nested invisible namespaces to AbstractMetaClass with recursion helpers. Task-number: PYSIDE-1075 Change-Id: I421113770e622611caeb221498b872d0a6ba1aeb Reviewed-by: Christian Tismer <tismer@stackless.com>
| * shiboken2: Refactor global enum handling in HeaderGeneratorFriedemann Kleint2020-09-301-16/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Generate the sbk-index values for enums in writeTypeIndexValueLines(AbstractMetaClass *) for invisible namespaces as well instead of adding them to the global enum list. Remove checks for private/protected on global enums as they originate from namespaces. This removes one usage of ShibokenGenerator::lookForFunctionsInClassesNotToBeGenerated() which will be removed in a consecutive change. Task-number: PYSIDE-1075 Change-Id: I9ee7aba20802e9794f371006f9fdbd7ab8d67cab Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Add QStringView/QByteArrayViewFriedemann Kleint2020-09-3016-20/+124
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | View types as function parameters cannot be converted in the standard way shiboken does it: QStringView cppArg0; pythonToCpp(pyArg, &cppArg0); since they reference some other data. Introduce a new "viewOn" member to type system entry for them. It causes the function arguments to be replaced by their viewed-on types (stringview->string) via metatype. Add a test in libsample and a test for QUuid::fromString(QStringView). Test returning QStringView via QRegularExpressionMatch::capturedView(). Task-number: QTBUG-84319 Task-number: PYSIDE-1339 Task-number: PYSIDE-904 Task-number: PYSIDE-487 Change-Id: Iddb4ea268a54928d290e29012e2738772fae83f0 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devFriedemann Kleint2020-09-3024-189/+227
|\| | | | | | | Change-Id: I13721e13d2fab13945385fe529afe4ab431e0532
| * Add command to build rst documentation onlyCristian Maureira-Fredes2020-09-291-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since the process to get the documentation built is to build the whole project, that is too time consuming. Additionally, using qdoc on the Qt API takes a lot of time. This patch introduces the setup.py option called 'build_rst_docs' which skip the general build, and only generates HTML documentation based on all the .rst files we have for shiboken and pyside. To use it: python setup.py build_rst_docs The build will throw warnings related missing directories, and files, which are generated on the 'qdoc' process, but since they are skipped they are not present. Some missing references warnings are skipped due to also come from the qdoc-based step. Task-number: PYSIDE-1106 Fixes: PYSIDE-1390 Change-Id: I4118fd3b64e217717df6cae093138f6951d37094 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
| * shiboken2: Correctly generate final classes with protected methods without ↵Friedemann Kleint2020-09-292-5/+12
| | | | | | | | | | | | | | | | | | | | | | | | protected hack Add a missing check for final class. Amends 170756fa1e5de0ce7ba33521f1eb168d70ad276d. Fixes: PYSIDE-1388 Change-Id: I6b7cd5c9a769838287ac7165bdc2d5ad63b289a1 Reviewed-by: Renato Araujo Oliveira Filho <renato.araujo@kdab.com> Reviewed-by: Christian Tismer <tismer@stackless.com>
| * shiboken2: Consolidate tests for invisible namespacesFriedemann Kleint2020-09-298-45/+37
| | | | | | | | | | | | | | | | | | | | | | | | Move the tests for PYSIDE-1074 from samplenamespace.h to removednamespaces.h. The latter has also a test case for an invisible namespace under a visible namespace besides the invisible top level namespace test. Task-number: PYSIDE-1074 Task-number: PYSIDE-1075 Change-Id: I5d1c6428f6ceadf929063c2c69723a7871173f4e Reviewed-by: Christian Tismer <tismer@stackless.com>
| * shiboken2: Add convenience for indenterFriedemann Kleint2020-09-293-117/+85
| | | | | | | | | | | | | | | | | | Add functions that indent/outdent for usage in a stream statement. Streamline the code accordingly, removing unneeded braces in one case. Change-Id: Iac4a16919eebdb667bbc302b0f937cc03a01c724 Reviewed-by: Christian Tismer <tismer@stackless.com>
| * shiboken2: Change AbstractMetaClass::enums() to return const refFriedemann Kleint2020-09-297-18/+8
| | | | | | | | | | | | | | | | This allows for removing a few temporary variables and/or qAsConst(). Task-number: PYSIDE-1075 Change-Id: Ib48070950ac682ec66e19af3dc8c0be5bfdffcee Reviewed-by: Christian Tismer <tismer@stackless.com>
| * Feature-select: Implement signature-awareness of snake_caseChristian Tismer2020-09-296-4/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After implementing selectable features, support from the signature module was quite much missing. It was not clear for some time what to do the best. It turned out to have the smallest impact and runtime penalty to use the Python parser output dictionaries and create copies with snake case naming. That has almost no overhead. Also, it was necessary to augment the internal map_dict with snake_case versions. It may be possible to simplify that map_dict further in another check-in. Remaining is the problem of static properties. This will be tried using the PySide Property objects which can be improved. Change-Id: Ied83ccb197a3c15932c4202b5f1ade772416e17b Task-number: PYSIDE-1019 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devFriedemann Kleint2020-09-2936-1503/+1880
|\| | | | | | | Change-Id: Ie6da3938b82f5ebe96dd12bd65a3ccc4180d2fba
| * doc: fix more sphinx warningsCristian Maureira-Fredes2020-09-293-4/+4
| | | | | | | | | | Change-Id: I07a87ad49546534f3492b534b2a2dd4945304de7 Reviewed-by: Christian Tismer <tismer@stackless.com>
| * shiboken2: Fix the tests for enums in removed namespacesFriedemann Kleint2020-09-282-24/+18
| | | | | | | | | | | | | | | | | | Change the formatting for better readability and use the "visible" attribute instead of the deprecated "generate". Task-number: PYSIDE-1075 Change-Id: Ibbb33d2482c1d682f74d2edce2dd7d3bb1a50821 Reviewed-by: Christian Tismer <tismer@stackless.com>
| * shiboken2: MetaBuilder/ApiExtractor/Generator: Return class/enum/function ↵Friedemann Kleint2020-09-289-38/+31
| | | | | | | | | | | | | | | | | | | | lists by const ref This allows for removing a few temporary variables and/or qAsConst(). Task-number: PYSIDE-1075 Change-Id: I0fe3544f0ce4d3a8d56de9c93e300972e0844177 Reviewed-by: Christian Tismer <tismer@stackless.com>
| * shiboken2: Generate properties as fieldsFriedemann Kleint2020-09-2814-42/+258
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Add an XML attribute specifying whether code is to be generated to the XML properties. - Split the generator functions for field setters and getters apart so that they can be used for generating property setters and getters. - Generate code for all properties from XML when the PySide extension is not used, otherwise only for those with the attribute set. Task-number: PYSIDE-1019 Change-Id: Iab2ba38b90038edc667a233c23c7113fdc6fb438 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
| * Signature: Break the source into multiple filesChristian Tismer2020-09-259-1266/+1549
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The signature module has grown groups of rather unrelated topics. In order to reduce the complexity, we break up the source into a number of files. Reason for this change was building support for selectable features, which should not get lost in all the unrelated helper functions. Task-number: PYSIDE-510 Task-number: PYSIDE-1019 Change-Id: I8e22a91db1882f8c5428b8def13bf9f1cea431fb Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
| * shiboken2: Fix formatting of field getter codeFriedemann Kleint2020-09-241-3/+8
| | | | | | | | | | | | | | | | Properly indent and join the else if statement. Task-number: PYSIDE-1019 Change-Id: I8d5dc6c84e19b97b55f1ba29094da1e31dc7ca1c Reviewed-by: Christian Tismer <tismer@stackless.com>
| * shiboken2: Remove unused code from AbstractMetaFieldFriedemann Kleint2020-09-242-103/+0
| | | | | | | | | | | | | | | | | | | | Remove the getter/setter functions and related code. Apparently this was some early, unfinished attempt at properties. Task-number: PYSIDE-1019 Change-Id: Iff196da7b7bfb7b30b724405405decf36201b259 Reviewed-by: Christian Tismer <tismer@stackless.com>
| * Signature: Revert SbkSpecial_Type_Ready to PyType_ReadyChristian Tismer2020-09-245-24/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The early signature module tried to minimize the visible changes to the code base. It replaced the `PyType_Ready` call by a special version which did other things as well. We replace that special call by a more intuitive function `InitSignatureStrings` that does exactly that and nothing more. The functionality of the module is unchanged. Change-Id: Ic2f9cd29b0352f0a24daa55b01420c77d103c0b2 Task-number: PYSIDE-510 Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Merge remote-tracking branch 'origin/5.15' into devFriedemann Kleint2020-09-2418-383/+609
|\| | | | | | | Change-Id: I7e4c7f9378706438715362b1e2da9a3cd2794562
| * shiboken2: Add a way of specifying properties in typesystem XMLFriedemann Kleint2020-09-239-2/+115
| | | | | | | | | | | | | | | | | | | | Add a list of TypeSystemProperty to ComplexTypeEntry, parse it from XML and add those properties in AbstractMetaBuilderPrivate::parseQ_Properties(). Task-number: PYSIDE-1019 Change-Id: Idf6ecde7c9de6bf1e56be423921672152e97de70 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
| * shiboken2: Fix excessively long lines in generated codeFriedemann Kleint2020-09-231-4/+5
| | | | | | | | | | | | | | | | | | Introduce line breaks. As a drive by, remove unneeded self-assignment. Task-number: PYSIDE-1388 Change-Id: Ia9c7cd66814621f02625e3140724483d6b71f1c7 Reviewed-by: Christian Tismer <tismer@stackless.com>
| * Signature: Use Shiboken namespaceChristian Tismer2020-09-231-180/+128
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | And we change the function style to no longer use the Python formatting like typespec funcname(args) but typespec funcname(args) Change-Id: I3dc28f7af5a54eade6711e7d5465a972ff9796f5 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
| * shiboken2: Refactor property parsingFriedemann Kleint2020-09-237-64/+182
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Store AbstractMetaType instead of TypeEntry in QPropertySpec for more complete type information and better parsing. Introduce a struct TypeSystemProperty to the typesystem which can be later populated from a newly introduced typesystem XML element. Rewrite the parser to first populate a TypeSystemProperty and convert it to QPropertySpec with type lookup in a second step. Change the parser algorithm to first look for any of the READ/WRITE tokens and split the tokens leading up to them into type name and property name in order to parse complex types like Q_PROPERTY(QList<QSpriteSheetItem *> sprites READ sprites.. correctly. Task-number: PYSIDE-1019 Change-Id: I942bc659cc236d31041cdc22e26a82d270599033 Reviewed-by: Christian Tismer <tismer@stackless.com>
| * shiboken2: Move class PropertySpec into its own source fileFriedemann Kleint2020-09-2211-197/+244
| | | | | | | | | | | | | | | | Move the class and the parser function into its own source file. Task-number: PYSIDE-1019 Change-Id: If403f799f6b8da769fd8b47dd958a7430d061ad8 Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Merge remote-tracking branch 'origin/5.15' into devFriedemann Kleint2020-09-2224-34/+246
|\| | | | | | | Change-Id: Id0fc76666bbdb254a833eeb6909a0874b2611bf3
| * Shiboken2: Take member fields into account when sorting classesFriedemann Kleint2020-09-211-6/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | The type converters for class-type member fields need to be initialized before the respective classes; thus a dependency needs to be added Generator::classesTopologicalSorted(). Factor out common code and loop over the member fields, adding the dependencies to the graph. Task-number: PYSIDE-1224 Change-Id: Iec306aa7559453d41f7f62fefd5825db66aa4815 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
| * shiboken2: Add namespace variablesFriedemann Kleint2020-09-214-1/+15
| | | | | | | | | | | | | | | | | | | | They were ignored in the code parser. Take them into account and add a test. Task-number: PYSIDE-1224 Change-Id: I3baca95556129d695db294fdcc1ad92fc831672d Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
| * shiboken2/Documentation: Clarify targets of modificationsFriedemann Kleint2020-09-216-25/+62
| | | | | | | | | | | | | | | | | | | | | | | | Move the paragraphs explaining Python / C++ wrapper classes to a separate new page and make it visible in the TOC. Add references from where the 'class' attribute is used. Task-number: PYSIDE-841 Change-Id: If55533e4e3c9acddc08f311802747ccdedfcbf02 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
| * shiboken2: Allow specifying the sequence of overloadsFriedemann Kleint2020-09-2113-1/+142
| | | | | | | | | | | | | | | | | | | | | | Add an attribute to specify a number by which the functions will be sorted. This deactivates the default sorting which tries to avoid implicit conversions. Fixes: PYSIDE-1366 Change-Id: I9a891e21f86152b2fdfda9a48d685f19aa936508 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
| * Signature parser: Report error when eval failsFriedemann Kleint2020-09-211-1/+6
| | | | | | | | | | | | | | Task-number: PYSIDE-1212 Task-number: PYSIDE-1367 Change-Id: I3b1bbab3e14888d9520868d1f20860f30cbef0a9 Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Merge remote-tracking branch 'origin/5.15' into devFriedemann Kleint2020-09-214-13/+18
|\| | | | | | | Change-Id: Ia31df23a16575f9ecefe13ec85fb70197d103278
| * shiboken2: Remove workaround code for comparing QStringViewFriedemann Kleint2020-09-181-11/+0
| | | | | | | | | | | | | | | | The underlying issue has been fixed. Task-number: QTBUG-69389 Change-Id: I67416a9db7488db5f851ecb2f07884fbb410e4f0 Reviewed-by: Christian Tismer <tismer@stackless.com>
| * shiboken2: Add attribute for generating "using namespace"Friedemann Kleint2020-09-184-2/+18
| | | | | | | | | | | | | | | | | | | | | | | | Make it possible to turn off the generation of using namespace. This is required in Qt 6 to avoid a clash between Qt3DCore::QBuffer and QBuffer used in __repr__. Task-number: PYSIDE-1339 Task-number: PYSIDE-904 Change-Id: Iaaf3e67f0ffaae86e2de82b9a1b8fe7d00c74e6b Reviewed-by: Christian Tismer <tismer@stackless.com>
* | signature: Add size_t as int typeFriedemann Kleint2020-09-181-0/+1
| | | | | | | | | | | | | | Task-number: PYSIDE-1339 Task-number: PYSIDE-904 Change-Id: I4cf3e74cd53b06884f7fdfc7d0f023c9bbb62cce Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Merge remote-tracking branch 'origin/5.15' into devFriedemann Kleint2020-09-1717-40/+153
|\| | | | | | | Change-Id: I8aa48d07067c45c888c73af87314f6a88c2a6e14
| * shiboken2: Work around signature problems with smart pointer instantiationsFriedemann Kleint2020-09-162-1/+3
| | | | | | | | | | | | | | | | | | | | - Drop the module of the instantiations. - Add a dummy mapping entry, declaring it to be a 1-tuple. Task-number: PYSIDE-1212 Task-number: PYSIDE-1367 Change-Id: Iddb1feaafbe416ae57d761a33276cb4a1d88e9e3 Reviewed-by: Christian Tismer <tismer@stackless.com>
| * Remove dependency of the QtQml module header on pysideqmlregistertype.hFriedemann Kleint2020-09-162-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | Make it possible to inject code into module headers by specifying "declaration" on type system code snippets. Use that to insert the struct definition into pyside2_qtqml_python.h and remove the include. Add the required includes via code injection into the wrapper and extra includes for the types. Fixes: PYSIDE-1381 Change-Id: I8dfda4c33d66f56e8fb516e1b174cc43664ca318 Reviewed-by: Christian Tismer <tismer@stackless.com>
| * feature_select: Implement True PropertiesChristian Tismer2020-09-1611-36/+135
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This feature is now almost fully implemented. TODO: Static properties like `QtWidgets.QApplication.platformName` are skipped for now. They need support by the meta class. Maybe this is a reason to use QtCore.Property instead of vanilla Python property and improve it. With the new infrastructure, we can also consider to add properties which have no equivalent in the Qt implementation. A prominent example is "central_widget". Change-Id: Ia0e32e41de8ab72e3bba74878e61bcbac6da50ea Task-number: PYSIDE-1019 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
| * signature: Always create a return typeChristian Tismer2020-09-162-3/+4
| | | | | | | | | | | | | | Change-Id: I6da99684efb6b3be7f3e347f71862ebfd502ecd9 Fixes: PYSIDE-1383 Reviewed-by: Kyle Altendorf <sda@fstab.net> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devFriedemann Kleint2020-09-169-83/+123
|\| | | | | | | Change-Id: I114a003e36bbe9eb7452f13c1515e3419648e228
| * Do some cleanup to pysideproperty.cpp and feature selectChristian Tismer2020-09-143-8/+6
| | | | | | | | | | Change-Id: Id7e1a4f9f938f9b86e1e905936b78c1531f5a566 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
| * shiboken2: Refactor primitive type lists in overload decisorFriedemann Kleint2020-09-116-75/+117
| | | | | | | | | | | | | | | | | | | | Add a separate header with the type names and use that. Add the missing long long on this occasion. Task-number: PYSIDE-1372 Change-Id: Id3c35c6b2c4e7eebfe1d25b555ab62468cb89f1d Reviewed-by: Christian Tismer <tismer@stackless.com>