diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-08-31 13:40:42 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-09-01 05:32:25 +0000 |
commit | 7ac8da6adee7528578ec800bf810ea69ac746043 (patch) | |
tree | dd2a1d6eadd0f70edccb5b68ce495759e80ff350 | |
parent | 404f584d6ac4b94c65d60aa1171f0ef1fe4dc6bd (diff) |
Adapt to recent Qt 6 changes
- Removal of the statemachine framework from QtCore
- Addition of QAbstractFileIconProvider
- Adapt some signatures
- QMetaType deprecations
Change-Id: Ia51354542ad1d2f0bb5530e45ebef0d6ccdb633d
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
18 files changed, 27 insertions, 661 deletions
diff --git a/dependencies.yaml b/dependencies.yaml index 61a9c977a..bdf70113b 100644 --- a/dependencies.yaml +++ b/dependencies.yaml @@ -1,4 +1,4 @@ dependencies: ../../qt/qtdeclarative: - ref: 3debb37250b2c57aaaf81940f9dfeb540fd4e380 + ref: 22234c8a469be7c831aab51c9705e06f8624d24e required: true diff --git a/sources/pyside2/PySide2/QtCore/CMakeLists.txt b/sources/pyside2/PySide2/QtCore/CMakeLists.txt index 18df8a797..e8356b9d8 100644 --- a/sources/pyside2/PySide2/QtCore/CMakeLists.txt +++ b/sources/pyside2/PySide2/QtCore/CMakeLists.txt @@ -18,9 +18,7 @@ ${QtCore_GEN_DIR}/qabstractitemmodel_wrapper.cpp ${QtCore_GEN_DIR}/qabstractlistmodel_wrapper.cpp ${QtCore_GEN_DIR}/qabstractnativeeventfilter_wrapper.cpp ${QtCore_GEN_DIR}/qabstractproxymodel_wrapper.cpp -${QtCore_GEN_DIR}/qabstractstate_wrapper.cpp ${QtCore_GEN_DIR}/qabstracttablemodel_wrapper.cpp -${QtCore_GEN_DIR}/qabstracttransition_wrapper.cpp ${QtCore_GEN_DIR}/qanimationgroup_wrapper.cpp ${QtCore_GEN_DIR}/qbasicmutex_wrapper.cpp ${QtCore_GEN_DIR}/qbasictimer_wrapper.cpp @@ -59,17 +57,14 @@ ${QtCore_GEN_DIR}/qeasingcurve_wrapper.cpp ${QtCore_GEN_DIR}/qelapsedtimer_wrapper.cpp ${QtCore_GEN_DIR}/qevent_wrapper.cpp ${QtCore_GEN_DIR}/qeventloop_wrapper.cpp -${QtCore_GEN_DIR}/qeventtransition_wrapper.cpp ${QtCore_GEN_DIR}/qfactoryinterface_wrapper.cpp ${QtCore_GEN_DIR}/qfile_wrapper.cpp ${QtCore_GEN_DIR}/qfiledevice_wrapper.cpp ${QtCore_GEN_DIR}/qfileinfo_wrapper.cpp ${QtCore_GEN_DIR}/qfileselector_wrapper.cpp ${QtCore_GEN_DIR}/qfilesystemwatcher_wrapper.cpp -${QtCore_GEN_DIR}/qfinalstate_wrapper.cpp ${QtCore_GEN_DIR}/qgenericargument_wrapper.cpp ${QtCore_GEN_DIR}/qgenericreturnargument_wrapper.cpp -${QtCore_GEN_DIR}/qhistorystate_wrapper.cpp ${QtCore_GEN_DIR}/qidentityproxymodel_wrapper.cpp ${QtCore_GEN_DIR}/qiodevice_wrapper.cpp ${QtCore_GEN_DIR}/qiodevicebase_wrapper.cpp @@ -131,17 +126,12 @@ ${QtCore_GEN_DIR}/qsequentialanimationgroup_wrapper.cpp ${QtCore_GEN_DIR}/qsettings_wrapper.cpp ${QtCore_GEN_DIR}/qsignalblocker_wrapper.cpp ${QtCore_GEN_DIR}/qsignalmapper_wrapper.cpp -${QtCore_GEN_DIR}/qsignaltransition_wrapper.cpp ${QtCore_GEN_DIR}/qsize_wrapper.cpp ${QtCore_GEN_DIR}/qsizef_wrapper.cpp ${QtCore_GEN_DIR}/qsocketdescriptor_wrapper.cpp ${QtCore_GEN_DIR}/qsocketnotifier_wrapper.cpp ${QtCore_GEN_DIR}/qsortfilterproxymodel_wrapper.cpp ${QtCore_GEN_DIR}/qstandardpaths_wrapper.cpp -${QtCore_GEN_DIR}/qstate_wrapper.cpp -${QtCore_GEN_DIR}/qstatemachine_signalevent_wrapper.cpp -${QtCore_GEN_DIR}/qstatemachine_wrappedevent_wrapper.cpp -${QtCore_GEN_DIR}/qstatemachine_wrapper.cpp ${QtCore_GEN_DIR}/qstorageinfo_wrapper.cpp ${QtCore_GEN_DIR}/qstringlistmodel_wrapper.cpp ${QtCore_GEN_DIR}/qsysinfo_wrapper.cpp diff --git a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml index 05dc7185b..8e9a25629 100644 --- a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml +++ b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml @@ -51,7 +51,6 @@ <custom-type name="PyTypeObject"/> <custom-type name="PyUnicode"/> <custom-type name="list of QAbstractAnimation"/> - <custom-type name="list of QAbstractState"/> <function signature="qAcos(qreal)"/> <function signature="qAsin(qreal)" since="4.6"/> @@ -72,11 +71,9 @@ <function signature="qTan(qreal)" since="4.6"/> <function signature="qtTrId(const char*,int)" since="4.6"/> <function signature="qVersion()"/> - <function signature="qrand()"/> - <function signature="qsrand(uint)"/> - <function signature="qCompress(const uchar*,int,int)"/> + <function signature="qCompress(const uchar*,qsizetype,int)"/> <function signature="qCompress(const QByteArray&,int)"/> - <function signature="qUncompress(const uchar*,int)"/> + <function signature="qUncompress(const uchar*,qsizetype)"/> <function signature="qUncompress(const QByteArray&)"/> <inject-code class="native" position="beginning" file="../glue/qtcore.cpp" snippet="include-pyside"/> @@ -716,7 +713,7 @@ </add-function> </value-type> <value-type name="QLineF"> - <enum-type name="IntersectType"/> + <enum-type name="IntersectionType"/> <add-function signature="__repr__" return-type="PyObject*"> <inject-code class="target" position="beginning"> <insert-template name="repr_code"> @@ -1810,21 +1807,11 @@ </extra-includes> <!-- ### These overloads must be removed accept strings with \x00 in their contents --> - <modify-function signature="append(const char*,int)" remove="all"/> <modify-function signature="append(const char*)" remove="all"/> - <modify-function signature="indexOf(char,int)const" remove="all"/> - <modify-function signature="insert(int,const char*)" remove="all"/> - <modify-function signature="insert(int,char)" remove="all"/> - <modify-function signature="insert(int,const char*,int)" since="4.6" remove="all"/> - <modify-function signature="lastIndexOf(char,int)const" remove="all"/> <modify-function signature="prepend(const char*)" remove="all"/> - <modify-function signature="prepend(const char*,int)" since="4.6" remove="all"/> <modify-function signature="replace(QByteArray,const char*)" remove="all"/> - <modify-function signature="replace(const char*,int,const char*,int)" remove="all"/> <modify-function signature="replace(const char*,QByteArray)" remove="all"/> <modify-function signature="replace(const char*,const char*)" remove="all"/> - <modify-function signature="replace(int,int,const char*)" remove="all"/> - <modify-function signature="replace(int,int,const char*,int)" since="4.6" remove="all"/> <modify-function signature="replace(char,const char*)" remove="all"/> <modify-function signature="operator==(const char*,QByteArray)" remove="all"/> <modify-function signature="operator==(QByteArray,const char*)" remove="all"/> @@ -1885,10 +1872,6 @@ </insert-template> </inject-code> </add-function> - <modify-function signature="QByteArray(const char*,int)"> - <!-- Keep \x00 bytes passed in python strings --> - <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qbytearray-1"/> - </modify-function> <add-function signature="QByteArray(PyByteArray)"> <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qbytearray-2"/> </add-function> @@ -1925,7 +1908,6 @@ <modify-function signature="operator<=(const char*,QByteArray)" remove="all"/> <modify-function signature="operator>(const char*,QByteArray)" remove="all"/> <modify-function signature="operator>=(const char*,QByteArray)" remove="all"/> - <modify-function signature="operator[](int)const" remove="all"/> <!-- Those types have the same representation in Python, an overload would be useless and cause overflow errors. --> <modify-function signature="setNum(uint,int)" remove="all"/> @@ -2019,16 +2001,6 @@ </inject-code> </modify-function> <!-- QByteArray(const char *) do the job of this constructor --> - <modify-function signature="QByteArray(const char*,int)" remove="all"/> - <modify-function signature="fromRawData(const char*,int)"> - <modify-argument index="1"> - <replace-type modified-type="PyBytes"/> - </modify-argument> - <modify-argument index="2"> - <remove-argument /> - </modify-argument> - <inject-code class="target" file="../glue/qtcore.cpp" snippet="qbytearray-fromrawdata"/> - </modify-function> <modify-function signature="toDouble(bool*)const"> <modify-argument index="1"> <remove-argument/> @@ -2288,7 +2260,6 @@ </extra-includes> </object-type> <object-type name="QTimeLine"> - <enum-type name="CurveShape"/> <enum-type name="Direction"/> <enum-type name="State"/> </object-type> @@ -2405,7 +2376,6 @@ <!-- blocking functions --> <modify-function signature="processEvents(QFlags<QEventLoop::ProcessEventsFlag>,int)" allow-thread="yes"/> <modify-function signature="processEvents(QFlags<QEventLoop::ProcessEventsFlag>)" allow-thread="yes"/> - <modify-function signature="flush()" allow-thread="yes"/> <modify-function signature="sendEvent(QObject*,QEvent*)" allow-thread="yes"/> <modify-function signature="sendPostedEvents(QObject*,int)" allow-thread="yes"/> <modify-function signature="instance()"> @@ -2812,61 +2782,6 @@ <enum-type name="State"/> </object-type> - <object-type name="QAbstractState" since="4.6"> - <modify-function signature="machine()const"> - <modify-argument index="this"> - <parent index="return" action="add"/> - </modify-argument> - </modify-function> - </object-type> - - <object-type name="QAbstractTransition" since="4.6"> - <enum-type name="TransitionType" since="5.5"/> - - <modify-function signature="QAbstractTransition(QState*)"> - <modify-argument index="1"> - <parent index="this" action="add"/> - </modify-argument> - </modify-function> - - <modify-function signature="addAnimation(QAbstractAnimation*)"> - <modify-argument index="1"> - <reference-count action="add"/> - </modify-argument> - </modify-function> - - <modify-function signature="removeAnimation(QAbstractAnimation*)"> - <modify-argument index="1"> - <reference-count action="remove"/> - </modify-argument> - </modify-function> - - <modify-function signature="setTargetState(QAbstractState*)"> - <modify-argument index="1"> - <reference-count action="set"/> - </modify-argument> - </modify-function> - - <modify-function signature="targetState()const"> - <modify-argument index="return"> - <reference-count action="set" variable-name="setTargetState(QAbstractState*)1"/> - </modify-argument> - </modify-function> - - <modify-function signature="targetStates()const"> - <modify-argument index="return"> - <reference-count action="set" variable-name="setTargetState(QAbstractState*)1"/> - </modify-argument> - </modify-function> - - <modify-function signature="setTargetStates(QList<QAbstractState*>)"> - <modify-argument index="1"> - <reference-count action="set" variable-name="setTargetState(QAbstractState*)1"/> - </modify-argument> - </modify-function> - - </object-type> - <object-type name="QAnimationGroup" since="4.6"> <modify-function signature="addAnimation(QAbstractAnimation*)"> <modify-argument index="1"> @@ -2941,48 +2856,6 @@ </extra-includes> </value-type> - <object-type name="QEventTransition" since="4.6"> - <modify-function signature="QEventTransition(QState*)"> - <modify-argument index="1"> - <parent index="this" action="add"/> - </modify-argument> - </modify-function> - - <modify-function signature="QEventTransition(QObject*,QEvent::Type,QState*)"> - <modify-argument index="3"> - <parent index="this" action="add"/> - </modify-argument> - </modify-function> - - </object-type> - - <object-type name="QFinalState" since="4.6"/> - - <object-type name="QHistoryState" since="4.6"> - <enum-type name="HistoryType"/> - <modify-documentation xpath='description/code'> - <code>machine = QStateMachine() - -s1 = QState() -s11 = QState(s1) -s12 = QState(s1) - -s1h = QHistoryState(s1) -s1h.setDefaultState(s11) - -machine.addState(s1) - -s2 = QState() -machine.addState(s2) - -button = QPushButton() -# Clicking the button will cause the state machine to enter the child state -# that s1 was in the last time s1 was exited, or the history state's default -# state if s1 has never been entered. -s1.addTransition(button.clicked, s1h)</code> - </modify-documentation> - </object-type> - <value-type name="QMargins" since="4.6"/> <value-type name="QMarginsF" since="5.3"/> @@ -2996,82 +2869,6 @@ s1.addTransition(button.clicked, s1h)</code> <object-type name="QSequentialAnimationGroup" since="4.6"/> - <object-type name="QSignalTransition" since="4.6"> - <add-function signature="QSignalTransition(PyObject*,QState*)" return-type="QSignalTransition*"> - <modify-argument index="2"> - <replace-default-expression with="0"/> - </modify-argument> - <inject-code file="../glue/qtcore.cpp" snippet="qsignaltransition"/> - </add-function> - </object-type> - - <object-type name="QState" since="4.6"> - <enum-type name="ChildMode"/> - <enum-type name="RestorePolicy"/> - <modify-function signature="addTransition(QAbstractTransition*)"> - <modify-argument index="1"> - <parent index="this" action="add"/> - </modify-argument> - </modify-function> - - <modify-function signature="addTransition(const QObject*,const char*,QAbstractState*)"> - <modify-argument index="return"> - <parent index="this" action="add"/> - </modify-argument> - <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qstate-addtransition-1"/> - </modify-function> - <modify-function signature="addTransition(QAbstractState*)"> - <modify-argument index="1"> - <parent index="this" action="add"/> - </modify-argument> - </modify-function> - - <!-- FIXME: the proper signature for this added function would be something like - addTransition(PySide2.QtCore.Signal, QAbstractState*) - but that depends on bug #362. --> - <add-function signature="addTransition(PyObject*,QAbstractState*)" return-type="QSignalTransition*"> - <modify-argument index="return"> - <parent index="this" action="add"/> - </modify-argument> - <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qstate-addtransition-2"/> - </add-function> - - <modify-function signature="removeTransition(QAbstractTransition*)"> - <modify-argument index="1"> - <parent index="this" action="remove"/> - </modify-argument> - </modify-function> - </object-type> - - <object-type name="QStateMachine" since="4.6"> - <enum-type name="Error"/> - <enum-type name="EventPriority"/> - - <value-type name="SignalEvent" since="4.6"/> - <value-type name="WrappedEvent" since="4.6"/> - - <modify-function signature="addState(QAbstractState*)"> - <modify-argument index="1"> - <parent index="this" action="add"/> - </modify-argument> - </modify-function> - <modify-function signature="removeState(QAbstractState*)"> - <modify-argument index="1"> - <parent index="this" action="remove"/> - </modify-argument> - </modify-function> - - <add-function signature="configuration()" return-type="list of QAbstractState" > - <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qstatemachine-configuration"/> - </add-function> - - <!-- Replaced by a added function --> - <modify-function signature="defaultAnimations()const" remove="all"/> - <add-function signature="defaultAnimations()" return-type="list of QAbstractAnimation" > - <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qstatemachine-defaultanimations"/> - </add-function> - </object-type> - <object-type name="QVariantAnimation" since="4.6"/> <value-type name="QVersionNumber" since="5.6"> diff --git a/sources/pyside2/PySide2/QtGui/CMakeLists.txt b/sources/pyside2/PySide2/QtGui/CMakeLists.txt index 212038349..1faf93ced 100644 --- a/sources/pyside2/PySide2/QtGui/CMakeLists.txt +++ b/sources/pyside2/PySide2/QtGui/CMakeLists.txt @@ -8,6 +8,7 @@ get_property(QtGui_enabled_features TARGET Qt${QT_MAJOR_VERSION}::Gui PROPERTY QT_ENABLED_PUBLIC_FEATURES) set(QtGui_SRC +${QtGui_GEN_DIR}/qabstractfileiconprovider_wrapper.cpp ${QtGui_GEN_DIR}/qabstracttextdocumentlayout_paintcontext_wrapper.cpp ${QtGui_GEN_DIR}/qabstracttextdocumentlayout_selection_wrapper.cpp ${QtGui_GEN_DIR}/qabstracttextdocumentlayout_wrapper.cpp diff --git a/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml b/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml index 8136fb3ed..4abc1ccac 100644 --- a/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml +++ b/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml @@ -143,6 +143,11 @@ </conversion-rule> </primitive-type> + <object-type name="QAbstractFileIconProvider" since="6.0"> + <enum-type name="IconType"/> + <enum-type name="Option" flags="Options"/> + </object-type> + <value-type name="QAccessible"> <value-type name="State"/> <enum-type name="Event"/> diff --git a/sources/pyside2/PySide2/QtWidgets/CMakeLists.txt b/sources/pyside2/PySide2/QtWidgets/CMakeLists.txt index 5383d9410..3df3b8d19 100644 --- a/sources/pyside2/PySide2/QtWidgets/CMakeLists.txt +++ b/sources/pyside2/PySide2/QtWidgets/CMakeLists.txt @@ -88,7 +88,6 @@ ${QtWidgets_GEN_DIR}/qinputdialog_wrapper.cpp ${QtWidgets_GEN_DIR}/qitemdelegate_wrapper.cpp ${QtWidgets_GEN_DIR}/qitemeditorcreatorbase_wrapper.cpp ${QtWidgets_GEN_DIR}/qitemeditorfactory_wrapper.cpp -${QtWidgets_GEN_DIR}/qkeyeventtransition_wrapper.cpp ${QtWidgets_GEN_DIR}/qkeysequenceedit_wrapper.cpp ${QtWidgets_GEN_DIR}/qlabel_wrapper.cpp ${QtWidgets_GEN_DIR}/qlayout_wrapper.cpp @@ -104,7 +103,6 @@ ${QtWidgets_GEN_DIR}/qmdisubwindow_wrapper.cpp ${QtWidgets_GEN_DIR}/qmenu_wrapper.cpp ${QtWidgets_GEN_DIR}/qmenubar_wrapper.cpp ${QtWidgets_GEN_DIR}/qmessagebox_wrapper.cpp -${QtWidgets_GEN_DIR}/qmouseeventtransition_wrapper.cpp ${QtWidgets_GEN_DIR}/qpangesture_wrapper.cpp ${QtWidgets_GEN_DIR}/qpinchgesture_wrapper.cpp ${QtWidgets_GEN_DIR}/qplaintextdocumentlayout_wrapper.cpp diff --git a/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml b/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml index 79b824d5e..512f540f4 100644 --- a/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml +++ b/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml @@ -426,11 +426,6 @@ <reference-count action="set"/> </modify-argument> </modify-function> - <modify-function signature="viewOptions()const"> - <modify-argument index="return"> - <replace-default-expression with="QStyleOptionViewItem()"/> - </modify-argument> - </modify-function> <modify-function signature="model()const"> <modify-argument index="return"> <!-- Defining ownership as "default" avoids the object to be automatically @@ -512,10 +507,7 @@ </modify-argument> </modify-function> </object-type> - <object-type name="QFileIconProvider"> - <enum-type name="IconType"/> - <enum-type name="Option" flags="Options"/> - </object-type> + <object-type name="QFileIconProvider"/> <object-type name="QWizard"> <enum-type name="WizardButton"/> <enum-type name="WizardOption" flags="WizardOptions"/> @@ -2324,7 +2316,7 @@ <include file-name="QUrl" location="global"/> <include file-name="QAbstractProxyModel" location="global"/> </extra-includes> - <modify-function signature="setIconProvider(QFileIconProvider*)"> + <modify-function signature="setIconProvider(QAbstractFileIconProvider*)"> <modify-argument index="1"> <parent index="this" action="add"/> </modify-argument> @@ -2838,7 +2830,7 @@ <object-type name="QFileSystemModel" polymorphic-id-expression="qobject_cast<QFileSystemModel*>(%1)"> <enum-type name="Roles"/> <enum-type name="Option" flags="Options" since="5.14"/> - <modify-function signature="setIconProvider(QFileIconProvider*)"> + <modify-function signature="setIconProvider(QAbstractFileIconProvider*)"> <modify-argument index="1"> <parent index="this" action="add"/> </modify-argument> @@ -3269,8 +3261,6 @@ <object-type name="QGraphicsRotation" since="4.6"/> <object-type name="QGraphicsScale" since="4.6"/> <object-type name="QGraphicsTransform" since="4.6"/> - <object-type name="QKeyEventTransition" since="4.6"/> - <object-type name="QMouseEventTransition" since="4.6"/> <object-type name="QPanGesture" since="4.6"/> <object-type name="QPinchGesture" since="4.6"> <enum-type name="ChangeFlag" flags="ChangeFlags"/> diff --git a/sources/pyside2/PySide2/glue/qtcore.cpp b/sources/pyside2/PySide2/glue/qtcore.cpp index 8d25907d6..1dac1ec3a 100644 --- a/sources/pyside2/PySide2/glue/qtcore.cpp +++ b/sources/pyside2/PySide2/glue/qtcore.cpp @@ -148,7 +148,7 @@ static const char *QVariant_resolveMetaType(PyTypeObject *type, int *typeId) // Do not convert user type of value if (valueType && Shiboken::ObjectType::isUserType(type)) return nullptr; - int obTypeId = QMetaType::type(typeName); + int obTypeId = QMetaType::fromName(typeName).id(); if (obTypeId) { *typeId = obTypeId; return typeName; @@ -190,7 +190,7 @@ static QVariant QVariant_convertToValueList(PyObject *list) QByteArray listTypeName("QList<"); listTypeName += typeName; listTypeName += '>'; - typeId = QMetaType::type(listTypeName); + typeId = QMetaType::fromName(listTypeName).id(); if (typeId > 0) { Shiboken::Conversions::SpecificConverter converter(listTypeName); if (converter) { @@ -1820,15 +1820,18 @@ else if (Py_TYPE(%in) == SbkObjectType_TypeF()) typeName = Shiboken::ObjectType::getOriginalName((SbkObjectType *)%in); else typeName = reinterpret_cast<PyTypeObject *>(%in)->tp_name; -%out = QVariant::nameToType(typeName); +const int id = QMetaType::fromName(typeName).id(); +%out = QVariant::Type(id); // @snippet conversion-qvariant-pytypeobject // @snippet conversion-qvariant-pystring -%out = QVariant::nameToType(Shiboken::String::toCString(%in)); +const int id = QMetaType::fromName(Shiboken::String::toCString(%in)).id(); +%out = QVariant::Type(id); // @snippet conversion-qvariant-pystring // @snippet conversion-qvariant-pydict -%out = QVariant::nameToType("QVariantMap"); +const int id = QMetaType::fromName("QVariantMap").id(); +%out = QVariant::Type(id); // @snippet conversion-qvariant-pydict // @snippet conversion-qvariant-pysequence @@ -1951,7 +1954,7 @@ return 0; // @snippet return-qvariant // @snippet return-qvariant-type -const char *typeName = QVariant::typeToName(%in); +const char *typeName = QMetaType(%in).name(); PyObject *%out; PyTypeObject *pyType = nullptr; if (typeName) diff --git a/sources/pyside2/libpyside/pysidemetafunction.cpp b/sources/pyside2/libpyside/pysidemetafunction.cpp index 1096a84bb..0326e0f11 100644 --- a/sources/pyside2/libpyside/pysidemetafunction.cpp +++ b/sources/pyside2/libpyside/pysidemetafunction.cpp @@ -176,7 +176,7 @@ bool call(QObject *self, int methodIndex, PyObject *args, PyObject **retVal) Shiboken::Conversions::SpecificConverter converter(typeName); if (converter) { - int typeId = QMetaType::type(typeName); + int typeId = QMetaType::fromName(typeName).id(); if (!Shiboken::Conversions::pythonTypeIsObjectType(converter)) { if (!typeId) { PyErr_Format(PyExc_TypeError, "Value types used on meta functions (including signals) need to be " diff --git a/sources/pyside2/tests/QtCore/CMakeLists.txt b/sources/pyside2/tests/QtCore/CMakeLists.txt index 3af239c8c..5d661dc34 100644 --- a/sources/pyside2/tests/QtCore/CMakeLists.txt +++ b/sources/pyside2/tests/QtCore/CMakeLists.txt @@ -23,7 +23,6 @@ PYSIDE_TEST(bug_953.py) PYSIDE_TEST(bug_987.py) PYSIDE_TEST(bug_994.py) PYSIDE_TEST(bug_1019.py) -PYSIDE_TEST(bug_1031.py) PYSIDE_TEST(bug_1063.py) PYSIDE_TEST(bug_1069.py) PYSIDE_TEST(bug_1313.py) @@ -46,7 +45,6 @@ PYSIDE_TEST(multiple_feature_test.py) PYSIDE_TEST(python_conversion.py) PYSIDE_TEST(qabs_test.py) PYSIDE_TEST(qabstractitemmodel_test.py) -PYSIDE_TEST(qabstracttransition_test.py) PYSIDE_TEST(qanimationgroup_test.py) PYSIDE_TEST(qbitarray_test.py) PYSIDE_TEST(qbytearray_buffer_protocol_test.py) @@ -107,8 +105,6 @@ PYSIDE_TEST(qslot_object_test.py) PYSIDE_TEST(qsocketnotifier_test.py) PYSIDE_TEST(qsrand_test.py) PYSIDE_TEST(qstandardpaths_test.py) -PYSIDE_TEST(qstatemachine_test.py) -PYSIDE_TEST(qstate_test.py) PYSIDE_TEST(qstorageinfo_test.py) PYSIDE_TEST(qstring_test.py) PYSIDE_TEST(qsysinfo_test.py) diff --git a/sources/pyside2/tests/QtCore/bug_1031.py b/sources/pyside2/tests/QtCore/bug_1031.py deleted file mode 100644 index 6a7f248cc..000000000 --- a/sources/pyside2/tests/QtCore/bug_1031.py +++ /dev/null @@ -1,41 +0,0 @@ -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import os -import sys - -sys.path.append(os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "util")) -sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -from init_paths import init_test_paths -init_test_paths() - -from PySide2.QtCore import QStateMachine, QState - -mach = QStateMachine() -state = QState(mach) -print(state.machine()) diff --git a/sources/pyside2/tests/QtCore/qabstracttransition_test.py b/sources/pyside2/tests/QtCore/qabstracttransition_test.py deleted file mode 100644 index 063d266d2..000000000 --- a/sources/pyside2/tests/QtCore/qabstracttransition_test.py +++ /dev/null @@ -1,191 +0,0 @@ -#!/usr/bin/python - -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import os -import sys -from sys import getrefcount -import unittest - -sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -from init_paths import init_test_paths -init_test_paths(False) - -from PySide2.QtCore import * - -def addStates(transition): - sx = QState() - sy = QState() - transition.setTargetStates([sx, sy]) - -def addAnimation(transition): - animation = QParallelAnimationGroup() - transition.addAnimation(animation) - -class QAbstractTransitionTest(unittest.TestCase): - - def testBasic(self): - app = QCoreApplication([]) - - o = QObject() - o.setProperty("text", "INdT") - - machine = QStateMachine() - s1 = QState() - s1.assignProperty(o, "text", "Rocks") - - s2 = QFinalState() - t = s1.addTransition(o, SIGNAL("change()"), s2) - - self.assertEqual(t.targetStates(), [s2]) - - addStates(t) - self.assertEqual(len(t.targetStates()), 2) - - animation = QParallelAnimationGroup() - t.addAnimation(animation) - - self.assertEqual(t.animations(), [animation]) - - addAnimation(t) - self.assertEqual(t.animations()[0].parent(), None) - - machine.addState(s1) - machine.addState(s2) - machine.setInitialState(s1) - machine.start() - - QTimer.singleShot(100, app.quit) - app.exec_() - - def testRefCountOfTargetState(self): - transition = QEventTransition() - state1 = QState() - refcount1 = getrefcount(state1) - - transition.setTargetState(state1) - - self.assertEqual(transition.targetState(), state1) - self.assertEqual(getrefcount(transition.targetState()), refcount1 + 1) - - state2 = QState() - refcount2 = getrefcount(state2) - - transition.setTargetState(state2) - - self.assertEqual(transition.targetState(), state2) - self.assertEqual(getrefcount(transition.targetState()), refcount2 + 1) - self.assertEqual(getrefcount(state1), refcount1) - - del transition - - self.assertEqual(getrefcount(state2), refcount2) - - def testRefCountOfTargetStates(self): - transition = QEventTransition() - state1 = QState() - state2 = QState() - states = [state1, state2] - refcount1 = getrefcount(state1) - refcount2 = getrefcount(state2) - - transition.setTargetStates(states) - - self.assertEqual(transition.targetStates(), states) - self.assertEqual(transition.targetState(), state1) - self.assertEqual(getrefcount(transition.targetStates()[0]), refcount1 + 1) - self.assertEqual(getrefcount(transition.targetStates()[1]), refcount2 + 1) - - del states - del transition - - self.assertEqual(getrefcount(state1), refcount1 - 1) - self.assertEqual(getrefcount(state2), refcount2 - 1) - - def testRefCountOfTargetStatesAfterSingleTargetState(self): - transition = QEventTransition() - state0 = QState() - refcount0 = getrefcount(state0) - - transition.setTargetState(state0) - - self.assertEqual(transition.targetState(), state0) - self.assertEqual(getrefcount(transition.targetState()), refcount0 + 1) - - state1 = QState() - state2 = QState() - states = [state1, state2] - refcount1 = getrefcount(state1) - refcount2 = getrefcount(state2) - - transition.setTargetStates(states) - - self.assertEqual(getrefcount(state0), refcount0) - self.assertEqual(transition.targetStates(), states) - self.assertEqual(transition.targetState(), state1) - self.assertEqual(getrefcount(transition.targetStates()[0]), refcount1 + 1) - self.assertEqual(getrefcount(transition.targetStates()[1]), refcount2 + 1) - - del states - del transition - - self.assertEqual(getrefcount(state1), refcount1 - 1) - self.assertEqual(getrefcount(state2), refcount2 - 1) - - def testRefCountOfTargetStatesBeforeSingleTargetState(self): - transition = QEventTransition() - state1 = QState() - state2 = QState() - states = [state1, state2] - refcount1 = getrefcount(state1) - refcount2 = getrefcount(state2) - - transition.setTargetStates(states) - - self.assertEqual(transition.targetStates(), states) - self.assertEqual(transition.targetState(), state1) - self.assertEqual(getrefcount(transition.targetStates()[0]), refcount1 + 1) - self.assertEqual(getrefcount(transition.targetStates()[1]), refcount2 + 1) - - state3 = QState() - refcount3 = getrefcount(state3) - - transition.setTargetState(state3) - - self.assertEqual(transition.targetState(), state3) - self.assertEqual(getrefcount(transition.targetState()), refcount3 + 1) - - del states - - self.assertEqual(getrefcount(state1), refcount1 - 1) - self.assertEqual(getrefcount(state2), refcount2 - 1) - -if __name__ == '__main__': - unittest.main() - diff --git a/sources/pyside2/tests/QtCore/qbytearray_test.py b/sources/pyside2/tests/QtCore/qbytearray_test.py index c17b7efb1..5202569f1 100644 --- a/sources/pyside2/tests/QtCore/qbytearray_test.py +++ b/sources/pyside2/tests/QtCore/qbytearray_test.py @@ -165,12 +165,6 @@ class TestBug567(unittest.TestCase): self.assertEqual(ba[::-2], '08642') self.assertEqual(ba[2:8:3], '36') -class QByteArrayBug514(unittest.TestCase): - def testIt(self): - data = py3k.b("foobar") - a = QByteArray.fromRawData(data) - self.assertEqual(type(a), QByteArray) - self.assertEqual(a.data(), data) class TestPickler(unittest.TestCase): def testIt(self): diff --git a/sources/pyside2/tests/QtCore/qstate_test.py b/sources/pyside2/tests/QtCore/qstate_test.py deleted file mode 100644 index 4c97fecca..000000000 --- a/sources/pyside2/tests/QtCore/qstate_test.py +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/python - -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import os -import sys -import unittest - -sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -from init_paths import init_test_paths -init_test_paths(False) - -from PySide2.QtCore import * - - -class QStateTest(unittest.TestCase): - def testBasic(self): - app = QCoreApplication([]) - - o = QObject() - o.setProperty("text", "INdT") - - machine = QStateMachine() - s1 = QState() - s1.assignProperty(o, "text", "Rocks"); - - s2 = QFinalState() - t = s1.addTransition(o, SIGNAL("change()"), s2); - self.assertTrue(isinstance(t, QSignalTransition)) - - machine.addState(s1) - machine.addState(s2) - machine.setInitialState(s1) - machine.start() - - o.emit(SIGNAL("change()")) - - QTimer.singleShot(100, app.quit) - app.exec_() - - txt = o.property("text") - self.assertTrue(txt, "Rocks") - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtCore/qstatemachine_test.py b/sources/pyside2/tests/QtCore/qstatemachine_test.py deleted file mode 100644 index 19dcb1e81..000000000 --- a/sources/pyside2/tests/QtCore/qstatemachine_test.py +++ /dev/null @@ -1,104 +0,0 @@ -#!/usr/bin/python - -############################################################################# -## -## Copyright (C) 2016 The Qt Company Ltd. -## Contact: https://www.qt.io/licensing/ -## -## This file is part of the test suite of Qt for Python. -## -## $QT_BEGIN_LICENSE:GPL-EXCEPT$ -## Commercial License Usage -## Licensees holding valid commercial Qt licenses may use this file in -## accordance with the commercial license agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and The Qt Company. For licensing terms -## and conditions see https://www.qt.io/terms-conditions. For further -## information use the contact form at https://www.qt.io/contact-us. -## -## GNU General Public License Usage -## Alternatively, this file may be used under the terms of the GNU -## General Public License version 3 as published by the Free Software -## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -## included in the packaging of this file. Please review the following -## information to ensure the GNU General Public License requirements will -## be met: https://www.gnu.org/licenses/gpl-3.0.html. -## -## $QT_END_LICENSE$ -## -############################################################################# - -import os -import sys -import unittest - -sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -from init_paths import init_test_paths -init_test_paths(False) - -from PySide2.QtCore import QObject, QState, QFinalState, SIGNAL -from PySide2.QtCore import QTimer, QStateMachine -from PySide2.QtCore import QParallelAnimationGroup - -from helper.usesqcoreapplication import UsesQCoreApplication - - -class StateMachineTest(unittest.TestCase): - '''Check presence of State Machine classes''' - - def testBasic(self): - '''State machine classes''' - import PySide2.QtCore - PySide2.QtCore.QSignalTransition - PySide2.QtCore.QPropertyAnimation - - - -class QStateMachineTest(UsesQCoreApplication): - - def cb(self, *args): - self.assertEqual(self.machine.defaultAnimations(), [self.anim]) - - def testBasic(self): - self.machine = QStateMachine() - s1 = QState() - s2 = QState() - s3 = QFinalState() - - QObject.connect(self.machine, SIGNAL("started()"), self.cb) - - self.anim = QParallelAnimationGroup() - - self.machine.addState(s1) - self.machine.addState(s2) - self.machine.addState(s3) - self.machine.setInitialState(s1) - self.machine.addDefaultAnimation(self.anim) - self.machine.start() - - QTimer.singleShot(100, self.app.quit) - self.app.exec_() - - -class QSetConverterTest(UsesQCoreApplication): - '''Test converter of QSet toPython using QStateAnimation.configuration''' - - def testBasic(self): - '''QStateMachine.configuration converting QSet to python set''' - machine = QStateMachine() - s1 = QState() - machine.addState(s1) - machine.setInitialState(s1) - machine.start() - - QTimer.singleShot(100, self.app.quit) - self.app.exec_() - - configuration = machine.configuration() - - self.assertTrue(isinstance(configuration, set)) - self.assertTrue(s1 in configuration) - - -if __name__ == '__main__': - unittest.main() diff --git a/sources/pyside2/tests/QtCore/setprop_on_ctor_test.py b/sources/pyside2/tests/QtCore/setprop_on_ctor_test.py index e149f8ffb..2d208cb69 100644 --- a/sources/pyside2/tests/QtCore/setprop_on_ctor_test.py +++ b/sources/pyside2/tests/QtCore/setprop_on_ctor_test.py @@ -36,13 +36,13 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from init_paths import init_test_paths init_test_paths(False) -from PySide2.QtCore import * +from PySide2.QtCore import QTimer class SetPropOnCtorTest(unittest.TestCase): def testIt(self): - obj = QEventTransition(targetStates = [QState()]) - self.assertEqual(len(obj.targetStates()), 1); + timer = QTimer(interval = 42) + self.assertEqual(timer.interval(), 42); if __name__ == '__main__': unittest.main() diff --git a/sources/pyside2/tests/support/voidptr_test.py b/sources/pyside2/tests/support/voidptr_test.py index 9e3668eb1..367d250da 100644 --- a/sources/pyside2/tests/support/voidptr_test.py +++ b/sources/pyside2/tests/support/voidptr_test.py @@ -53,7 +53,7 @@ class PySide2Support(unittest.TestCase): self.assertIsInstance(vp, shiboken.VoidPtr) # Create QByteArray from voidptr byte interpretation - nba = QByteArray.fromRawData(vp.toBytes()) + nba = QByteArray(vp.toBytes()) # Compare original bytes to toBytes() self.assertTrue(b, vp.toBytes()) # Compare original with new QByteArray data diff --git a/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/mapping.py b/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/mapping.py index 24107cfed..c39ceeb67 100644 --- a/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/mapping.py +++ b/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/mapping.py @@ -450,7 +450,6 @@ def init_PySide2_QtCore(): "DescriptorType(-1)": int, # Native handle of QSocketDescriptor "false": False, "list of QAbstractAnimation": typing.List[PySide2.QtCore.QAbstractAnimation], - "list of QAbstractState": typing.List[PySide2.QtCore.QAbstractState], "long long": int, "NULL": None, # 5.6, MSVC "nullptr": None, # 5.9 |