| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Updated test to accept base types derived using std::shared_ptr;
* Generate new coode to be able to convert smart pointers into shared
pointers of base class.
Functions that accepts SharedPointer<A> as argument should be able to
accept SharedPointer<B> if B is derived from A.
Task-number: PYSIDE-1397
Change-Id: I7e5235980daaf4651dad3ab1c880373f1c64e134
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
|
|
|
|
|
|
|
| |
Register the correct name for smart pointers.
Change-Id: If12701901319b0578602ff5b5ab8eecad820d969
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- AbstractMetaType: Pass TypeEntry to constructor
- AbstractMetaType: Return instantiations() by const ref
- AbstractMetaClass: Make baseTemplateInstantiations a member instead of
a global hash.
Simplify the code accordingly.
Task-number: PYSIDE-1202
Change-Id: I1a18aa4ff97481af8cb13e8732fe3952c48edb29
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, nullptr for an AbstractMetaType meant "void", particularly
for function return types. The problem with this is that it
causes unexpected crashes when dealing with template types
like QFuture<void> due to one of the instantiations of the
AbstractMetaType being nullptr. Use an AbstractMetaType based
on the existing "void" type entry for this.
Task-number: PYSIDE-1202
Change-Id: Ib06035cc7903480fd509f7e927d9114c55d51b62
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
|
|
|
|
|
|
|
|
|
| |
Skip base classes whose generation was disabled by reject or
generate='no'. This can happen for typedef entries.
Task-number: PYSIDE-1202
Change-Id: Ie6fac2408a6aa7b3303b4f06e744a2d2405e2a30
Reviewed-by: Christian Tismer <tismer@stackless.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
TypeEntry::CodeGeneration::GenerateCpp was unused. Consequently,
the GenerateAll mask is not needed, either.
Replace GenerateCpp and GenerateTargetLang by a generic GenerateCode
value.
Introduce a new GenerationDisabled value to be able to distinguish
a generate='no' XML attribute from a plain rejection.
Fix many invalid usages of bool generateCode() testing against
the flag value.
Use the enum instead of uint for the code generation field.
Task-number: PYSIDE-1202
Change-Id: I0aec5bd1ebfb9a50b80d5a187372c4271490e1b3
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
For wrapper types, generate the class-related extra includes into
the wrapper header since they might be required for it (for
example, instantiation type of a typedef typesystem entry).
Task-number: PYSIDE-1202
Change-Id: I9f57bdfe54d6273e4a1ffa9570e3352959dea480
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
|
|
|
|
|
|
|
|
| |
Replace the macro generated into the code by the one
introduced by 430d02db24b95a56ae0acc6a9df6a0effe49da0d.
Change-Id: I8e713ff25c180a22569a3ba589d04dca43fdc804
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
Factor out method to write the operator functions and call it for the
module wrapper, too.
Fixes: PYSIDE-1326
Change-Id: I5b6faf19d253d5828474dec36b454aa20753123c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
| |
Remove space and use reinterpret_cast.
Task-number: PYSIDE-1326
Change-Id: I1adfc545c97278eb7da01aec550cb6e2e15945ba
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
|
|
|
|
|
|
|
|
|
|
|
| |
namespaces
Add them in ShibokenGenerator::getFunctionGroupsImpl() with some
helpers.
Fixes: PYSIDE-1075
Change-Id: Ie627c6e12f82e40cdb4f306ddac6b682e77124c5
Reviewed-by: Christian Tismer <tismer@stackless.com>
|
|
|
|
|
|
|
|
|
|
|
| |
functions
Mainly add those in ShibokenGenerator::getGlobalFunctionGroups() with
some adaptions.
Task-number: PYSIDE-1075
Change-Id: I6dabac72c204904e76162542b5aa3ea1ac3b56ec
Reviewed-by: Christian Tismer <tismer@stackless.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- 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>
|
|
|
|
|
|
|
|
| |
Properly indent and join the else if statement.
Task-number: PYSIDE-1019
Change-Id: I8d5dc6c84e19b97b55f1ba29094da1e31dc7ca1c
Reviewed-by: Christian Tismer <tismer@stackless.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
PySide types have been following the Qt implementation of
comparisons, completely.
This is not correct for Python, because the Python default has
the operators `==` and `!=` at least. They are needed for tests
like `obj in collection`.
We fix this by redirecting the default case to
`PyBaseObject_Type.tp_richcompare`.
This is the correct way to fix it, because for types which do not
define `tp_richcompare', this is the default, anyway.
From the original patch, the test case is still in use.
Old message:
Implement __ne__ and __eq__ for QTreeWidgetItem
Testing if a QTreeWidgetItem belongs to a list raises a NotImplementedError.
I have exposed the operator== and the operator!= from C++ to shiboken which has solved our eq operator issue.
Implemented the test from PYSIDE-74 for the QTreeWidgetItem eq operator and the ne operator.
This also allows us to have the behavior "QTreeWidgetItem in ['a']" and "QTreeWidgetItem not in ['a']".
Adding qtreewidgetitem_test.py to CMakeFiles.txt
Fixes: PYSIDE-74
Change-Id: Id221c0163fc8c2d85730c4c26f22db5f61710706
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
|
|
|
|
|
|
|
|
| |
Extract briefdescription from doxygen files and make sure to
generate sphinx docs with it
Change-Id: Ibd2b104a2c85de6c3db1e8a48add061c804bd489
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
|
|
|
|
|
|
|
|
| |
Avoid duplicate functions on sphinx index for functions with multiple
signature
Change-Id: I1394657ff6e1978f65bacbab617972d04cac8aaa
Reviewed-by: Christian Tismer <tismer@stackless.com>
|
|
|
|
|
|
|
| |
Use correct class name on constructors documentation
Change-Id: Ibee94f990dff7dbd5fad7e45f9c63ffa2f50207c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
|
|
|
|
|
|
|
|
| |
Use the new sphinx flag `any` when the type is a class and remove any
flag for native types. (`any`is available since sphinx vr. 1.3)
Change-Id: I9ac896b716bbd010c0ec5240a135c9e93d2cc96c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
|
|
|
|
|
|
|
|
| |
Create class doc even if the class do not have a constructor
Change-Id: I8bf93ab9a3184b2c810b57f46a0561f391db0eb7
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Christian Tismer <tismer@stackless.com>
|
|
|
|
|
|
|
|
|
| |
class->name() and class->fullName() now returns the correct values we do
not need to use getClassTargetFullName helper function.
Change-Id: I68371d23d454412041ddd3e910f1e7d6d6435912
Reviewed-by: Christian Tismer <tismer@stackless.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The signature module took the info from the PyCFunction flags
for a long time to check if something is a function, method or
staticmethod.
It turned out that there are functions with multiple signatures
where the method/staticmethod info varies in the signatures.
This invalidated the PyCFunction flag usage.
Instead, we now compute that info directly from abstractmetalang.cpp
which has access to the correct info.
Fixes: PYSIDE-1328
Change-Id: I6ba7237efcc486de014184b1787d05d87bee5a5e
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
| |
In operator functions, some code would be generated
for reverse shift operators and the remaining code
was enclosed in if (!pyresult) without proper indentation.
Generate the if (!pyresult) only when required and indent
it properly by using a QScopedPointer<Indentation>.
Change-Id: Iecffaa3d0a7b243e661b553726066d1177ab0298
Reviewed-by: Christian Tismer <tismer@stackless.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
** fix: MSVC needs extra sign bit in basewrapper_p.h! Buglet? **
The new feature selection has some tiny overhead.
It is about two dict accesses plus a slot access for every
tp_(get|set)attro call.
The introduction of an explicit `__init_feature__` call allows to
optimize this overhead very nicely, because this init is done for
each __feature__ import:
First, we can remove that tiny overhead completely by not initializing
the feature_select module at all if no __feature__ import is used.
Second, we can optimize this access further by caching the current module
dict. If the dict is unchanged, then the last select_id can be used.
This reduces the overhead of frequent calls to a single slot access.
Third, we finally cache the select id in unused SbkObjectType bits.
That removes the last structure where repeated attribute lookup is used.
The overhead is therefore quite small when something is changed.
But typically these changes are infrequent. The majority of accesses
do change nothing, and this case is now quite much optimized.
Change-Id: I7d1a4611a1c19216fd9be8f04457bb18ebd52ab1
Reviewed-by: Christian Tismer <tismer@stackless.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is the implementation of the first of a series of dynamically
selectable features.
The decision depends of the following setting at the beginning of
a module after PySide2 import:
from __feature__ import snake_case
For more info, see the Jira issue, section
The Principle Of Selectable Features In PySide
The crucial problems that are now solved were:
- it is not sufficient to patch a type dict, instead the whole
`tp_mro` must be walked to rename everything.
- tp_getattro must be changed for every existing type. This
is done either in shiboken by a changed PyObject_GenericGetAttr
or PyObject_SenericGetAttr, or in the generated tp_(get|set)attro
functions.
An example is included in sources/pyside2/doc/tutorial/expenses.
Task-number: PYSIDE-1019
Change-Id: I5f103190be2c884b0b4ad806187f3fef8e6598c9
Reviewed-by: Christian Tismer <tismer@stackless.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As of Qt 6, there is a trend of hiding bool returns of comparison operators
of container classes behind some template expression which the clang parser
cannot identify. To work arouind such cases, make it possible to add
them as functions without code injection which will generate the
default code.
Task-number: PYSIDE-1339
Task-number: PYSIDE-904
Change-Id: Ia7bf5d583e0f80505fe1b759347955fec5dca600
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Although it is a questionable practice, it occurs in Qt 6:
virtual const QEventPoint &QPointerEvent::point(int i) const;
Previously, the generated return statement
return QEventPoint();
would cause a warning about returning a temporary.
Fix by creating a static variable and returning a
reference to it.
Task-number: PYSIDE-1339
Task-number: PYSIDE-904
Change-Id: Id6467be22a166e99e8dcf08b2c7c14df33cd2786
Reviewed-by: Christian Tismer <tismer@stackless.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Occurs in Qt 6:
QKeyEvent(..., const QInputDevice *device = QInputDevice::primaryKeyboard());
We need a const-cast here since shiboken needs a QInputDevice * for type
conversion.
Change-Id: Iea1137eac44a26b7bc9cf0e1908c0e42ba2de39f
Reviewed-by: Christian Tismer <tismer@stackless.com>
|
|
|
|
|
|
|
| |
Split out a function returning the return statement as a string.
Change-Id: I9c893a8e0068d7d5d6eff4c7ae44c5f754211bdd
Reviewed-by: Christian Tismer <tismer@stackless.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The override strings in bindingmanager were based upon
pure C strings for a long time. There was some mild overhead
of creating PyObject all the time.
With the upcoming name mangling of Selectable Features,
this becomes even a bit more inefficient when strings also get
mangled. With Python strings this is just a dict lookup.
This patch uses the same machinery as `Shiboken::PyName`.
Task-number: PYSIDE-1019
Change-Id: I4eed7222371dadeed0e9ba98cc7970e726ffc044
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Output most warnings in the standard file:line syntax
used by compilers. This is done for C++ source code
and typesystem files.
Introduce a class SourceLocation and add it to type entry,
AbstractMetaFunction and AbstractMetaClass.
Move more messages into messages.cpp and output the location.
Change the errors reported by the XML typesystem parser to
the same format.
[ChangeLog][shiboken] A number of error and warning messages have
been prefixed by file name and line for better tooling.
Task-number: PYSIDE-904
Change-Id: Ie2008f4060757e9d7ca1b25c00c7c5585240a7b8
Reviewed-by: Christian Tismer <tismer@stackless.com>
|
|
|
|
|
| |
Change-Id: I2463997f1eb2012cbbd0192a019ca57beaf55d5b
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
|
|\ |
|
| |\
| | |
| | |
| | | |
Change-Id: If40b0ab35cd2ad2bd0d982881094ce3dbf46ccf3
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
_WINDOWS is MSVC specific
Fixes passing --include-paths when using MinGW
Change-Id: I041484eccf521869f4fb532edc55d2e1cf4063e4
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
|