| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There were many uses cases when a proper interaction
between Python and Qml was needed, one of them was
the case to emit signals from Python an get those values
via an argument name in QML.
A simple example describing this situation can be found
in PYSIDE-634:
Python:
sumResult = Signal(int, arguments=["sum"])
sumResult.emit(42)
Qml:
onSumResult: console.log(sum) // will print 42
A test case based on the same example was added.
Change-Id: I0908f97d88eaadc0c02d81bc4daca936f72f6c6a
Fixes: PYSIDE-634
Reviewed-by: Christian Tismer <tismer@stackless.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Among other files to fix, basewrapper.(cpp|h) was full of uncommon
pointer whitespace. After fixing that, I could not resist and fixed
also libshiboken, generators, and after acceptance also PySide.
Most of the time, this regex worked fine
(\w\w+)([*&]+)[ ]*(?![&*]*[/=])
replaced with
\1 \2
but everything was checked by hand.
I did not touch the shiboken tests which are quite hairy.
It turned out that inserting a space between a variable and asterisk
causes a crash of shiboken, if the same line contains "CONVERTTOCPP".
This was temporarily fixed by adding another space after it.
Example..
sources/pyside2/PySide2/glue/qtcore.cpp line 977
QByteArray * cppSelf = %CONVERTTOCPP[QByteArray *](obj);
//XXX /|\ omitting this space crashes shiboken!
cppgenerator.cpp was special, since it was modified to _generate_
correct pointer whitespace. This caused a few testcases to fail,
which had to be adjusted, again. This was difficult since some
internal names must end on "*" and generated code normally not.
Removing the last errors involved binary search on path sets...
Apply C++ 11 fixits to the changed code, where applicable.
Done-with: Friedemann.Kleint@qt.io
Task-number: PYSIDE-1037
Change-Id: I4ac070f52c5efb296c05d581c9d46e6f397a6c81
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
Introduce C++ structs with QByteArray to be used for signal and slot
names and signatures, removing a lot of code dealing with char *
pointers, strdup() and reallocating.
Change-Id: I28acf727bc6cf468285b153c85b0a342fd79f7d8
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Tismer <tismer@stackless.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fix warnings occurring in 5.13:
sources/shiboken2/ApiExtractor/abstractmetalang.cpp:1431:66: warning: ‘void qSort(RandomAccessIterator, RandomAccessIterator, LessThan) [with RandomAccessIterator = AbstractMetaFunction**; LessThan = bool (*)(AbstractMetaFunction*, AbstractMetaFunction*)]’ is deprecated: Use std::sort [-Wdeprecated-declarations]
sources/shiboken2/generator/shiboken2/cppgenerator.cpp:358:43: warning: ‘void qSort(RandomAccessIterator, RandomAccessIterator) [with RandomAccessIterator = Include*]’ is deprecated: Use std::sort [-Wdeprecated-declarations]
sources/shiboken2/generator/shiboken2/cppgenerator.cpp:1683:55: warning: ‘void qSort(RandomAccessIterator, RandomAccessIterator) [with RandomAccessIterator = QList<QString>::iterator]’ is deprecated: Use std::sort [-Wdeprecated-declarations]
sources/shiboken2/generator/shiboken2/cppgenerator.cpp:5500:53: warning: ‘void qSort(RandomAccessIterator, RandomAccessIterator) [with RandomAccessIterator = Include*]’ is deprecated: Use std::sort [-Wdeprecated-declarations]
sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp:1585:65: warning: ‘void qSort(RandomAccessIterator, RandomAccessIterator, LessThan) [with RandomAccessIterator = AbstractMetaFunction**; LessThan = bool (*)(const AbstractMetaFunction*, const AbstractMetaFunction*)]’ is deprecated: Use std::sort [-Wdeprecated-declarations]
sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp:1681:24: warning: ‘void qSort(Container&) [with Container = QStringList]’ is deprecated: Use std::sort [-Wdeprecated-declarations]
sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp:2054:25: warning: ‘void qSort(Container&) [with Container = QStringList]’ is deprecated: Use std::sort [-Wdeprecated-declarations]
Change-Id: If6940941ac31327597ce362a31b27773f4d5b94c
Reviewed-by: Christian Tismer <tismer@stackless.com>
|
|\
| |
| |
| | |
Change-Id: I3bb491686968e81382c135ab737da259d9796f52
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When a type has nullptr as tp_dealloc, there apply different defaults.
Static types had object_dealloc as default, while new heaptypes
created with type_new have subtype_dealloc as default.
A problem was now that PyType_FromSpec also has
subtype_dealloc as default. But that is wrong, because a type that
was written with the static type approach is already written with
object_dealloc in mind and takes somehow care about further issues
with that type.
When we now convert this type and suddenly use subtype_dealloc
instead of object_dealloc, things get pretty wrong.
Finding that out was pretty hard and took quite long to understand.
The fix was then very easy and is the best proof:
Replacing our former (wrong) solution of supplying an
SbkDummyDealloc with a function object_dealloc works perfectly,
and the leakage completely vanished.
The documentation now is also corrected.
Task-number: PYSIDE-832
Change-Id: Ifc20c28172eb5663cd5e60dac52e0a43acfb626c
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
|
| |
| |
| |
| |
| | |
Change-Id: I577ca66e0bd92cfedd060b46f4946963eb91f991
Reviewed-by: Christian Tismer <tismer@stackless.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Remove unused #include directives, group by libpyside, libshiboken,
Qt, C++ and sort alphabetically with the exception of sbkpython.h
which sanitizes the "slot" defines and needs to go to the top when
used). Add the module to the Qt classes.
Change-Id: I33d912135bad928d3073a1ddeb487de237d6a45e
Reviewed-by: Christian Tismer <tismer@stackless.com>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
- Add override
- Use = default for trivial constructors/destructors
- Add Q_DISABLE_COPY where applicable
- Use member initialization and remove constructors from simple structs
- Use explicit where applicable (which requires adapting code snippets
constructing a QVariant from PyObjectWrapper)
- Fix some parameter to take a const ref or pass by value
and use std::move in constructors
Change-Id: I5e0d2c4ef92d20397a7daba2f8a64b507e678510
Reviewed-by: Christian Tismer <tismer@stackless.com>
|
|/
|
|
|
|
|
|
|
|
|
| |
- Remove else after return/continue/break; unindent code
or simplify return conditions
- Use isEmpty() to check for empty containers
- Fix C-style casts
- Pass std::size_t by value instead of const ref
Change-Id: Ic997d7c39720c1cd3698c4d750e9cfc1f1654788
Reviewed-by: Christian Tismer <tismer@stackless.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When types have attributes starting with two underscores but
ending with at most one, Python uses name mangling to create
a unique private variable.
PySide needs to obey this rule in the tp_getattro methods.
We implemented it as an optimized _Pep_PrivateMangle function that
solves the problem internally without exposing the _Py_Mangle
function.
Remark: I think the exclusion of the _Py_Mangle function is another
oversight in the Limited API.
Task-number: PYSIDE-772
Change-Id: I0bfc2418dae439e963a16e37443f2099c6980696
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
While trying to document the Limited API Project,
it suddenly struck me:
We can make the patch much much simpler and implement it
without the necessity to have an extra PepType!
Now I am happy to continue the documentation, because
it is now no more improvable.
This version will last as long as the layout of
PyTypeObject does not change substantially. When that
happens, then we need to rewrite stuff with the according
PyType_GetSlot() access functions.
These access functions will until then be complete enough
so that we can live without the tricks like inventing a reduced
PyTypeObject as was done in the current implementation.
Task-number: PYSIDE-560
Change-Id: I49849cc377baa6794a5b53292691e21d6e2853ab
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
This is the condensed checkin of 18 commits which created
the implementation of PEP 384.
Task-number: PYSIDE-560
Change-Id: I834c659af4c2b55b268f8e8dc4cfa53f02502409
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Removing the word 'project' from all the headers,
and changing the PySide reference from the examples
to Qt for Python:
The following line was used inside the source/ and
build_scripts/ directory:
for i in $(grep -r "the Qt for Python project" * |grep -v "pyside2-tools" | awk '{print $1}' | sed 's/:.*//g');do sed -i 's/the\ Qt\ for\ Python\ project/Qt\ for\ Python/g' $i;done
and the following line was used inside the examples/ directory:
for i in $(grep -r "of the PySide" * |grep -v "pyside2-tools" | awk '{print $1}' | sed 's/:.*//g');do sed -i 's/of\ the\ PySide/of\ the\ Qt\ for\ Python/g' $i;done
Change-Id: Ic480714686ad62ac4d81c670f87f1c2033d4ffa1
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
|
|
|
|
|
|
|
|
|
| |
When referring to the project one should use "Qt for Python"
and for the module "PySide2"
Change-Id: I36497df245c9f6dd60d6e160e2fc805e48cefcae
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When connecting a signal with a slot there is a process
to associate the proper signal signature, but the slot
signature was not verified.
This missing verification step lead to wrongly associate
the slots and the signal signatures, for example:
def on_clicked(checked=True):
...
QGroupBox.clicked.connect(on_clicked)
will wrongly connect the slot "on_clicked" with the
signal "clicked()" (without any argument),
when the proper signal is "clicked(bool)".
This can be solved by manually specifying the arguments:
QGroupBox.clicked[bool].connect(self.clicked)
We can add an additional verification step
to associate the proper signal if the slot has
a certain number of arguments.
There is an existing test that checks the compatibility
of this change with all the ways to connect
signals and slots.
A few additional cases were added.
Task-number: PYSIDE-104
Change-Id: Ic5b06fa3bb91903f7d506e0e2c52a6f7d3dc4570
Reviewed-by: Christian Tismer <tismer@stackless.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Using PyCFunction_GET_FLAGS is unsafe, because it does not check
whether the argument given is actually a PyCFunction object. This
macro needs to be replaced with the function equivalent
PyCFunction_GetFlags for stable ABI patch, but this will cause a crash
in PyCFunction_Call because we don't check the return value of
PyCFunction_GetFlags to see if it fails.
Rather than checking the return value, it is safe to preemptively
add a PyCFunction_Check before calling the GetFlags function. This
does not modify the logic behind signalCall function.
The crashing test was homonymoussignalandmethod_test.py, so no
new test is needed.
Task-number: PYSIDE-593
Change-Id: Id9ac9c0dec454e8e1ce9516dc68af924372a34a9
Reviewed-by: Christian Tismer <tismer@stackless.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The current implementation was considering only Py_True
as a success, but not Py_False.
The else statement will enter just in case of error,
as intended.
Added a test case to verify the proper behavior of
Qt.UniqueConnection.
Task-number: PYSIDE-34
Change-Id: I5bafe0e81383022dcd7fc6251fc61d0ab5e918d0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
|
|
in preparation for a subtree merge.
this should not be necessary to do in a separate commit, but git is a
tad stupid about following history correctly without it.
|