| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
Adapt CMake files, build scripts, tests and examples.
Task-number: PYSIDE-904
Change-Id: I845f7b006e9ad274fed5444ec4c1f9dbe176ff88
Reviewed-by: Christian Tismer <tismer@stackless.com>
|
|\
| |
| |
| | |
Change-Id: Ie6da3938b82f5ebe96dd12bd65a3ccc4180d2fba
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
|\|
| |
| |
| | |
Change-Id: Id0fc76666bbdb254a833eeb6909a0874b2611bf3
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The `__get__` method gets created by `PyType_Ready` when
the slot `tp_descr_get` is set in the signal class.
Change-Id: Id853c59546c0382afeda837f0abfd596b6ca5c7f
Fixes: PYSIDE-68
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
|
|\|
| |
| |
| | |
Change-Id: Ia31df23a16575f9ecefe13ec85fb70197d103278
|
| |
| |
| |
| |
| |
| | |
Task-number: PYSIDE-68
Change-Id: I8245260cadf6c71167bff51829f2851ab8403248
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
|
|/
|
|
|
|
|
| |
Task-number: PYSIDE-1339
Task-number: PYSIDE-904
Change-Id: I7e4ffaeabb2ac8a5ffe165d43b3475a7e5d57447
Reviewed-by: Christian Tismer <tismer@stackless.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When determinating the type name for Signal types,
we have special treatment for a couple of Python types
like str, int, float, bool, etc, if the current type
is none of those, we return a generic 'PyObject',
which in most cases works, but not for specific interaction
with WebChannel.
Emiting one of the previous types works out of the box,
but when using:
... = Signal(list)
we get a message stating:
> js: Uncaught TypeError: Cannot read property '0' of null
meaning that list was not really passed correctly.
The solution for this is to use:
... = Signal('QVariantList')
but as a string, not type.
Passing a string means that we will return the same type as string
from the getTypeName function, so this patch adds a condition
to treat Signal(list) as a Signal('QVariantList').
We were using this workaround for some bugs related to QtWebKit,
so it was accepted as solution.
Fixes: PYSIDE-981
Change-Id: I06720ca62426d51decc2ab08d380f7f967460788
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Christian Tismer <tismer@stackless.com>
|
|
|
|
|
|
|
|
|
|
|
| |
This was merged with "WIP: Enable support for Python 3.9".
There were minor problems, only.
Thanks Cristian for adding cosmetic changes which should already
have been applied in Python 3.8 or earlier.
Change-Id: Id5e8696d9cfb7192243ad44c93e9f2cf347d6a7c
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
|
|
|
|
|
|
| |
Task-number: PYSIDE-904
Change-Id: I0280de35578f72ab4616170115c5afed9d6d7488
Reviewed-by: Christian Tismer <tismer@stackless.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This implementation allows module-level and scoped QEnums
which are Python enum types. Scoped types are registered in Qt's meta
object system.
Usage of QEnum/QFlag with decorator or function call:
from enum import Enum, Flag, auto
from PySide2.QtCore import QEnum, QFlag, QObject
class Compass(QObject):
@QEnum
class Orientation(Enum):
North, East, South, West = range(4)
class Color(Flag):
RED = auto()
BLUE = auto()
GREEN = auto()
WHITE = RED | BLUE | GREEN
QFlag(Color)
Fixes: PYSIDE-957
Change-Id: Ie15f45cbd932c816b50724a96eee0c14ae1fdee8
Task-number: PYSIDE-487
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
|
|\
| |
| |
| | |
Change-Id: I302699433b1a9d11b5134b43703a775556bbee14
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
To remove the groundwork from the next checkin, the step
of replacing PyType_FromSpec with SbkType_FromSpec
is extracted.
This change introduces a packageLevel number that is generated
as a name prefix in the class creation but does not use it, yet.
Change-Id: Ic9061231708b546dbd3620d148bca24c27df60a5
Task-number: PYSIDE-1286
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
|
|/
|
|
|
|
|
|
|
| |
Remove deprecated functions and class DestroyListener, which
had hard-coded Qt 5 specific meta object data.
Task-number: PYSIDE-904
Change-Id: Idce86cd5df12dc918335f043c8d7a5f0a95db990
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Including a check for Python EnumMeta types to not consider them
as a normal PySequence allows the decision to use the default
PyObject wrapper case.
Using the 'object' type is currently the workaround,
so this allow the users to use the Enum class instead of declaring
the signal with 'object'.
class A(Enum):
a = 1
b = 1
# Workaround
# signal = Signal(object)
# With this patch
signal = Signal(A)
A test case was added.
Fixes: PYSIDE-239
Change-Id: Ib593dba5a988eceb8b1bfae097768e9ec02be6d5
Reviewed-by: Christian Tismer <tismer@stackless.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch fixes some refcounting problems with Python 3.8 .
One incompatible change was announced in the what's new
document, but actually there were two more problems which
were not explicitly mentioned but took much time to sort out.
The patch is compatible with the limited API changes
(tested with debug build and API error disabled).
It is also independent of the Python version which is
full Limited API support.
For more info, see the documentation mentioned below.
The flag error is circumvented now! We either find a better
solution or leave it as it is. For now this is ok.
Fixes: PYSIDE-939
Change-Id: Iff4a9816857a6ebe86efd4b654d8921e4e464939
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
|
|
|
|
|
|
|
| |
Initial-patch-by: Christian Tismer <tismer@stackless.com>
Task-number: PYSIDE-1087
Change-Id: I5b4f0e70bc9b79dd4a4a545e97722ceba778ee53
Reviewed-by: Christian Tismer <tismer@stackless.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The signature of QtCore.Slot and other classes could not automatically
be generated because the function is not generated by cppgenerator.cpp .
We add it manually in the C++ code into the generation process.
The case of QtCore.Slot had diverse follow-up issues to be solved:
- Classes which did not inherit from Shiboken were not generated.
This is a long-standing omission and creates very many new
simple types.
- The arity of Slot has default arguments after the varargs parameter
"*types". This needed an extended Python parser analysis that fixes
the arguments given to the inspect module, accordingly.
- The signature generation was completely new implemented and
relies no longer on the restricted syntax of a Python (2) function
but generates signatures directly as Parameter instances.
Implemented classes with hand-made signatures:
QtCore.ClassInfo
QtCore.MetaFunction,
QtCore.MetaSignal
QtCore.Property
QtCore.Signal
QtCore.SignalInstance
QtCore.Slot
QtQml.ListProperty
QtQml.VolatileBool
As a side effect, many more subtypes were published.
Enums are done, which concludes this work.
Fixes: PYSIDE-945
Fixes: PYSIDE-1052
Change-Id: Ic09f02ece3a90325519e42e4e39719beb0c27ae9
Reviewed-by: Christian Tismer <tismer@stackless.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
PySide classes had wrong return values in their init code.
In case of errors, they would not show up immediately.
The following modules are affected:
sources/pyside2/libpyside/pysideclassinfo.cpp
sources/pyside2/libpyside/pysideproperty.cpp
sources/pyside2/libpyside/pysidesignal.cpp
sources/pyside2/libpyside/pysideslot.cpp
sources/pyside2/PySide2/QtQml/pysideqmlregistertype.cpp
This error exists since Nov 03 2010 .
Fixes: PYSIDE-1077
Change-Id: I8cf9bf7d1d8f8dca1155274cb24408f423557bac
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|