diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-11-04 12:34:17 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-11-04 12:42:35 +0100 |
commit | 1704567d7ad0d21dd3b588af7aad40cd244c1799 (patch) | |
tree | 932b42988e482f01125dcbf4d470e9a56107689a /sources/pyside2/PySide2 | |
parent | 1d77cd18510412242384c5b37a00efd5b6ce8a26 (diff) | |
parent | c98ef56544cd54661b61529829caf6a799a1a94f (diff) |
Merge "Merge remote-tracking branch 'origin/5.14' into 5.15"
Diffstat (limited to 'sources/pyside2/PySide2')
24 files changed, 225 insertions, 93 deletions
diff --git a/sources/pyside2/PySide2/Qt3DAnimation/CMakeLists.txt b/sources/pyside2/PySide2/Qt3DAnimation/CMakeLists.txt index 5875854d8..6d90f76e8 100644 --- a/sources/pyside2/PySide2/Qt3DAnimation/CMakeLists.txt +++ b/sources/pyside2/PySide2/Qt3DAnimation/CMakeLists.txt @@ -4,6 +4,7 @@ set(Qt3DAnimation_SRC ${Qt3DAnimation_GEN_DIR}/qt3danimation_wrapper.cpp ${Qt3DAnimation_GEN_DIR}/qt3danimation_qabstractanimation_wrapper.cpp ${Qt3DAnimation_GEN_DIR}/qt3danimation_qabstractanimationclip_wrapper.cpp +${Qt3DAnimation_GEN_DIR}/qt3danimation_qabstractchannelmapping_wrapper.cpp ${Qt3DAnimation_GEN_DIR}/qt3danimation_qabstractclipanimator_wrapper.cpp ${Qt3DAnimation_GEN_DIR}/qt3danimation_qabstractclipblendnode_wrapper.cpp ${Qt3DAnimation_GEN_DIR}/qt3danimation_qadditiveclipblend_wrapper.cpp diff --git a/sources/pyside2/PySide2/Qt3DAnimation/typesystem_3danimation.xml b/sources/pyside2/PySide2/Qt3DAnimation/typesystem_3danimation.xml index bba179e00..7f24234c5 100644 --- a/sources/pyside2/PySide2/Qt3DAnimation/typesystem_3danimation.xml +++ b/sources/pyside2/PySide2/Qt3DAnimation/typesystem_3danimation.xml @@ -47,6 +47,7 @@ <enum-type name="AnimationType"/> </object-type> <object-type name="QAbstractAnimationClip"/> + <object-type name="QAbstractChannelMapping"/> <object-type name="QAbstractClipAnimator"> <enum-type name="Loops"/> </object-type> diff --git a/sources/pyside2/PySide2/Qt3DCore/typesystem_3dcore.xml b/sources/pyside2/PySide2/Qt3DCore/typesystem_3dcore.xml index b7369f4a1..7d64fba55 100644 --- a/sources/pyside2/PySide2/Qt3DCore/typesystem_3dcore.xml +++ b/sources/pyside2/PySide2/Qt3DCore/typesystem_3dcore.xml @@ -48,6 +48,7 @@ <object-type name="QAbstractSkeleton" since="5.10"/> <object-type name="QArmature" since="5.10"/> <object-type name="QAspectEngine"> + <enum-type name="RunMode" since="5.14"/> <modify-function signature="registerAspect(Qt3DCore::QAbstractAspect*)"> <modify-argument index="this"> <parent index="1" action="add"/> diff --git a/sources/pyside2/PySide2/Qt3DInput/typesystem_3dinput.xml b/sources/pyside2/PySide2/Qt3DInput/typesystem_3dinput.xml index 1c7e1109b..a74c3ab93 100644 --- a/sources/pyside2/PySide2/Qt3DInput/typesystem_3dinput.xml +++ b/sources/pyside2/PySide2/Qt3DInput/typesystem_3dinput.xml @@ -73,11 +73,11 @@ </object-type> <object-type name="QMouseEvent"> <enum-type name="Buttons"/> - <enum-type name="Modifier" flags="Modifiers" since="5.14"/> + <enum-type name="Modifiers"/> </object-type> <object-type name="QWheelEvent"> <enum-type name="Buttons"/> - <enum-type name="Modifier" flags="Modifiers" since="5.14"/> + <enum-type name="Modifiers"/> </object-type> <object-type name="QMouseHandler"/> <!-- On windows this raise the following error: diff --git a/sources/pyside2/PySide2/Qt3DRender/CMakeLists.txt b/sources/pyside2/PySide2/Qt3DRender/CMakeLists.txt index 73c0c5ba6..edd023840 100644 --- a/sources/pyside2/PySide2/Qt3DRender/CMakeLists.txt +++ b/sources/pyside2/PySide2/Qt3DRender/CMakeLists.txt @@ -132,6 +132,12 @@ if (Qt53DRender_VERSION VERSION_EQUAL 5.13.0 OR Qt53DRender_VERSION VERSION_GREA ${Qt3DRender_GEN_DIR}/qt3drender_qwaitfence_wrapper.cpp) endif() +if (Qt53DRender_VERSION VERSION_EQUAL 5.14.0 OR Qt53DRender_VERSION VERSION_GREATER 5.14.0) + list(APPEND Qt3DRender_SRC + ${Qt3DRender_GEN_DIR}/qt3drender_qnopicking_wrapper.cpp + ${Qt3DRender_GEN_DIR}/qt3drender_qshaderimage_wrapper.cpp) +endif() + set(Qt3DRender_include_dirs ${Qt3DRender_SOURCE_DIR} ${Qt3DRender_BINARY_DIR} diff --git a/sources/pyside2/PySide2/Qt3DRender/typesystem_3drender.xml b/sources/pyside2/PySide2/Qt3DRender/typesystem_3drender.xml index be06a3135..477dc605d 100644 --- a/sources/pyside2/PySide2/Qt3DRender/typesystem_3drender.xml +++ b/sources/pyside2/PySide2/Qt3DRender/typesystem_3drender.xml @@ -155,6 +155,7 @@ <object-type name="QMultiSampleAntiAliasing"/> <object-type name="QNoDepthMask"/> <object-type name="QNoDraw"/> + <object-type name="QNoPicking" since="5.14"/> <object-type name="QObjectPicker"/> <object-type name="QPaintedTextureImage"/> <object-type name="QParameter"/> @@ -213,6 +214,10 @@ <enum-type name="ShaderType"/> <enum-type name="Status"/> </object-type> + <object-type name="QShaderImage" since="5.14"> + <enum-type name="Access"/> + <enum-type name="ImageFormat"/> + </object-type> <object-type name="QShaderProgramBuilder" since="5.10"/> <object-type name="QSharedGLTexture" since="5.13"/> <object-type name="QSortPolicy"> diff --git a/sources/pyside2/PySide2/QtCore/CMakeLists.txt b/sources/pyside2/PySide2/QtCore/CMakeLists.txt index c385803a7..8e9337157 100644 --- a/sources/pyside2/PySide2/QtCore/CMakeLists.txt +++ b/sources/pyside2/PySide2/QtCore/CMakeLists.txt @@ -186,6 +186,13 @@ if (Qt5Core_VERSION VERSION_EQUAL 5.13.0 OR Qt5Core_VERSION VERSION_GREATER 5.13 ${QtCore_GEN_DIR}/qtransposeproxymodel_wrapper.cpp) endif() +if (Qt5Core_VERSION VERSION_EQUAL 5.14.0 OR Qt5Core_VERSION VERSION_GREATER 5.14.0) + list(APPEND QtCore_SRC + ${QtCore_GEN_DIR}/qcalendar_wrapper.cpp + ${QtCore_GEN_DIR}/qcalendar_yearmonthday_wrapper.cpp + ${QtCore_GEN_DIR}/qrecursivemutex_wrapper.cpp) +endif() + set(QtCore_glue_sources "${QtCore_SOURCE_DIR}/glue/qeasingcurve_glue.cpp" "${QtCore_SOURCE_DIR}/glue/qeasingcurve_glue.h" diff --git a/sources/pyside2/PySide2/QtCore/glue/qeasingcurve_glue.cpp b/sources/pyside2/PySide2/QtCore/glue/qeasingcurve_glue.cpp index 6629d3c91..552191955 100644 --- a/sources/pyside2/PySide2/QtCore/glue/qeasingcurve_glue.cpp +++ b/sources/pyside2/PySide2/QtCore/glue/qeasingcurve_glue.cpp @@ -44,7 +44,6 @@ #include "glue/qeasingcurve_glue.h" -#define __ECF_ATT_NAME__ "__ecf__" #define MAX_CUSTOM_FUNCTIONS 10 static void deleteData(void *data); @@ -122,7 +121,7 @@ PySideEasingCurveFunctor::~PySideEasingCurveFunctor() { CustomFunctionsData::m_list[m_index].m_obj = 0; - PyObject_SetAttrString(m_parent, __ECF_ATT_NAME__, Py_None); + PyObject_SetAttr(m_parent, Shiboken::PyMagicName::ecf(), Py_None); } qreal PySideEasingCurveFunctor::operator()(qreal progress) @@ -147,13 +146,13 @@ PyObject *PySideEasingCurveFunctor::callable() PyObject *PySideEasingCurveFunctor::callable(PyObject *parent) { - return PyObject_GetAttrString(parent, __ECF_ATT_NAME__); + return PyObject_GetAttr(parent, Shiboken::PyMagicName::ecf()); } PySideEasingCurveFunctor::PySideEasingCurveFunctor(int index, PyObject *parent, PyObject *pyFunc) : m_parent(parent), m_func(pyFunc), m_index(index) { - PyObject_SetAttrString(m_parent, __ECF_ATT_NAME__, m_func); + PyObject_SetAttr(m_parent, Shiboken::PyMagicName::ecf(), m_func); PySide::WeakRef::create(m_parent, deleteData, this); } diff --git a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml index eb4e502ea..470e253b1 100644 --- a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml +++ b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml @@ -599,6 +599,7 @@ <enum-type name="GestureState" since="4.6"/> <enum-type name="GestureType" since="4.6"/> <enum-type name="GlobalColor"/> + <enum-type name="HighDpiScaleFactorRoundingPolicy" since="5.14"/> <enum-type name="HitTestAccuracy"/> <enum-type name="ImageConversionFlag" flags="ImageConversionFlags"/> <enum-type name="InputMethodHint" flags="InputMethodHints" since="4.6"/> @@ -630,6 +631,7 @@ <enum-type name="SizeHint"/> <enum-type name="SizeMode"/> <enum-type name="SortOrder"/> + <enum-type name="SplitBehaviorFlags" flags="SplitBehavior" since="5.14"/> <enum-type name="TabFocusBehavior" since="5.5"/> <enum-type name="TextElideMode"/> <enum-type name="TextFlag"/> @@ -785,6 +787,10 @@ <value-type name="QBasicTimer"/> <value-type name="QByteArrayMatcher"/> + <value-type name="QCalendar" since="5.14"> + <value-type name="YearMonthDay"/> + <enum-type name="System"/> + </value-type> <value-type name="QDate" hash-function="PySide::hash" > <inject-code class="native" position="beginning"> <insert-template name="pydatetime_importandcheck_function"> @@ -847,6 +853,7 @@ </modify-function> </value-type> <value-type name="QDateTime" hash-function="PySide::hash"> + <enum-type name="YearRange" since="5.14"/> <inject-code class="native" position="beginning"> <insert-template name="pydatetime_importandcheck_function"> <replace from="$DATETIMETYPE" to="PyDateTime"/> @@ -2296,6 +2303,7 @@ <modify-function signature="lock()" allow-thread="yes"/> <modify-function signature="tryLock(int)" allow-thread="yes"/> </object-type> + <object-type name="QRecursiveMutex" since="5.14"/> <object-type name="QRandomGenerator" since="5.10"> <modify-function signature="global()" rename="global_" allow-thread="yes"/> <modify-function signature="operator()()" remove="all"/> @@ -2546,12 +2554,6 @@ <include file-name="QtCore/QtCore" location="global"/> </extra-includes> - <modify-function signature="setDevice(QIODevice*)"> - <modify-argument index="1"> - <parent index="this" action="add"/> - </modify-argument> - </modify-function> - <!-- ### Replaced by write<TYPE> methods --> <modify-function signature="operator>>(qint8&)" remove="all"/> <modify-function signature="operator>>(bool&)" remove="all"/> @@ -2828,9 +2830,7 @@ <include file-name="qobjectdefs.h" location="global"/> </value-type> - <object-type name="QMessageLogContext"> - <modify-function signature="copy(const QMessageLogContext &)" remove="all"/> - </object-type> + <object-type name="QMessageLogContext"/> <value-type name="QMetaMethod"> <enum-type name="Access"/> @@ -2844,9 +2844,9 @@ <include file-name="qobjectdefs.h" location="global"/> <!-- This isn't part of Qt public API --> <modify-function signature="connect(const QObject*,int,const QObject*,int,int,int*)" remove="all"/> - </object-type> - <object-type name="QMetaObject::Connection"> - <include file-name="qobjectdefs.h" location="global"/> + <object-type name="Connection"> + <include file-name="qobjectdefs.h" location="global"/> + </object-type> </object-type> <value-type name="QMetaProperty" > <!-- This isn't part of Qt public API --> diff --git a/sources/pyside2/PySide2/QtGui/CMakeLists.txt b/sources/pyside2/PySide2/QtGui/CMakeLists.txt index 18d80f647..9e6bd099f 100644 --- a/sources/pyside2/PySide2/QtGui/CMakeLists.txt +++ b/sources/pyside2/PySide2/QtGui/CMakeLists.txt @@ -210,6 +210,10 @@ ${QtGui_GEN_DIR}/qwindowstatechangeevent_wrapper.cpp ${QtGui_GEN_DIR}/qtgui_module_wrapper.cpp ) +if (Qt5Gui_VERSION VERSION_EQUAL 5.14.0 OR Qt5Gui_VERSION VERSION_GREATER 5.14.0) + list(APPEND QtGui_SRC ${QtGui_GEN_DIR}/qcolorspace_wrapper.cpp) +endif() + # cf qtbase/src/gui/opengl/opengl.pri list(FIND QtGui_enabled_features "opengles2" _opengles2Index) # ### fixme: For cmake >= 3.3: if(opengles2 IN_LIST QtGui_enabled_features) diff --git a/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml b/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml index ab40e3953..b1090b651 100644 --- a/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml +++ b/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml @@ -480,6 +480,7 @@ </value-type> <value-type name="QTextBlockFormat"> <enum-type name="LineHeightTypes" since="4.8" revision="4800"/> + <enum-type name="MarkerType" since="5.14"/> </value-type> <value-type name="QTextTableCellFormat"/> <value-type name="QTextCharFormat" > @@ -1094,6 +1095,13 @@ </inject-code> </modify-function> </value-type> + + <value-type name="QColorSpace" since="5.14"> + <enum-type name="NamedColorSpace"/> + <enum-type name="Primaries"/> + <enum-type name="TransferFunction"/> + </value-type> + <value-type name="QFontMetricsF" > <modify-function signature="boundingRect(QChar)const" rename="boundingRectChar"> @@ -1749,6 +1757,7 @@ <include file-name="QTextCursor" location="global"/> </extra-includes> <enum-type name="FindFlag" flags="FindFlags"/> + <enum-type name="MarkdownFeature" flags="MarkdownFeatures" since="5.14"/> <enum-type name="MetaInformation"/> <enum-type name="ResourceType"/> <enum-type name="Stacks" since="4.7"/> diff --git a/sources/pyside2/PySide2/QtMultimedia/CMakeLists.txt b/sources/pyside2/PySide2/QtMultimedia/CMakeLists.txt index 4e7642d3a..cbdd9a1c2 100644 --- a/sources/pyside2/PySide2/QtMultimedia/CMakeLists.txt +++ b/sources/pyside2/PySide2/QtMultimedia/CMakeLists.txt @@ -26,16 +26,16 @@ ${QtMultimedia_GEN_DIR}/qcameracapturebufferformatcontrol_wrapper.cpp ${QtMultimedia_GEN_DIR}/qcameracapturedestinationcontrol_wrapper.cpp ${QtMultimedia_GEN_DIR}/qcameracontrol_wrapper.cpp ${QtMultimedia_GEN_DIR}/qcameraexposurecontrol_wrapper.cpp -# Private destructor: ${QtMultimedia_GEN_DIR}/qcameraexposure_wrapper.cpp +${QtMultimedia_GEN_DIR}/qcameraexposure_wrapper.cpp ${QtMultimedia_GEN_DIR}/qcamerafeedbackcontrol_wrapper.cpp -# Private destructor: ${${QtMultimedia_GEN_DIR}/qcamerafocus_wrapper.cpp -# needs enums from QCameraFocus ${QtMultimedia_GEN_DIR}/qcameraflashcontrol_wrapper.cpp -# needs enums from QCameraFocus ${QtMultimedia_GEN_DIR}/qcamerafocuscontrol_wrapper.cpp +${QtMultimedia_GEN_DIR}/qcamerafocus_wrapper.cpp +${QtMultimedia_GEN_DIR}/qcameraflashcontrol_wrapper.cpp +${QtMultimedia_GEN_DIR}/qcamerafocuscontrol_wrapper.cpp ${QtMultimedia_GEN_DIR}/qcamerafocuszone_wrapper.cpp ${QtMultimedia_GEN_DIR}/qcamera_frameraterange_wrapper.cpp ${QtMultimedia_GEN_DIR}/qcameraimagecapturecontrol_wrapper.cpp ${QtMultimedia_GEN_DIR}/qcameraimagecapture_wrapper.cpp -# Private destructor: ${QtMultimedia_GEN_DIR}/qcameraimageprocessing_wrapper.cpp +${QtMultimedia_GEN_DIR}/qcameraimageprocessing_wrapper.cpp ${QtMultimedia_GEN_DIR}/qcameraimageprocessingcontrol_wrapper.cpp ${QtMultimedia_GEN_DIR}/qcamerainfocontrol_wrapper.cpp ${QtMultimedia_GEN_DIR}/qcamerainfo_wrapper.cpp diff --git a/sources/pyside2/PySide2/QtMultimedia/typesystem_multimedia_common.xml b/sources/pyside2/PySide2/QtMultimedia/typesystem_multimedia_common.xml index f7ac67857..0c1012136 100644 --- a/sources/pyside2/PySide2/QtMultimedia/typesystem_multimedia_common.xml +++ b/sources/pyside2/PySide2/QtMultimedia/typesystem_multimedia_common.xml @@ -82,10 +82,19 @@ <object-type name="QAbstractVideoSurface"> <enum-type name="Error"/> </object-type> - <object-type name="QAbstractVideoFilter"/> + <object-type name="QAbstractVideoFilter"> + <modify-function signature="createFilterRunnable()"> + <modify-argument index="return"> + <define-ownership class="native" owner="c++"/> + </modify-argument> + </modify-function> + </object-type> <value-type name="QVideoFrame"> <enum-type name="FieldType"/> <enum-type name="PixelFormat"/> + <modify-function signature="bits()"> + <inject-code file="../glue/qtmultimedia.cpp" snippet="qvideoframe-bits"/> + </modify-function> <modify-function signature="bits(int)" remove="all"/> <modify-function signature="bits(int)const" remove="all"/> </value-type> @@ -193,7 +202,6 @@ <object-type name="QCameraControl"> <enum-type name="PropertyChangeType"/> </object-type> - <!-- Private destructor <object-type name="QCameraExposure"> <enum-type name="FlashMode" flags="FlashModes"/> <enum-type name="ExposureMode"/> @@ -202,7 +210,6 @@ <modify-function signature="supportedIsoSensitivities(bool*)const" remove="all"/> <modify-function signature="supportedShutterSpeeds(bool*)const" remove="all"/> </object-type> - --> <object-type name="QCameraExposureControl"> <enum-type name="ExposureParameter"/> <modify-function signature="supportedParameterRange(QCameraExposureControl::ExposureParameter,bool*)const" remove="all"/> @@ -213,14 +220,12 @@ <value-type name="QCameraFocusZone"> <enum-type name="FocusZoneStatus"/> </value-type> - <!-- Private destructor <object-type name="QCameraFocus"> <enum-type name="FocusMode" flags="FocusModes"/> <enum-type name="FocusPointMode"/> </object-type> - <object-type name="QCameraFlashControl"/> needs enums from QCameraFocus + <object-type name="QCameraFlashControl"/> <object-type name="QCameraFocusControl"/> - --> <value-type name="QCameraInfo"/> <object-type name="QCameraInfoControl"/> <object-type name="QCameraImageCapture"> @@ -230,12 +235,10 @@ <modify-function signature="supportedResolutions(const QImageEncoderSettings &,bool*)const" remove="all"/> </object-type> <object-type name="QCameraImageCaptureControl"/> - <!-- Private destructor <object-type name="QCameraImageProcessing"> <enum-type name="WhiteBalanceMode"/> <enum-type name="ColorFilter"/> </object-type> - --> <object-type name="QCameraImageProcessingControl"> <enum-type name="ProcessingParameter"/> </object-type> diff --git a/sources/pyside2/PySide2/QtNetwork/CMakeLists.txt b/sources/pyside2/PySide2/QtNetwork/CMakeLists.txt index 488f79757..7ca3fbb53 100644 --- a/sources/pyside2/PySide2/QtNetwork/CMakeLists.txt +++ b/sources/pyside2/PySide2/QtNetwork/CMakeLists.txt @@ -38,6 +38,8 @@ ${QtNetwork_GEN_DIR}/qnetworkrequest_wrapper.cpp ${QtNetwork_GEN_DIR}/qnetworksession_wrapper.cpp ${QtNetwork_GEN_DIR}/qpassworddigestor_wrapper.cpp ${QtNetwork_GEN_DIR}/qssl_wrapper.cpp +${QtNetwork_GEN_DIR}/qsslcertificate_wrapper.cpp +${QtNetwork_GEN_DIR}/qsslcertificateextension_wrapper.cpp ${QtNetwork_GEN_DIR}/qtcpserver_wrapper.cpp ${QtNetwork_GEN_DIR}/qtcpsocket_wrapper.cpp ${QtNetwork_GEN_DIR}/qudpsocket_wrapper.cpp @@ -54,16 +56,14 @@ list(FIND QtNetwork_disabled_features "dtls" _dtlsDisabledIndex) list(FIND QtNetwork_disabled_features "sctp" _sctpDisabledIndex) if(_sslEnabledIndex EQUAL -1) - list(APPEND QtNetwork_DROPPED_ENTRIES QOcspResponse QSslCertificate QSslCertificateExtension - QSslCipher QSslConfiguration QSslDiffieHellmanParameters QSslError + list(APPEND QtNetwork_DROPPED_ENTRIES QOcspResponse QSslCipher + QSslConfiguration QSslDiffieHellmanParameters QSslError QSslKey QSslPreSharedKeyAuthenticator QSslSocket) message(STATUS "Qt5Network: Dropping SSL classes") else() # Problems with operator==(QSslEllipticCurve,QSslEllipticCurve) # check_qt_class(QtNetwork QSslEllipticCurve QtNetwork_OPTIONAL_SRC QtNetwork_DROPPED_ENTRIES) list(APPEND QtNetwork_SRC - ${QtNetwork_GEN_DIR}/qsslcertificate_wrapper.cpp - ${QtNetwork_GEN_DIR}/qsslcertificateextension_wrapper.cpp ${QtNetwork_GEN_DIR}/qsslcipher_wrapper.cpp ${QtNetwork_GEN_DIR}/qsslconfiguration_wrapper.cpp ${QtNetwork_GEN_DIR}/qssldiffiehellmanparameters_wrapper.cpp diff --git a/sources/pyside2/PySide2/QtQml/pysideqmlregistertype.cpp b/sources/pyside2/PySide2/QtQml/pysideqmlregistertype.cpp index 2386620ca..6427e5198 100644 --- a/sources/pyside2/PySide2/QtQml/pysideqmlregistertype.cpp +++ b/sources/pyside2/PySide2/QtQml/pysideqmlregistertype.cpp @@ -41,6 +41,7 @@ // shiboken #include <shiboken.h> +#include <signature.h> // pyside #include <pyside.h> @@ -215,13 +216,13 @@ static int propListTpInit(PyObject *self, PyObject *args, PyObject *kwds) &data->at, &data->clear, &data->count)) { - return 0; + return -1; } PySide::Property::setMetaCallHandler(pySelf, &propListMetaCall); PySide::Property::setTypeName(pySelf, "QQmlListProperty<QObject>"); PySide::Property::setUserData(pySelf, data); - return 1; + return 0; } void propListTpFree(void *self) @@ -469,12 +470,22 @@ PyTypeObject *QtQml_VolatileBoolTypeF(void) return type; } +static const char *PropertyList_SignatureStrings[] = { + "PySide2.QtQml.ListProperty(type:type,append:typing.Callable," + "at:typing.Callable=None,clear:typing.Callable=None,count:typing.Callable=None)", + nullptr}; // Sentinel + +static const char *VolatileBool_SignatureStrings[] = { + "PySide2.QtQml.VolatileBool.get()->bool", + "PySide2.QtQml.VolatileBool.set(a:object)", + nullptr}; // Sentinel + void PySide::initQmlSupport(PyObject *module) { ElementFactory<PYSIDE_MAX_QML_TYPES - 1>::init(); // Export QmlListProperty type - if (PyType_Ready(PropertyListTypeF()) < 0) { + if (SbkSpecial_Type_Ready(module, PropertyListTypeF(), PropertyList_SignatureStrings) < 0) { PyErr_Print(); qWarning() << "Error initializing PropertyList type."; return; @@ -484,7 +495,7 @@ void PySide::initQmlSupport(PyObject *module) PyModule_AddObject(module, PepType_GetNameStr(PropertyListTypeF()), reinterpret_cast<PyObject *>(PropertyListTypeF())); - if (PyType_Ready(QtQml_VolatileBoolTypeF()) < 0) { + if (SbkSpecial_Type_Ready(module, QtQml_VolatileBoolTypeF(), VolatileBool_SignatureStrings) < 0) { PyErr_Print(); qWarning() << "Error initializing VolatileBool type."; return; diff --git a/sources/pyside2/PySide2/QtQuick/typesystem_quick.xml b/sources/pyside2/PySide2/QtQuick/typesystem_quick.xml index 64b4e8412..7a18dac54 100644 --- a/sources/pyside2/PySide2/QtQuick/typesystem_quick.xml +++ b/sources/pyside2/PySide2/QtQuick/typesystem_quick.xml @@ -100,6 +100,7 @@ <object-type name="QQuickWindow"> <enum-type name="CreateTextureOption" flags="CreateTextureOptions"/> + <enum-type name="NativeObjectType" since="5.14"/> <enum-type name="RenderStage"/> <enum-type name="SceneGraphError"/> <enum-type name="TextRenderType" since="5.10"/> @@ -107,6 +108,7 @@ <object-type name="QSGAbstractRenderer"> <enum-type name="ClearModeBit" flags="ClearMode"/> + <enum-type name="MatrixTransformFlag" flags="MatrixTransformFlags" since="5.14"/> </object-type> <object-type name="QSGBasicGeometryNode"/> <object-type name="QSGClipNode"/> diff --git a/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml b/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml index 23fb4857e..425dcd7b5 100644 --- a/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml +++ b/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml @@ -461,6 +461,7 @@ <enum-type name="SliderChange"/> </object-type> <object-type name="QActionGroup"> + <enum-type name="ExclusionPolicy" since="5.14"/> <modify-function signature="addAction(QAction*)"> <modify-argument index="1"> <parent index="this" action="add"/> @@ -2950,6 +2951,7 @@ <object-type name="QCommandLinkButton"/> <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-argument index="1"> <parent index="this" action="add"/> diff --git a/sources/pyside2/PySide2/glue/qtcore.cpp b/sources/pyside2/PySide2/glue/qtcore.cpp index 93f7321aa..47b3dd6db 100644 --- a/sources/pyside2/PySide2/glue/qtcore.cpp +++ b/sources/pyside2/PySide2/glue/qtcore.cpp @@ -57,24 +57,39 @@ bool py2kStrCheck(PyObject *obj) // @snippet pystring-check // @snippet qsettings-value -QVariant out = %CPPSELF.value(%1, %2); +// If we enter the kwds, means that we have a defaultValue or +// at least a type. +// This avoids that we are passing '0' as defaultValue. +// defaultValue can also be passed as positional argument, +// not only as keyword. +QVariant out; +if (kwds || numArgs > 1) + out = %CPPSELF.value(%1, %2); +else + out = %CPPSELF.value(%1); + PyTypeObject *typeObj = reinterpret_cast<PyTypeObject*>(%PYARG_3); if (typeObj) { if (typeObj == &PyList_Type) { - QByteArrayList valuesList = out.toByteArray().split(','); - const int valuesSize = valuesList.size(); - if (valuesSize > 0) { - PyObject *list = PyList_New(valuesSize); - for (int i = 0; i < valuesSize; i++) { - PyObject *item = PyUnicode_FromString(valuesList[i].data()); - PyList_SET_ITEM(list, i, item); - Py_DECREF(item); - } - %PYARG_0 = list; + QByteArray out_ba = out.toByteArray(); + if (!out_ba.isEmpty()) { + QByteArrayList valuesList = out_ba.split(','); + const int valuesSize = valuesList.size(); + if (valuesSize > 0) { + PyObject *list = PyList_New(valuesSize); + for (int i = 0; i < valuesSize; i++) { + PyObject *item = PyUnicode_FromString(valuesList[i].data()); + PyList_SET_ITEM(list, i, item); + Py_DECREF(item); + } + %PYARG_0 = list; + } else { + %PYARG_0 = %CONVERTTOPYTHON[QVariant](out); + } } else { - %PYARG_0 = %CONVERTTOPYTHON[QVariant](out); + %PYARG_0 = PyList_New(0); } } else if (typeObj == &PyBytes_Type) { QByteArray asByteArray = out.toByteArray(); @@ -94,11 +109,13 @@ if (typeObj) { } else if (typeObj == &PyFloat_Type) { float asFloat = out.toFloat(); %PYARG_0 = PyFloat_FromDouble(asFloat); + } else if (typeObj == &PyBool_Type) { + %PYARG_0 = out.toBool() ? Py_True : Py_False; } // TODO: PyDict_Type and PyTuple_Type } else { - if (out == 0) + if (!out.isValid()) %PYARG_0 = Py_None; else %PYARG_0 = %CONVERTTOPYTHON[QVariant](out); @@ -308,7 +325,7 @@ PyModule_AddStringConstant(module, "__version__", qVersion()); // @snippet qobject-connect static bool isDecorator(PyObject *method, PyObject *self) { - Shiboken::AutoDecRef methodName(PyObject_GetAttrString(method, "__name__")); + Shiboken::AutoDecRef methodName(PyObject_GetAttr(method, Shiboken::PyMagicName::name())); if (!PyObject_HasAttr(self, methodName)) return true; Shiboken::AutoDecRef otherMethod(PyObject_GetAttr(self, methodName)); @@ -811,8 +828,8 @@ _findChildrenHelper(%CPPSELF, %2, reinterpret_cast<PyTypeObject *>(%PYARG_1), %P // @snippet qobject-tr QString result; if (QCoreApplication::instance()) { - PyObject *klass = PyObject_GetAttrString(%PYSELF, "__class__"); - PyObject *cname = PyObject_GetAttrString(klass, "__name__"); + PyObject *klass = PyObject_GetAttr(%PYSELF, Shiboken::PyMagicName::class_()); + PyObject *cname = PyObject_GetAttr(klass, Shiboken::PyMagicName::name()); result = QString(QCoreApplication::instance()->translate(Shiboken::String::toCString(cname), /* %1, %2, QCoreApplication::CodecForTr, %3)); */ %1, %2, %3)); diff --git a/sources/pyside2/PySide2/glue/qtgui.cpp b/sources/pyside2/PySide2/glue/qtgui.cpp index 5be8cc287..d2480e99e 100644 --- a/sources/pyside2/PySide2/glue/qtgui.cpp +++ b/sources/pyside2/PySide2/glue/qtgui.cpp @@ -455,10 +455,12 @@ QPoint p(%CPPSELF.%FUNCTION_NAME(%1)); // @snippet qmatrix-map-point // @snippet qmatrix4x4 -if (PySequence_Size(%PYARG_1) == 16) { +// PYSIDE-795: All PySequences can be made iterable with PySequence_Fast. +Shiboken::AutoDecRef seq(PySequence_Fast(%PYARG_1, "Can't turn into sequence")); +if (PySequence_Size(seq) == 16) { float values[16]; for (int i=0; i < 16; ++i) { - PyObject *pv = PySequence_Fast_GET_ITEM(%PYARG_1, i); + PyObject *pv = PySequence_Fast_GET_ITEM(seq.object(), i); values[i] = PyFloat_AsDouble(pv); } diff --git a/sources/pyside2/PySide2/glue/qtmultimedia.cpp b/sources/pyside2/PySide2/glue/qtmultimedia.cpp index 5a3f3a5e7..cbe1367cb 100644 --- a/sources/pyside2/PySide2/glue/qtmultimedia.cpp +++ b/sources/pyside2/PySide2/glue/qtmultimedia.cpp @@ -44,3 +44,10 @@ QObject * upcastedArg = %CONVERTTOCPP[QObject *](%PYARG_1); %CPPSELF.%FUNCTION_NAME(reinterpret_cast< %ARG1_TYPE >(upcastedArg)); %END_ALLOW_THREADS // @snippet upcast + +// @snippet qvideoframe-bits +%BEGIN_ALLOW_THREADS +%RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(); +%END_ALLOW_THREADS +%PYARG_0 = Shiboken::Buffer::newObject(%0, %CPPSELF.bytesPerLine() * %CPPSELF.height(), Shiboken::Buffer::ReadWrite); +// @snippet qvideoframe-bits diff --git a/sources/pyside2/PySide2/glue/qtuitools.cpp b/sources/pyside2/PySide2/glue/qtuitools.cpp index 552a9009c..00fc8e44a 100644 --- a/sources/pyside2/PySide2/glue/qtuitools.cpp +++ b/sources/pyside2/PySide2/glue/qtuitools.cpp @@ -54,9 +54,10 @@ static void createChildrenNameAttributes(PyObject *root, QObject *object) const QByteArray name = child->objectName().toLocal8Bit(); if (!name.isEmpty() && !name.startsWith("_") && !name.startsWith("qt_")) { - if (!PyObject_HasAttrString(root, name.constData())) { + Shiboken::AutoDecRef attrName(Py_BuildValue("s", name.constData())); + if (!PyObject_HasAttr(root, attrName)) { Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QObject *](child)); - PyObject_SetAttrString(root, name.constData(), pyChild); + PyObject_SetAttr(root, attrName, pyChild); } createChildrenNameAttributes(root, child); } diff --git a/sources/pyside2/PySide2/support/generate_pyi.py b/sources/pyside2/PySide2/support/generate_pyi.py index c732227f4..e60645701 100644 --- a/sources/pyside2/PySide2/support/generate_pyi.py +++ b/sources/pyside2/PySide2/support/generate_pyi.py @@ -100,6 +100,38 @@ class Formatter(Writer): The separation in formatter and enumerator is done to keep the unrelated tasks of enumeration and formatting apart. """ + def __init__(self, *args): + Writer.__init__(self, *args) + # patching __repr__ to disable the __repr__ of typing.TypeVar: + """ + def __repr__(self): + if self.__covariant__: + prefix = '+' + elif self.__contravariant__: + prefix = '-' + else: + prefix = '~' + return prefix + self.__name__ + """ + def _typevar__repr__(self): + return "typing." + self.__name__ + typing.TypeVar.__repr__ = _typevar__repr__ + + # Adding a pattern to substitute "Union[T, NoneType]" by "Optional[T]" + # I tried hard to replace typing.Optional by a simple override, but + # this became _way_ too much. + # See also the comment in layout.py . + brace_pat = build_brace_pattern(3) + pattern = (r"\b Union \s* \[ \s* {brace_pat} \s*, \s* NoneType \s* \]" + .format(**locals())) + replace = r"Optional[\1]" + optional_searcher = re.compile(pattern, flags=re.VERBOSE) + def optional_replacer(source): + return optional_searcher.sub(replace, str(source)) + self.optional_replacer = optional_replacer + # self.level is maintained by enum_sig.py + # self.after_enum() is a one-shot set by enum_sig.py . + @contextmanager def module(self, mod_name): self.mod_name = mod_name @@ -121,27 +153,19 @@ class Formatter(Writer): @contextmanager def klass(self, class_name, class_str): - self.class_name = class_name - spaces = "" + spaces = indent * self.level while "." in class_name: - spaces += indent class_name = class_name.split(".", 1)[-1] class_str = class_str.split(".", 1)[-1] self.print() - if not spaces: + if self.level == 0: self.print() here = self.outfile.tell() - self.print("{spaces}class {class_str}:".format(**locals())) - self.print() - pos = self.outfile.tell() - self.spaces = spaces + if self.have_body: + self.print("{spaces}class {class_str}:".format(**locals())) + else: + self.print("{spaces}class {class_str}: ...".format(**locals())) yield - if pos == self.outfile.tell(): - # we have not written any function - self.outfile.seek(here) - self.outfile.truncate() - # Note: we cannot use class_str when we have no body. - self.print("{spaces}class {class_name}: ...".format(**locals())) if "<" in class_name: # This is happening in QtQuick for some reason: ## class QSharedPointer<QQuickItemGrabResult >: @@ -150,24 +174,34 @@ class Formatter(Writer): self.outfile.truncate() @contextmanager - def function(self, func_name, signature): + def function(self, func_name, signature, modifier=None): + if self.after_enum() or func_name == "__init__": + self.print() key = func_name - spaces = indent + self.spaces if self.class_name else "" + spaces = indent * self.level if type(signature) == type([]): for sig in signature: self.print('{spaces}@typing.overload'.format(**locals())) - self._function(func_name, sig, spaces) + self._function(func_name, sig, modifier, spaces) else: - self._function(func_name, signature, spaces) + self._function(func_name, signature, modifier, spaces) + if func_name == "__init__": + self.print() yield key - def _function(self, func_name, signature, spaces): - # this would be nicer to get somehow together with the signature - is_meth = re.match(r"\((\w*)", str(signature)).group(1) == "self" - if self.class_name and not is_meth: - self.print('{spaces}@staticmethod'.format(**locals())) + def _function(self, func_name, signature, modifier, spaces): + if modifier: + self.print('{spaces}@{modifier}'.format(**locals())) + signature = self.optional_replacer(signature) self.print('{spaces}def {func_name}{signature}: ...'.format(**locals())) + @contextmanager + def enum(self, class_name, enum_name, value): + spaces = indent * self.level + hexval = hex(value) + self.print("{spaces}{enum_name:25}: {class_name} = ... # {hexval}".format(**locals())) + yield + def get_license_text(): with io.open(sourcepath) as f: @@ -247,10 +281,11 @@ def generate_all_pyi(outpath, options): os.environ["PYTHONPATH"] = pypath # now we can import - global PySide2, inspect, HintingEnumerator + global PySide2, inspect, typing, HintingEnumerator, build_brace_pattern import PySide2 - from PySide2.support.signature import inspect + from PySide2.support.signature import inspect, typing from PySide2.support.signature.lib.enum_sig import HintingEnumerator + from PySide2.support.signature.lib.tool import build_brace_pattern # propagate USE_PEP563 to the mapping module. # Perhaps this can be automated? diff --git a/sources/pyside2/PySide2/templates/core_common.xml b/sources/pyside2/PySide2/templates/core_common.xml index 4b74c6b55..8147b39e8 100644 --- a/sources/pyside2/PySide2/templates/core_common.xml +++ b/sources/pyside2/PySide2/templates/core_common.xml @@ -339,9 +339,16 @@ </template> <template name="pyseq_to_cpplist_conversion"> - for (int i = 0, size = PySequence_Size(%in); i < size; i++) { - - Shiboken::AutoDecRef pyItem(PySequence_GetItem(%in, i)); + // PYSIDE-795: Turn all sequences into iterables. + Shiboken::AutoDecRef it(PyObject_GetIter(%in)); + PyObject *(*iternext)(PyObject *) = *Py_TYPE(it)->tp_iternext; + for (;;) { + Shiboken::AutoDecRef pyItem(iternext(it)); + if (pyItem.isNull()) { + if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) + PyErr_Clear(); + break; + } %OUTTYPE_0 cppItem = %CONVERTTOCPP[%OUTTYPE_0](pyItem); %out << cppItem; } @@ -358,10 +365,20 @@ </template> <template name="pyseq_to_cppvector_conversion"> - int vectorSize = PySequence_Size(%in); - %out.reserve(vectorSize); - for (int idx = 0; idx < vectorSize; ++idx) { - Shiboken::AutoDecRef pyItem(PySequence_GetItem(%in, idx)); + // PYSIDE-795: Turn all sequences into iterables. + if (PySequence_Check(%in)) { + int vectorSize = PySequence_Size(%in); + %out.reserve(vectorSize); + } + Shiboken::AutoDecRef it(PyObject_GetIter(%in)); + PyObject *(*iternext)(PyObject *) = *Py_TYPE(it)->tp_iternext; + for (;;) { + Shiboken::AutoDecRef pyItem(iternext(it)); + if (pyItem.isNull()) { + if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) + PyErr_Clear(); + break; + } %OUTTYPE_0 cppItem = %CONVERTTOCPP[%OUTTYPE_0](pyItem); %out.push_back(cppItem); } diff --git a/sources/pyside2/PySide2/templates/gui_common.xml b/sources/pyside2/PySide2/templates/gui_common.xml index f3e772a8c..96b4906ef 100644 --- a/sources/pyside2/PySide2/templates/gui_common.xml +++ b/sources/pyside2/PySide2/templates/gui_common.xml @@ -239,8 +239,10 @@ </template> <template name="matrix_constructor"> - if (PySequence_Size(%PYARG_1) == %SIZE) { - Shiboken::AutoDecRef fast(PySequence_Fast(%PYARG_1, + // PYSIDE-795: All PySequences can be made iterable with PySequence_Fast. + Shiboken::AutoDecRef seq(PySequence_Fast(%PYARG_1, "Can't turn into sequence")); + if (PySequence_Size(seq) == %SIZE) { + Shiboken::AutoDecRef fast(PySequence_Fast(seq, "Failed to parse sequence on %TYPE constructor.")); float values[%SIZE]; for(int i=0; i < %SIZE; i++) { |