aboutsummaryrefslogtreecommitdiffstats
path: root/sources
Commit message (Collapse)AuthorAgeFilesLines
* shiboken6: Remove deprecated typesystem tagsFriedemann Kleint2020-12-028-177/+62
| | | | | | | | | | | <remove> and <access> were deprecated in favor of attributes on the functions in PySide2. Similarly for <rename>, but it is still used as a child of <modify-argument>. Leave this usage in place, but add parsing of the rename attribute to <modify-argument>. Change-Id: I8e80ba13a3e4af1df0448bd0de034d242a9fdeb4 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Fix field modificationsFriedemann Kleint2020-12-0211-44/+124
| | | | | | | | | | | | | | | The logic was only partially present, neither removal of getter/setter nor renaming had any effect. Rewrite the code to resemble that of AbstractMetaFunction (adding function applyFieldModifications()) Move some check functions from the generators to AbstractMetaField/Type. Add tests in libsample. Change-Id: Ib29d4e37db51f122b46702cb5d96b13da6d0f224 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Use initializer lists for the converter replacement regexpsFriedemann Kleint2020-12-012-17/+28
| | | | | | | Complements 28aa3c4f6605a6331b12f47e03a9aba4aaefe201. Change-Id: I2814ce4832a6cf7623abb9e6e290773377795565 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Remove unused variable from ↵Friedemann Kleint2020-12-011-3/+0
| | | | | | | CppGenerator::writeMethodWrapperPreamble() Change-Id: I954d1ec8a460fd62979ed605288995a65de2e7f9 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Fix some functions to take a const AbstractMetaClass *Friedemann Kleint2020-12-014-23/+23
| | | | | Change-Id: Iccee5cab96362250997daf39a354ddc7e8ab2909 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Use initializer list for operator mapping in doc generatorFriedemann Kleint2020-12-011-34/+36
| | | | | | | Complements 28aa3c4f6605a6331b12f47e03a9aba4aaefe201. Change-Id: I8194dccd94dc4a6fbac11a874fd18b60f7aa1533 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Store AbstractMetaFunction using a QSharedPointerFriedemann Kleint2020-11-3051-760/+724
| | | | | | | | | | | | | | | | | | Store the list functions (global / class member) as a QList<QSharedPointer<const AbstractMetaFunction> instead of a raw pointer list. This makes passing around function lists easier and solves the memory leaks caused by mixing cloned and unmodified functions while collecting the overload lists in the generators. - Change the function signatures accordingly - Add a qSharedPointerConstCast() for non-const access. - Restructure the traversing of added functions in the AbstractMetaBuilder - Remove some unused typedefs and functions unearthed by the change Change-Id: I08a6c5243750e3eb3813bc3f7172899ad2b13e22 Reviewed-by: Christian Tismer <tismer@stackless.com>
* signature: avoid duplication of `__init__`Christian Tismer2020-11-301-1/+2
| | | | | | | | | | | | | | After the reworking of error messages, the `__init__` function became visible both via the "class" and as "class.__init__". The constructor is treated specially because we want to list it first. Avoid duplicate generation of the constructor by filtering in "enum_sig.py". Change-Id: I04c0a47990d6ca8d97a748f7ecfe911f9aec2fe6 Task-number: PYSIDE-1305 Pick-to: 5.15 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Replace handler map in QtXmlToSphinx by an enumerationFriedemann Kleint2020-11-302-85/+242
| | | | | | | | | | | Constructing the strings and populating a hash with function pointers for each invocation on a snippet is wasteful. Introduce an enum, populate a constant static hash with it and dispatch the call via switch. Change-Id: Ia8e0123fc31802c35b33308edb0fa9edc6add775 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* cppgenerator: rework keyword handling regarding unknown.. augmentedChristian Tismer2020-11-301-4/+1
| | | | | | | | | | | | | The new keyword algorithm did fail on Windows. There was a wrong calculation of the number of arguments left over from the old algorithm. This was only visible on windows, because it generates slightly different signatures for QtGui.QColor. Change-Id: I5aee3e7c722c8365f86bf6196ab1fd3cf5bb46ad Fixes: PYSIDE-1305 Pick-to: 5.15 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* shiboken6: Clean up member variables of the generatorsFriedemann Kleint2020-11-305-344/+366
| | | | | | | | | | | | | | | | | | | | | | There used to be a lot hash/list member variables in the generators, some of them static. Refactor this to: - Use initializer lists. - Introduce static functions returning a const ref to const hashes and lists and put them closer to where they are needed. - Move m_tpfuncs to cppgenerator. - Introduce a special struct for protocol function entries for clarity. As a drive by. streamline and fix CppGenerator::writeTypeAsMappingDefinition(), CppGenerator::writeTypeAsNumberDefinition() to generate nullptr and reinterpret_cast and not populate hashes with empty strings. Change-Id: Id1d067dec7769568f56b77ccafca843e01f99b0b Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Fix linker error about void TextStream::putCharHelper(char)Friedemann Kleint2020-11-272-2/+12
| | | | | | | | Move the TextStream::putChar() functions into the source file so that it sees the putCharHelper() template. Change-Id: If5ed7bfc2e1b36f1767e09f8306ddc0a9c7f834f Reviewed-by: Christian Tismer <tismer@stackless.com>
* PySide6: Remove namespace QtQmlFriedemann Kleint2020-11-273-5/+1
| | | | | | | | It was removed in qtdeclarative/5a59cbfee71907c47587a1e3d340d31abfdc01ba. Change-Id: I94c49dced3decb9089c1f8745468d080e0d0311d Reviewed-by: Christian Tismer <tismer@stackless.com>
* PySide6: Fix test javascript_exceptions.pyFriedemann Kleint2020-11-271-1/+1
| | | | | | | It was using the old Qt Quick Controls 1. Change-Id: Ia1d6a884267fdcd8e3808b08bf1efa12eb62b4dd Reviewed-by: Christian Tismer <tismer@stackless.com>
* PySide6/QtQml: Fix compilation with new QMetaTypeInterfaceFriedemann Kleint2020-11-271-3/+9
| | | | | | | | | After qtbase/b4c17476129e07dd3bf52c6aac8a51cf30c2dd3a, a function returning the QMetaObject * is required. Task-number: QTBUG-88468 Change-Id: I2d957ff97a2bfa04578873ce098b1e623edf759a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* property: fix an eight year olde bug that showed after the overhaulChristian Tismer2020-11-261-3/+4
| | | | | | | | | | | | | | | | | | | | | | The modernisation of pysideproperty.cpp creates an error when using @Property(str, constant=True) This could also be provoked before the improved version of Property by def getVal(self): return self.val variable = Property(str, getVal, constant=True, fset=None) because the None/NULL - handling was incomplete. Change-Id: Ib39dd3bdb62ba928164faa465ee3dd743262e245 Fixes: PYSIDE-1426 Pick-to: 5.15 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* pysideproperty.cpp: Fix compilation with MSVC2019/C++ 17 modeFriedemann Kleint2020-11-261-7/+6
| | | | | | | | | It does not accept a ternary operator with QByteArray/const char * arguments. Pick-to: 5.15 Change-Id: I02bcb740100c4568ecb262fa6ecf3d466e02c875 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Fix generation of protected enums without protected hackFriedemann Kleint2020-11-261-0/+2
| | | | | | | | The cast was no longer generated due to a bug in Amends3ec934419b1217e2a623e2f91336a8a5628ec5fe. Change-Id: I27bb554ae24bedf2625654409d8b9b365b47c3c1 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Remove macro SbkDbgFriedemann Kleint2020-11-267-137/+6
| | | | | | | | | | | | | SbkDbg was a macro modeled after QDebug which produced some colored output on a terminal. It was (wrongly) used only in one place which caused a MSVC warning about missing macro parameters. Replace it by PyErr_WarnEx(). Change-Id: Ie0a134c864d8f434c7acefb22dac715012f36238 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Build with MSVC 19.28.29334Friedemann Kleint2020-11-261-15/+28
| | | | | | | | | Use clang builtin-includes. Pick-to: 5.15 Fixes: PYSIDE-1433 Change-Id: I91c87f8ff764d126acf4bb6aa564c515e61ab0a4 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* shiboken6: Port QtDocGenerator to the new text streamFriedemann Kleint2020-11-266-294/+156
| | | | | | | Finally remove the old indentor. Change-Id: I25150f61f914c1a6adc13341057a94c8bd281296 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6/TextStream: Fix output of empty aligned fieldsFriedemann Kleint2020-11-263-1/+16
| | | | | Change-Id: I1cc8c2b174dd7428def2a2b4ac7f84f5b6aa1df3 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Fix sphinx warning in QtCore.Property.rstFriedemann Kleint2020-11-261-0/+1
| | | | | | | | | Fix doc/rst/PySide6/QtCore/Property.rst:3: WARNING: Explicit markup ends without a blank line; unexpected unindent. Pick-to: 5.15 Change-Id: I20311655899df17313aa657c0b93c9d488f3b5c8 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Replace QVector by QListFriedemann Kleint2020-11-2545-175/+174
| | | | | | | | | | | | | | | | Change AbstractMetaClass::templateArguments() to return TypeEntries (const TypeEntry *) instead non-const. Remove redundant typedef OverloadData::MetaFunctionList. Use existing typedefs in some places. Add new typedefs for MetaObjectBuilder::EnumValues and AbstractMetaFunctionCList. Change-Id: Ia241b5fbe54d60ea57175fb1f6c844604e066a3d Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Split out the QtXmlToSphinx formatter from the doc generatorFriedemann Kleint2020-11-256-1558/+1685
| | | | | Change-Id: I9b8ef4c53234d107e394c0a1396c8ed00768d722 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Introduce a new Text streamFriedemann Kleint2020-11-2520-1774/+2121
| | | | | | | | | | | | | | | | | | | Add a new text stream wrapping QTextStream with built-in indent. This removes the need to have INDENT as a separate member variable or function parameter and to output it at the beginning of each line. It also makes it easier to factor out the write() functions since they no longer need the indent. Make the write* functions const where possible. The doc generator is left as-is for the moment. Rename the old Indentation to Indentation4 to avoid conflicts. Change-Id: I6866e7360df119859adeee567d2b18a37cb63a79 Reviewed-by: Christian Tismer <tismer@stackless.com>
* errorhandler.py: use AttributeError instead of TypeErrorChristian Tismer2020-11-252-2/+2
| | | | | | | | | | | | | | There is a small improvement needed in errorhandler.py: It was not consequent to use TypeError for missing attributes in one case, and to use AttributeError on the constructors. The error message may be different, but it always should be AttributeError. Task-number: PYSIDE-1305 Task-number: PYSIDE-1019 Change-Id: I1c278c5256000f0f0fe66ca9da36c2d078002b25 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* shiboken6: Refactor writing out filesFriedemann Kleint2020-11-243-2/+15
| | | | | | | | | Write the buffer directly to the file instead of reopening the text stream on it (which has unclear encoding semantics). Add error handling on this occasion. Change-Id: Ifd478f96a73dbc21e441fed8b8e543f07b6fa00b Reviewed-by: Christian Tismer <tismer@stackless.com>
* cppgenerator: rework keyword handling regarding unknown keywordsChristian Tismer2020-11-2312-89/+181
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* shiboken6: Replace QScopedPointer by std::unique_ptrFriedemann Kleint2020-11-212-21/+20
| | | | | | | | | | | qtbase/612a01be6513894ab1ec5a36b699a2142ba7f35c deprecates QScopedPointer::take(), making it useless for the factory pattern. As a drive-by, fix the include order of abstractmetabuilder.cpp. Change-Id: I378f45d1c693fcd0423b4e2c96949d7e3be5d747 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: De-virtualize some generator functionsFriedemann Kleint2020-11-205-64/+46
| | | | | | | | | | | Move Generator::replaceTemplateVariables() which is used for code snippets, to ShibokenGenerator. This allows for de-virtualizing writeFunctionArguments() and writeArgumentNames() and making the private members of ShibokenGenerator since they are only used by replaceTemplateVariables(). Change-Id: I2d62758a391113adcdbca336eadf7630f1dbb28c Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Remove need to repeat signature when modifying a global functionFriedemann Kleint2020-11-192-2/+8
| | | | | | | | Grab the signature from the top element. Fixes: PYSIDE-1424 Change-Id: Ife5178e1f30ed4ebd4420f31a608bed291966aa0 Reviewed-by: Christian Tismer <tismer@stackless.com>
* libshiboken: Remove unused function parameterFriedemann Kleint2020-11-191-3/+2
| | | | | | | | | fixing MSVC warning: sources\shiboken6\libshiboken\sbkenum.cpp(475): warning C4138: '*/' found outside of comment Pick-to: 5.15 Change-Id: Ib9df1283ca4bcdfbfce1fda789bb5157f3b466e1 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Remove unneeded forward/wrong declarationFriedemann Kleint2020-11-191-1/+0
| | | | | | | | | | FunctionModification is now a class and already forward-declared in abstractmetalang_typedefs.h. Amends 876d961779824a7b244d270116015de2f3378857. Change-Id: Ie7f9895151f155fb4f1ee450e019ad6787a39764 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Refactor ShibokenGenerator::replaceConverterTypeSystemVariable()Friedemann Kleint2020-11-181-3/+3
| | | | | | | | | | The function constructed a QString conversion, a QTextStream writing to it and then modified the string behind the QTextStream's back. Make the QTextStream local to the branch where it is needed and modify the string directly in the other branches. Change-Id: I102c2b1683ab948140fa704b8c87eab1ac265e15 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Fix linking of tests with with MSVC 2019Friedemann Kleint2020-11-181-1/+1
| | | | | | | | A wrong forward declaration of class FunctionModification caused a linker error. Change-Id: Ie6cae55c74789564dea6fb283750e187d5ebfdcf Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* shiboken6: Fix some warning messagesFriedemann Kleint2020-11-189-83/+176
| | | | | | | | | Use standard messages where applicable. Move some messages over to messages.cpp and add a location. Remove some messages that cannot be triggered any more. Change-Id: I7fc821e4360b06af7ef6e5db7e30de0f1e8ed5ca Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Preferably search classes by type entryFriedemann Kleint2020-11-182-19/+11
| | | | | | | | | | If a type entry is available, use that to search rather than by name, which has issues with qualified names. Task-number: PYSIDE-1417 Pick-to: 5.15 Change-Id: I9d9bc1d85481c366d6d7c84879ec2caa9458ac77 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Remove some Usages of QString::arg()Friedemann Kleint2020-11-183-11/+17
| | | | | | | Fix some places where readability is not impaired. Change-Id: I568f28d4b5e393bd48b21431f667ad0adbcb8bd8 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Move further C++ check functions from the generators to MetaLang*Friedemann Kleint2020-11-177-56/+62
| | | | | | | | | Rename isCppPrimitive() to isExtendedCppPrimitive() to disambiguate from the existing TypeEntry::isCppPrimitive() and to indicate that it includes more types, like std::string. Change-Id: I5ac62fb721e648c26fa4a5634595ff08937a7155 Reviewed-by: Christian Tismer <tismer@stackless.com>
* libpyside: Refactor GlobalReceiverV2MapFriedemann Kleint2020-11-173-43/+57
| | | | | | | | | | | | | | | | Use a QHash of object/method PyObject instead of a QByteArray representing the sum of hash values of both as a string. The problem with using hash functions here is that 2 keys might be identical due to the hashing. Rename the hash() methods to key(). Task-number: PYSIDE-1422 Change-Id: Ie1344d8bd85a073ef5f6e2cb461bd2f514265a9f Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Move further C++ check functions from the generators to MetaLang*Friedemann Kleint2020-11-1712-165/+145
| | | | | Change-Id: I14fe14a2c7a5efff01dcd34bc1682cd8e264ab86 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* libpyside: Small nullptr-cleanupFriedemann Kleint2020-11-174-8/+10
| | | | | Change-Id: I9688480a24bafa7808796a6161cf3474f2ca44f8 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* globalreceiverv2: Avoid hash call on instances which might be unhashableChristian Tismer2020-11-171-7/+8
| | | | | | | Change-Id: I423763b363cff61beb5da45374f120e5f2e63ffa Fixes: PYSIDE-1422 Pick-to: 5.15 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* shiboken6: Refactor code snip query functionsFriedemann Kleint2020-11-168-122/+149
| | | | | | | | | | | | Move most code snip query functions to AbstractMetaFunction, using a template function taking a predicate to avoid building a list of all snippets on every invocation. injectedCodeCallsCppFunction() remains in ShibokenGenerator as it depends on the GeneratorContext, but can use the new helpers. Change-Id: I06c5f8a36d977a3006e2c4e43afa9f3988cbe97b Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Qualify the generator functionsFriedemann Kleint2020-11-1610-244/+281
| | | | | | | Mark them as static or const where applicable. Change-Id: Ia8b9fd876c9b871163fd5af251ba8b31f337bd01 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Cache the modifications of AbstractMetaFunctionFriedemann Kleint2020-11-167-56/+94
| | | | | | | | | | | | | | A lot of query functions depend on AbstractMetaFunction::modifications(AbstractMetaClass*) which goes on a search through the classes on each invocation, depending on the class passed in. Cache the result in a flat list of classes (which will typically contain declaring/implementing/owner class or 0 for free functions). Return modifications by const-ref and remove variables. Change-Id: I8512b25d8c39f9dea5fc9141575902f89b4ad597 Reviewed-by: Christian Tismer <tismer@stackless.com>
* PySide6: Add QMetaTypeFriedemann Kleint2020-11-164-10/+41
| | | | | | | | | | This is required for QSqlField among other things. Re-add the conversions that previously existed for the now deprecated QVariant::Type for QMetaType. Change-Id: If47168f0f45ecfbfe483a8eaa9c6e037477f5ce6 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Move the base class search out of the generatorFriedemann Kleint2020-11-147-46/+64
| | | | | | | | | | | | | The code was relying on class search by string and searched the default super class as specified in the typesystem on each invocation. Make the default super class a member of AbstractMetaClass that is set by the meta builder and move the functions to AbstractMetaClass. Change-Id: I15e4f193067d09f00e7dc17aef07c14c0e969884 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Start on a cleanup of the generator codeFriedemann Kleint2020-11-1410-113/+106
| | | | | | | Start moving some C++ check functions from the generators to MetaLang*. Change-Id: I84c4ba9967b489ddf01c5cdf8919a128b76fd29c Reviewed-by: Christian Tismer <tismer@stackless.com>