aboutsummaryrefslogtreecommitdiffstats
path: root/sources
Commit message (Collapse)AuthorAgeFilesLines
* shiboken6: Improve fixing of enum default values of function argumentsFriedemann Kleint2021-10-219-150/+386
| | | | | | | | | | | | | | | | | | | | | | | | | | | shiboken needs to fully qualify default arguments of functions so that they can be used outside the respective's class scope. This happens in AbstractMetaBuilderPrivate::fixDefaultValue() and ShibokenGenerator::guessScopeForDefaultValue(). This was confusing particularly for enums and flags, where AbstractMetaBuilderPrivate::fixDefaultValue() was doing a simple expansion and further cases were handled in ShibokenGenerator::guessScopeForDefaultFlagsValue(). To improve this and get it tested, move the enum/flags code completely over to AbstractMetaBuilder, restructure it, rewrite the helpers in terms of QStringView and make it a bit smarter: - Check for hex numbers as well. - No longer add a cast when constructing QFlags from a number(saves the need to observe the protected hack). - Expand expressions "A | B" as was before and additionally within a type cast "Options(A | B)". - Add a test. Task-number: PYSIDE-1691 Pick-to: 6.2 Change-Id: I198995508e8ed01710a44708c425c31308908445 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Implement opaque containers for getters returning a const referenceFriedemann Kleint2021-10-217-16/+84
| | | | | | | | | | | | | Add a bool m_const member to the container helper template that indicates a const container. Error out of the modification functions if that is set. Create an additional creation function for the const case. A const opaque containers is then of same Python type as the non-const version, requiring no further type checks. Pick-to: 6.2 Task-number: PYSIDE-1605 Change-Id: I45faeb0d68e6144a9dfbe25497694b8acdd98c09 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Implement opaque containers for getters (non-const)Friedemann Kleint2021-10-2110-16/+95
| | | | | | | | | | | | | | | Extract helpers from the opaque containers generation for fields and use them for function returns if the type is modified accordingly. [ChangeLog][shiboken6] Getters returning containers by reference can now be modified to return an opaque container by modifying the return type accordingly. Pick-to: 6.2 Task-number: PYSIDE-1605 Change-Id: Ieaf5eb92d248d3a23e511222e5f61823e85540c0 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Documentation: Fix platform note on getting started pageFriedemann Kleint2021-10-211-4/+3
| | | | | | Pick-to: 6.2 Change-Id: I0027bd16aa0b5dea6bd51fb3b0df1b5cfb605388 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* doc: include missing modulesCristián Maureira-Fredes2021-10-206-72/+98
| | | | | | | | | | | | | | | | | | The following modules were not generated automatically in the documentation: - QtBluetooth - QtDBus - QtNetworkAuth - QtRemoteObjects - QtSerialPort The two column order of the modules.rst page was removed in favor of moving the page to a box-style in the future. Fixes: PYSIDE-1694 Pick-to: 6.2 Change-Id: Ied62d15c0f4574d0e4f5a8202e5f08692f63e001 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* PyPySide: modify another PyType_FromSpec version to be PyPy compatibleChristian Tismer2021-10-205-29/+40
| | | | | | | | | A generated call in the module initialization was found that was not yet converted. Task-number: PYSIDE-535 Change-Id: Icbdaa896e8181201c49cbce3d11acf791922c463 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* PySide6: Add QCborTagFriedemann Kleint2021-10-202-1/+4
| | | | | | | | Fixes: PYSIDE-1691 Pick-to: 6.2 Change-Id: I023b4ffe280b431d883673f5120236ba3f9c0991 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* libshiboken: Fix a crash with enums with no valuesFriedemann Kleint2021-10-201-0/+2
| | | | | | | | | Handle null-return of PyDict_GetItem(). Task-number: PYSIDE-1691 Pick-to: 6.2 Change-Id: Ia317cd15cf3d15c05e22a8b8db262d227c4dcb84 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Handle enum default values that are casts from intFriedemann Kleint2021-10-201-2/+14
| | | | | | | | | | | The helper resolveScopePrefix() would expand Enum(-1) to Enum::Enum(-1), assuming it is an enumeration value. Add a check to prevent that for casts. Task-number: PYSIDE-1691 Pick-to: 6.2 Change-Id: I403653b7655d7cccacb5737faf074cab55f30397 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Improve the MyPy support, first systematic changesChristian Tismer2021-10-193-6/+4
| | | | | | | | | | * hand-crafted class signatures don't have a return type (__init__) * make optional typing imports complete * skip imports which are defined in the same module Task-number: PYSIDE-1675 Change-Id: I30950e16347158804430e04f93254f0177d2a506 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Fix a signature warning about QEvent.Type.NoneFriedemann Kleint2021-10-191-0/+1
| | | | | | | | | | Add QEvent.Type.None, fixing: UNRECOGNIZED: 'QEvent.Type.None' OFFENDING LINE: 'PySide6.QtWidgets.QGraphicsSceneHelpEvent(self,type:PySide6.QtCore.QEvent.Type=QEvent.Type.None) Pick-to: 6.2 Change-Id: Icb40ee6d01a3d744250cf60b728687c38f315f55 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Handle enums without valuesFriedemann Kleint2021-10-183-3/+21
| | | | | | | | | | | | shiboken used to ignore enumerations without values assuming they were just forward declaration of an enum classes. It turns out that there are such cases (QCborTag). To fix this, add empty enums always and replace them by the ones with values. Task-number: PYSIDE-1691 Pick-to: 6.2 Change-Id: I5de69f86ed45bd9f239e6d6017e7dc4a554f5378 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Improve the MyPy support, basic stepChristian Tismer2021-10-182-0/+5
| | | | | | | | | The MyPy compatibility needed at least a py.typed file to continue. This was missing in the shiboken branch. Task-number: PYSIDE-1675 Change-Id: I5f5df2a084eb15e7b06dcbe97eb173c2f1fb26d0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Add an option to disable implicit conversionsFriedemann Kleint2021-10-144-21/+47
| | | | | | | | | | | | | Add option and extract a helper to return the list of implicit conversions depending on it. [ChangeLog][shiboken6] An option to disable implicit conversions has been added. Pick-to: 6.2 Task-number: PYSIDE-1669 Change-Id: Iaefbbf272a6c033bac10635f48057dd69fc83549 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Adapt to LLVM 12.01Friedemann Kleint2021-10-121-1/+3
| | | | | | | | | | The identifier for anonymous enums has been changed, causing shiboken to no longer recognize them. Pick-to: 6.2 5.15 Task-number: PYSIDE-1686 Change-Id: I4d463132b8bd3fffa0b57f03be6c58ecbae94a49 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* PySide6: Fix constructing a QFont from a family stringFriedemann Kleint2021-10-123-0/+64
| | | | | | | | | | | Change qtbase/d8602ce58b6ef268be84b9aa0166b0c3fa6a96e8 added QFont(QStringList) which now triggers for strings as well since they are a sequence. Fix by specifying overload numbers. Pick-to: 6.2 Fixes: PYSIDE-1685 Change-Id: Ic78c2b273fe81949f852ea6e0f578613bc0a623a Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken: fix missing cleanup in overridden virtual methods of wrappersChristian Tismer2021-10-111-22/+23
| | | | | | | | | | | | | | | | | | | | | | In an error condition, all arguments must be invalidated in order to get a clean state. This is currently not done when an error condition exists. Rewrite the code to generate in a way that all destructions are done, regardless of function outcome. That needed some reordering of the code, in order to move the necessary cleanup right after the Python function call and before PyErr_Print/return. [ChangeLog][shiboken6] Overridden virtual methods are now always correctly finalized, regardless of errors. Change-Id: If87cc4631f9b5731c1b1b8c7bf204e72d8744cc7 Fixes: PYSIDE-656 Pick-to: 6.2 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* PySide6: Add qmlRegister functions taking a library URLFriedemann Kleint2021-10-114-0/+91
| | | | | | | Fixes: PYSIDE-1631 Pick-to: 6.2 Change-Id: I082c3576c24f772190cc103da787311b43acf88c Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Refactor ShibokenGenerator::pythonPrimitiveTypeName()Friedemann Kleint2021-10-081-17/+15
| | | | | | | | | Make it throw when a type is not found. Replace the occurrences where this can happen by direct access to mapping. Task-number: PYSIDE-1660 Change-Id: Ieb8c2c8816192c0197c914a74979a5738e140545 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* PySide6: Fix hang in QQmlApplicationEngine functions with message handlerFriedemann Kleint2021-10-071-1/+6
| | | | | | | | | Add allow-thread. Pick-to: 6.2 5.15 Fixes: PYSIDE-1681 Change-Id: I624979c5845a3366bcd9d7827ff2c77438ec54f3 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken: do some cleanup for writeVirtualMethodNative before fixingChristian Tismer2021-10-071-62/+67
| | | | | | | | | | | | | | The function `writeVirtualMethodNative` has some omission problems in the finalization when an error occurred. Before fixing that error, do some cleanup of the code and improve the formatting to prevent overly long lines both in the generated and the source code. Task-number: PYSIDE-656 Change-Id: I3ff2ee8518aaf8e8c73039970f2c014a87073f5f Pick-to: 6.2 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* shiboken6/Clang parser: Replace #ifdefery for compiler/platform by variablesFriedemann Kleint2021-10-073-118/+93
| | | | | | | | | | | | Introduce enumerations for compiler and platform. Add variables, initialize them by #ifdefs and use accessor functions instead of versions. This lays the groundwork for cross-compiling. Task-number: PYSIDE-802 Pick-to: 6.2 Change-Id: I988bb9e963f6205a6433d3e48c05b7a8823f8398 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6/Clang parser: Refactor include checkingFriedemann Kleint2021-10-076-76/+81
| | | | | | | | | | | | | | | | | In the base class BaseVisitor of the clang parser, check whether the file has changed by comparing the CXFile. If it has changed, convert the file name to a QString and call visitLocation(). The code is then faster since the file name checks are only performed when the CXFile changes. The check code operating on QString becomes simpler and can be extended more easily. Task-number: PYSIDE-802 Task-number: PYSIDE-1660 Pick-to: 6.2 Change-Id: I1dd22ef91a4a7b96d05507b43511313507281fd6 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Add a signals and slots tutorialFriedemann Kleint2021-10-073-0/+236
| | | | | | | Pick-to: 6.2 Task-number: PYSIDE-841 Change-Id: I7e78f97fed206f0722e50d967ec84800d3bef810 Reviewed-by: Christian Tismer <tismer@stackless.com>
* PySide6: Fix QObject.property() for QFlag typesFriedemann Kleint2021-10-052-0/+15
| | | | | | | | | | | | | QObject::property() returns a QVariant for whose type a shiboken converter is retrieved by name (QVariant::typeName()). This fails for QFlags types since QVariant::typeName() returns the fully expanded name QFlag<Enum>. Register the flags converter under that name, too, to fix this. Pick-to: 6.2 Fixes: PYSIDE-1673 Change-Id: I23e83da34b82196d76b78fa44f67647da65737c8 Reviewed-by: Christian Tismer <tismer@stackless.com>
* PySide6: Enable the SSL methods of QWebSocketsFriedemann Kleint2021-10-051-11/+0
| | | | | | | Pick-to: 6.2 Fixes: PYSIDE-610 Change-Id: I120816a1ce7612b8390037713fef255711019c19 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Remove the PyObject_Check helper macroFriedemann Kleint2021-10-055-8/+10
| | | | | | | | | | | | | The macro was there to satisfy the shiboken heuristics which would generate "PyObject_Check" to check for a PyObject, which is always true. Remove the macro and handle "true" in the type entry. [ChangeLog][shiboken6] The macro PyObject_Check() has been removed. Task-number: PYSIDE-1660 Change-Id: I86fc1ed3d8773245deb679142a8ff830cbc19883 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Refactor the code generating the type checkFriedemann Kleint2021-10-052-34/+31
| | | | | | | | | | | | | - Use pyInVariable in more places. - Replace placeholder string formatting by concatenation/QTextStream. - Simplify the code appending the "pyIn" variable to check function and handle the constants true/false. - Remove unused code path replacing "%in", which is handled elsewhere (conversion rules). Task-number: PYSIDE-1660 Change-Id: Ib7d3a9ca940860bf99f6731284c01e1a61df2618 Reviewed-by: Christian Tismer <tismer@stackless.com>
* PySide6: Expose QVideoFrame::bits(int)Friedemann Kleint2021-10-042-4/+4
| | | | | | | | | | | QVideoFrame::bits() was removed in Qt 6; expose QVideoFrame::bits(int plane). Pick-to: 6.2 Fixes: PYSIDE-1674 Change-Id: I23f58f71286e445ad1b1e170924ee5e40f0b2491 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Add std::string to the signature mappingFriedemann Kleint2021-10-041-0/+2
| | | | | | | | | Fix warning: UNRECOGNIZED: 'std.string' OFFENDING LINE: 'PySide6.QtCore.QByteArray.fromStdString(s:std.string)->PySide6.QtCore.QByteArray' Change-Id: Ie57b9f57028195fa438006f7952298e56a263693 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Fix hang in test bug_430.py in Qt 6.3Friedemann Kleint2021-10-041-6/+8
| | | | | | | | | | | Terminating the application via closing the last window only works when the window was actually shown. Add a call to show() and reformat code. Pick-to: 6.2 Task-number: QTBUG-97033 Change-Id: I1e0a82d1baf1676de5a38c1a8fd2408e104b464a Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Document builtin primitive typesFriedemann Kleint2021-10-042-6/+29
| | | | | | Task-number: PYSIDE-1660 Change-Id: Icd95311c99e6f0333fa58e307e71e2d886e87e3b Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Make some ShibokenGenerator methods staticFriedemann Kleint2021-10-042-4/+5
| | | | | | | Complements 9e19ebd9c90999368dbf2db1a5e7b44cc2ddf7fa. Change-Id: I19ce8f744ea38f7913e099f02e496fda855d3640 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Add std::string types as builtinFriedemann Kleint2021-10-013-3/+36
| | | | | | | | | Add std::(w)string and their views. Task-number: PYSIDE-1660 Change-Id: I4201f0561ead327ab310a22fb1dcfe59e4adb86a Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Remove some C++ primitive types from the typesystem filesFriedemann Kleint2021-10-014-50/+0
| | | | | | | | | | | Remove the basic C++ primitive types from the typesystem files. Leave the Qt typedef'ed types in place as otherwise the function modifications would no longer match. Task-number: PYSIDE-1660 Change-Id: Ic64634633640a4b358221fc9f64180df94af02de Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Add builtin C++ typesFriedemann Kleint2021-10-015-4/+98
| | | | | | | | | | Add the builtin C++ types that were not defined in the typesystem files. At header parsing time, add types that are typedefs to primitive types. Task-number: PYSIDE-1660 Change-Id: I29912ce39d4387b22fa43442bbd0f9fffbf44b5c Reviewed-by: Christian Tismer <tismer@stackless.com>
* pep386impl: fix a left-over from the Python 2 cleanup, take 2Christian Tismer2021-10-012-39/+0
| | | | | | | | Forgot to remove some more stuff. Task-number: PYSIDE-535 Change-Id: Ib3117c1242a7e0007806ff468cbd52f0e640ec79 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* libshiboken: Split Shiboken::String::toCString() into 2 overloadsFriedemann Kleint2021-10-012-9/+20
| | | | | | | | Split out the rarely used version taking a Py_ssize_t *len for clarity. Change-Id: Ia0f39a6993558e8aae1523a9b54c67c94beec4ab Reviewed-by: Christian Tismer <tismer@stackless.com>
* Documentation: Fix missing signal/slot lists in class documentationFriedemann Kleint2021-10-017-24/+34
| | | | | | | | | | | | | | | | | | shiboken needs to run with pyside extensions to parse the Qt annoations correctly. Change 62c21af778b7bff6c86e7f89ef03a87efa6c51cb moved the compiler defines from the pyside global header into shiboken. This caused the function type detection to fail in the doc generator since it did not pyside extensions and thus signals/slots were listed as normal functions. To fix this, move the --enable-pyside-extensions option to the base class Generator and add it to documentation's CMakeLists.txt. Pick-to: 6.2 5.15 Change-Id: I70142367ee01839d8e44cbf31e894991cf941197 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Refactor known primitive typesFriedemann Kleint2021-10-013-20/+92
| | | | | | | | Move the sets to AbstractMetaType. Task-number: PYSIDE-1660 Change-Id: I4871ee44f2f3fc56c541de5fd19eea2ddb6e0e04 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Store removed modification in AbstractMetaArgumentFriedemann Kleint2021-10-019-50/+76
| | | | | | | | | Similar to 984559a68d57d76b49c8ed0cbaf3492521aebebd, store the "removed" modification in AbstractMetaArgument. Task-number: PYSIDE-1660 Change-Id: Id541b4dccdcf3eba708a0da5dc873fe3b20b8151 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Refactor modified types of functionsFriedemann Kleint2021-10-0115-120/+199
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove AbstractMetaFunction::typeReplaced(), which returned the modified type of an argument or the return type as a string. Instead, for function arguments, for which modified types must always be valid AbstractMetaTypes, add a getter modifiedType() returning an AbstractMetaType to AbstractMetaArgument. This fixes a number of potential bugs when accessing typeReplaced(int) with the wrong position due to removed arguments. The modified argument types are parsed from the XML strings in early on in AbstractMetaClass::fixFunctions() with proper error reporting. For return types, for which modified types need to be valid only when generating a type check for virtual method return in the C++ wrapper, add a function modifiedTypeName() to AbstractMetaFunction. Adapt the client code accordingly. Split apart CppGenerator::writeTypeCheck() into one overload taking an AbstractMetaType and one taking a string. Task-number: PYSIDE-1660 Change-Id: Id95379892b40ae2632ca33ed27263bada0ec015d Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Store the AbstractMetaArgument instead of the type in OverloaddataFriedemann Kleint2021-10-013-12/+19
| | | | | | | | This makes subsequent refactorings easier. Task-number: PYSIDE-1660 Change-Id: I2ca708c2e3313c48483c8769eb186123bff5da9b Reviewed-by: Christian Tismer <tismer@stackless.com>
* pep386impl: fix a left-over from the Python 2 cleanupChristian Tismer2021-10-012-12/+1
| | | | | | | | | | | | | _PepLong_AsInt still existed. This may be again a rebasing glitch. Found when doing the first attempt to build PySide on PyPy with Windows :) Pick-to: 6.2 Task-number: PYSIDE-535 Change-Id: Ic0b6167bc08c9da8e0d34d6ef2d5b71c8ee548c1 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Shiboken: avoid an unused function warningChristian Tismer2021-09-301-1/+1
| | | | | | Pick-to: 6.2 Change-Id: Iaa4454568d10c8f1e82c1f02d5bc128273e8dff6 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* shiboken6: Document builtin custom typesFriedemann Kleint2021-09-303-0/+24
| | | | | | | Pick-to: 6.2 Task-number: PYSIDE-1660 Change-Id: Ia602fcad2bfca2e92bc7e8363ac096558c064114 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Limited API: Add a fast path to _PepUnicode_AsString()Friedemann Kleint2021-09-302-3/+24
| | | | | | | | | | | | | | Add a helper that returns the char * UTF-8 data from a PyUnicode object without triggering conversions. Change _PepUnicode_AsString() to return const char * to match Python 3 on this occasion. [ChangeLog][shiboken6] A fast path for converting Python string to UTF-8 has been added to the limited API. Change-Id: I619933633e226525fc248b27fd42cd1ce5178be0 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Make debug output for strings more verboseFriedemann Kleint2021-09-301-1/+81
| | | | | Change-Id: I1b81d56dc254fe3a77e1f39864dd45ac76a5f3c8 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Limited API: Add more Unicode functionsFriedemann Kleint2021-09-304-12/+106
| | | | | | | | | | | Add the PepUnicode_KIND() and PepUnicode_DATA() and other check macros. [ChangeLog][shiboken6] More string helper functions have been added to the limited API. Change-Id: I606f5a6f6fd49521d0b85f844f29bb052ff8500b Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Ensure that code parsing sees standard integer typedefsFriedemann Kleint2021-09-301-6/+7
| | | | | | | | Extend the system header to check to include the types headers. Task-number: PYSIDE-1660 Change-Id: I8ef753c15aafe8e613df012af55ad4d900ad43da Reviewed-by: Christian Tismer <tismer@stackless.com>