aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2
diff options
context:
space:
mode:
Diffstat (limited to 'sources/pyside2')
-rw-r--r--sources/pyside2/CMakeLists.txt2
-rw-r--r--sources/pyside2/PySide2/QtDataVisualization/typesystem_datavisualization.xml131
-rw-r--r--sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml16
-rw-r--r--sources/pyside2/PySide2/QtOpenGLFunctions/CMakeLists.txt6
-rw-r--r--sources/pyside2/PySide2/QtOpenGLFunctions/QtOpenGLFunctions_global.post.h.in2
-rw-r--r--sources/pyside2/PySide2/QtOpenGLFunctions/typesystem_openglfunctions.xml9
-rw-r--r--sources/pyside2/PySide2/glue/qtdatavisualization.cpp37
-rw-r--r--sources/pyside2/PySide2/glue/qtgui.cpp25
-rw-r--r--sources/pyside2/PySide2/glue/qtopenglfunctions.cpp76
-rw-r--r--sources/pyside2/PySide2/qopenglversionfunctionsfactory.h45
-rw-r--r--sources/pyside2/PySide2/templates/gui_common.xml4
-rw-r--r--sources/pyside2/doc/extras/QtCore.Property.rst73
-rw-r--r--sources/pyside2/doc/quickstart.rst6
-rw-r--r--sources/pyside2/pyside_version.py2
-rw-r--r--sources/pyside2/tests/QtCore/bug_686.py2
-rw-r--r--sources/pyside2/tests/QtCore/qsettings_test.py10
-rw-r--r--sources/pyside2/tests/QtDataVisualization/datavisualization_test.py13
-rw-r--r--sources/pyside2/tests/QtGui/qdatastream_gui_operators_test.py8
18 files changed, 378 insertions, 89 deletions
diff --git a/sources/pyside2/CMakeLists.txt b/sources/pyside2/CMakeLists.txt
index dc2beded0..4336d6cc4 100644
--- a/sources/pyside2/CMakeLists.txt
+++ b/sources/pyside2/CMakeLists.txt
@@ -268,7 +268,7 @@ endif ()
find_program(SPHINX_BUILD sphinx-build)
find_program(DOT_EXEC dot)
-if (QT_SRC_DIR AND SPHINX_BUILD AND DOT_EXEC)
+if (QT_SRC_DIR AND SPHINX_BUILD AND DOT_EXEC AND NOT SKIP_DOCS)
add_subdirectory(doc)
else ()
set(DOCS_TARGET_DISABLED_MESSAGE "apidoc generation targets disabled.")
diff --git a/sources/pyside2/PySide2/QtDataVisualization/typesystem_datavisualization.xml b/sources/pyside2/PySide2/QtDataVisualization/typesystem_datavisualization.xml
index f10aeea3e..5dc87a013 100644
--- a/sources/pyside2/PySide2/QtDataVisualization/typesystem_datavisualization.xml
+++ b/sources/pyside2/PySide2/QtDataVisualization/typesystem_datavisualization.xml
@@ -119,56 +119,43 @@
<parent index="this" action="add"/>
</modify-argument>
</modify-function>
- <modify-function signature="addRow(QVector&lt;QtDataVisualization::QBarDataItem&gt;*)">
- <modify-argument index="1">
- <parent index="this" action="add"/>
- </modify-argument>
- </modify-function>
- <modify-function signature="addRow(QVector&lt;QtDataVisualization::QBarDataItem&gt;*, const QString&amp;)">
- <modify-argument index="1">
- <parent index="this" action="add"/>
- </modify-argument>
- </modify-function>
- <modify-function signature="addRows(const QtDataVisualization::QBarDataArray&amp;)">
- <modify-argument index="1">
- <parent index="this" action="add"/>
- </modify-argument>
- </modify-function>
- <modify-function signature="addRows(const QtDataVisualization::QBarDataArray&amp;, const QStringList&amp;)">
- <modify-argument index="1">
- <parent index="this" action="add"/>
- </modify-argument>
- </modify-function>
- <modify-function signature="insertRow(int, QVector&lt;QtDataVisualization::QBarDataItem&gt;*)">
- <modify-argument index="2">
- <parent index="this" action="add"/>
- </modify-argument>
- </modify-function>
- <modify-function signature="insertRow(int, QVector&lt;QtDataVisualization::QBarDataItem&gt;*, const QString&amp;)">
- <modify-argument index="2">
- <parent index="this" action="add"/>
- </modify-argument>
- </modify-function>
- <modify-function signature="insertRows(int, const QtDataVisualization::QBarDataArray&amp;)">
- <modify-argument index="2">
- <parent index="this" action="add"/>
- </modify-argument>
- </modify-function>
- <modify-function signature="insertRows(int, const QtDataVisualization::QBarDataArray&amp;, const QStringList&amp;)">
- <modify-argument index="2">
- <parent index="this" action="add"/>
- </modify-argument>
- </modify-function>
- <modify-function signature="setRow(int, QVector&lt;QtDataVisualization::QBarDataItem&gt;*)">
- <modify-argument index="2">
- <parent index="this" action="add"/>
- </modify-argument>
- </modify-function>
- <modify-function signature="setRow(int, QVector&lt;QtDataVisualization::QBarDataItem&gt;*, const QString&amp;)">
- <modify-argument index="2">
- <parent index="this" action="add"/>
- </modify-argument>
- </modify-function>
+
+ <!-- PYSIDE-1438: Replace all add/set/insertRow() taking a 'QVector*' by overloads
+ taking 'const QVector &' since an allocated list needs to be passed. -->
+ <modify-function signature="addRow(QVector&lt;QtDataVisualization::QBarDataItem&gt;*)" remove="all"/>
+ <add-function signature="addRow(const QVector&lt;QtDataVisualization::QBarDataItem&gt;&amp;)" return-type="int">
+ <inject-code class="target" position="beginning" file="../glue/qtdatavisualization.cpp"
+ snippet="dataproxy-addrow"/>
+ </add-function>
+ <modify-function signature="addRow(QVector&lt;QtDataVisualization::QBarDataItem&gt;*,const QString&amp;)" remove="all"/>
+ <add-function signature="addRow(const QVector&lt;QtDataVisualization::QBarDataItem&gt;&amp;,const QString&amp;)"
+ return-type="int">
+ <inject-code class="target" position="beginning" file="../glue/qtdatavisualization.cpp"
+ snippet="dataproxy-addrow-string"/>
+ </add-function>
+
+ <modify-function signature="insertRow(int,QVector&lt;QtDataVisualization::QBarDataItem&gt;*)" remove="all"/>
+ <add-function signature="insertRow(int,const QVector&lt;QtDataVisualization::QBarDataItem&gt;&amp;)">
+ <inject-code class="target" position="beginning" file="../glue/qtdatavisualization.cpp"
+ snippet="dataproxy-insertrow"/>
+ </add-function>
+ <modify-function signature="insertRow(int,QVector&lt;QtDataVisualization::QBarDataItem&gt;*,const QString&amp;)" remove="all"/>
+ <add-function signature="insertRow(int,const QVector&lt;QtDataVisualization::QBarDataItem&gt;&amp;, const QString&amp;)">
+ <inject-code class="target" position="beginning" file="../glue/qtdatavisualization.cpp"
+ snippet="dataproxy-insertrow-string"/>
+ </add-function>
+
+ <modify-function signature="setRow(int,QVector&lt;QtDataVisualization::QBarDataItem&gt;*)" remove="all"/>
+ <add-function signature="setRow(int,const QVector&lt;QtDataVisualization::QBarDataItem&gt;&amp;)">
+ <inject-code class="target" position="beginning" file="../glue/qtdatavisualization.cpp"
+ snippet="dataproxy-setrow"/>
+ </add-function>
+ <modify-function signature="setRow(int,QVector&lt;QtDataVisualization::QBarDataItem&gt;*,const QString&amp;)" remove="all"/>
+ <add-function signature="setRow(int,const QVector&lt;QtDataVisualization::QBarDataItem&gt;&amp;,const QString&amp;)">
+ <inject-code class="target" position="beginning" file="../glue/qtdatavisualization.cpp"
+ snippet="dataproxy-setrow-string"/>
+ </add-function>
+
<modify-function signature="setRows(int, const QtDataVisualization::QBarDataArray&amp;)">
<modify-argument index="2">
<parent index="this" action="add"/>
@@ -182,7 +169,13 @@
</object-type>
<object-type name="QCustom3DItem"/>
<object-type name="QCustom3DLabel"/>
- <object-type name="QCustom3DVolume"/>
+ <object-type name="QCustom3DVolume">
+ <modify-function signature="setTextureData(QVector&lt;uchar&gt;*)" remove="all"/>
+ <add-function signature="setTextureData(const QVector&lt;uchar&gt;&amp;)">
+ <inject-code class="target" position="beginning" file="../glue/qtdatavisualization.cpp"
+ snippet="qcustom3dvolume-settexturedata"/>
+ </add-function>
+ </object-type>
<object-type name="QHeightMapSurfaceDataProxy"/>
<object-type name="QItemModelBarDataProxy">
<enum-type name="MultiMatchBehavior"/>
@@ -251,21 +244,27 @@
</object-type>
<value-type name="QSurfaceDataItem"/>
<object-type name="QSurfaceDataProxy">
- <modify-function signature="addRow(QVector&lt;QtDataVisualization::QSurfaceDataItem&gt;*)">
- <modify-argument index="1">
- <parent index="this" action="add"/>
- </modify-argument>
- </modify-function>
- <modify-function signature="insertRow(int, QVector&lt;QtDataVisualization::QSurfaceDataItem&gt;*)">
- <modify-argument index="2">
- <parent index="this" action="add"/>
- </modify-argument>
- </modify-function>
- <modify-function signature="setRow(int, QVector&lt;QtDataVisualization::QSurfaceDataItem&gt;*)">
- <modify-argument index="2">
- <parent index="this" action="add"/>
- </modify-argument>
- </modify-function>
+
+ <!-- PYSIDE-1438: Replace all add/set/insertRow() taking a 'QVector*' by overloads
+ taking 'const QVector &' since an allocated list needs to be passed. -->
+ <modify-function signature="addRow(QVector&lt;QtDataVisualization::QSurfaceDataItem&gt;*)" remove="all"/>
+ <add-function signature="addRow(const QVector&lt;QtDataVisualization::QSurfaceDataItem&gt;&amp;)" return-type="int">
+ <inject-code class="target" position="beginning" file="../glue/qtdatavisualization.cpp"
+ snippet="dataproxy-addrow"/>
+ </add-function>
+
+ <modify-function signature="insertRow(int,QVector&lt;QtDataVisualization::QSurfaceDataItem&gt;*)" remove="all"/>
+ <add-function signature="insertRow(int,const QVector&lt;QtDataVisualization::QSurfaceDataItem&gt;&amp;)">
+ <inject-code class="target" position="beginning" file="../glue/qtdatavisualization.cpp"
+ snippet="dataproxy-insertrow"/>
+ </add-function>
+
+ <modify-function signature="setRow(int,QVector&lt;QtDataVisualization::QSurfaceDataItem&gt;*)" remove="all"/>
+ <add-function signature="setRow(int,const QVector&lt;QtDataVisualization::QSurfaceDataItem&gt;&amp;)">
+ <inject-code class="target" position="beginning" file="../glue/qtdatavisualization.cpp"
+ snippet="dataproxy-setrow"/>
+ </add-function>
+
<modify-function signature="resetArray(QtDataVisualization::QSurfaceDataArray*)">
<modify-argument index="1">
<parent index="this" action="add"/>
diff --git a/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml b/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml
index aa8391f8f..b0c61fe64 100644
--- a/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml
+++ b/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml
@@ -1871,18 +1871,23 @@
<modify-function signature="drawRects(const QRect*,int)" remove="all"/>
<modify-function signature="drawRects(const QRectF*,int)" remove="all"/>
<!-- ### -->
+ <!-- PYSIDE-1540: Preferably use the QPolygon overloads first to avoid
+ a costly sequence type check on QPolygon. -->
<modify-function signature="drawPoints(const QPoint*,int)" remove="all"/>
- <add-function signature="drawPoints(QVector&lt;QPoint>)">
+ <add-function signature="drawPoints(QVector&lt;QPoint>)" overload-number="2">
<inject-code>
<insert-template name="qpainter_drawlist"/>
</inject-code>
</add-function>
<modify-function signature="drawPoints(const QPointF*,int)" remove="all"/>
- <add-function signature="drawPoints(QVector&lt;QPointF>)">
+ <add-function signature="drawPoints(QVector&lt;QPointF>)" overload-number="3">
<inject-code>
<insert-template name="qpainter_drawlist"/>
</inject-code>
</add-function>
+ <modify-function signature="drawPoints(const QPolygon&amp;)" overload-number="0"/>
+ <modify-function signature="drawPoints(const QPolygonF&amp;)" overload-number="1"/>
+
<modify-function signature="drawPolygon(const QPoint*,int,Qt::FillRule)" remove="all"/>
<add-function signature="drawPolygon(QVector&lt;QPoint>,Qt::FillRule)">
<inject-code file="../glue/qtgui.cpp" snippet="qpainter-drawpolygon"/>
@@ -2601,6 +2606,10 @@
</object-type>
<object-type name="QOpenGLContext">
<enum-type name="OpenGLModuleType"/>
+ <modify-function signature="versionFunctions(const QOpenGLVersionProfile&amp;) const">
+ <inject-code class="target" position="beginning" file="../glue/qtgui.cpp"
+ snippet="qopenglcontext-versionfunctions"/>
+ </modify-function>
</object-type>
<object-type name="QOpenGLContextGroup" since="5.0"/>
<object-type name="QOpenGLDebugLogger" since="5.1">
@@ -2835,7 +2844,8 @@
<modify-argument index="return">
<replace-type modified-type="QString"/>
</modify-argument>
- <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qstring-return"/>
+ <inject-code class="target" position="end" file="../glue/qtgui.cpp"
+ snippet="glgetstring-return"/>
</modify-function>
</object-type>
<object-type name="QOpenGLFunctions" since="5.0">
diff --git a/sources/pyside2/PySide2/QtOpenGLFunctions/CMakeLists.txt b/sources/pyside2/PySide2/QtOpenGLFunctions/CMakeLists.txt
index 383afb68f..62ed669cc 100644
--- a/sources/pyside2/PySide2/QtOpenGLFunctions/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtOpenGLFunctions/CMakeLists.txt
@@ -42,7 +42,8 @@ else()
${QtOpenGLFunctions_GEN_DIR}/qopenglfunctions_4_4_compatibility_wrapper.cpp
${QtOpenGLFunctions_GEN_DIR}/qopenglfunctions_4_4_core_wrapper.cpp
${QtOpenGLFunctions_GEN_DIR}/qopenglfunctions_4_5_compatibility_wrapper.cpp
- ${QtOpenGLFunctions_GEN_DIR}/qopenglfunctions_4_5_core_wrapper.cpp)
+ ${QtOpenGLFunctions_GEN_DIR}/qopenglfunctions_4_5_core_wrapper.cpp
+ ${QtOpenGLFunctions_GEN_DIR}/qopenglversionfunctionsfactory_wrapper.cpp)
message(STATUS "Qt${QT_MAJOR_VERSION}OpenGLFunctions: Adding Desktop OpenGL classes")
endif()
@@ -71,3 +72,6 @@ create_pyside_module(NAME QtOpenGLFunctions
SOURCES QtOpenGLFunctions_SRC
TYPESYSTEM_NAME ${QtOpenGLFunctions_BINARY_DIR}/typesystem_openglfunctions.xml
DROPPED_ENTRIES QtOpenGLFunctions_DROPPED_ENTRIES)
+
+install(FILES ${pyside2_SOURCE_DIR}/qopenglversionfunctionsfactory.h
+ DESTINATION include/PySide2/QtOpenGLFunctions)
diff --git a/sources/pyside2/PySide2/QtOpenGLFunctions/QtOpenGLFunctions_global.post.h.in b/sources/pyside2/PySide2/QtOpenGLFunctions/QtOpenGLFunctions_global.post.h.in
index 6c8c77087..e43bc2b81 100644
--- a/sources/pyside2/PySide2/QtOpenGLFunctions/QtOpenGLFunctions_global.post.h.in
+++ b/sources/pyside2/PySide2/QtOpenGLFunctions/QtOpenGLFunctions_global.post.h.in
@@ -59,3 +59,5 @@
#if QT_CONFIG(opengles2)
# include <QtGui/qopenglfunctions_es2.h>
#endif
+
+#include "qopenglversionfunctionsfactory.h" // PySide class
diff --git a/sources/pyside2/PySide2/QtOpenGLFunctions/typesystem_openglfunctions.xml b/sources/pyside2/PySide2/QtOpenGLFunctions/typesystem_openglfunctions.xml
index 1d5b08edb..edb271362 100644
--- a/sources/pyside2/PySide2/QtOpenGLFunctions/typesystem_openglfunctions.xml
+++ b/sources/pyside2/PySide2/QtOpenGLFunctions/typesystem_openglfunctions.xml
@@ -404,6 +404,15 @@
&openglfunctions_modifications1_0;
&openglfunctions_modifications1_1;
</object-type>
+
+ <object-type name="QOpenGLVersionFunctionsFactory">
+ <modify-function signature="get(const QOpenGLVersionProfile&amp;,QOpenGLContext*)"
+ return-type="QAbstractOpenGLFunctions*">
+ <inject-code class="target" position="beginning" file="../glue/qtopenglfunctions.cpp"
+ snippet="qopenglversionfunctionsfactory-get"/>
+ </modify-function>
+ </object-type>
+
<suppress-warning text="^There's no user provided way.*QOpenGLFunctions_\d_\d.*::glIndex.*$"/>
</typesystem>
diff --git a/sources/pyside2/PySide2/glue/qtdatavisualization.cpp b/sources/pyside2/PySide2/glue/qtdatavisualization.cpp
index 119d79a40..ce5aa6932 100644
--- a/sources/pyside2/PySide2/glue/qtdatavisualization.cpp
+++ b/sources/pyside2/PySide2/glue/qtdatavisualization.cpp
@@ -40,3 +40,40 @@
// @snippet releaseownership
Shiboken::Object::releaseOwnership(%PYARG_1);
// @snippet releaseownership
+
+// @snippet qcustom3dvolume-settexturedata
+using VectorType = decltype(%1);
+%CPPSELF.setTextureData(new VectorType(%1));
+// @snippet qcustom3dvolume-settexturedata
+
+// @snippet dataproxy-addrow
+using VectorType = decltype(%1);
+%RETURN_TYPE %0 = %CPPSELF.addRow(new VectorType(%1));
+%PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0);
+// @snippet dataproxy-addrow
+
+// @snippet dataproxy-addrow-string
+using VectorType = decltype(%1);
+%RETURN_TYPE %0 = %CPPSELF.addRow(new VectorType(%1), %2);
+%PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0);
+// @snippet dataproxy-addrow-string
+
+// @snippet dataproxy-insertrow
+using VectorType = decltype(%2);
+%CPPSELF.insertRow(%1, new VectorType(%2));
+// @snippet dataproxy-insertrow
+
+// @snippet dataproxy-insertrow-string
+using VectorType = decltype(%2);
+%CPPSELF.insertRow(%1, new VectorType(%2), %3);
+// @snippet dataproxy-insertrow-string
+
+// @snippet dataproxy-setrow
+using VectorType = decltype(%2);
+%CPPSELF.setRow(%1, new VectorType(%2));
+// @snippet dataproxy-setrow
+
+// @snippet dataproxy-setrow-string
+using VectorType = decltype(%2);
+%CPPSELF.setRow(%1, new VectorType(%2), %3);
+// @snippet dataproxy-setrow-string
diff --git a/sources/pyside2/PySide2/glue/qtgui.cpp b/sources/pyside2/PySide2/glue/qtgui.cpp
index e802a9f59..1c74c73d2 100644
--- a/sources/pyside2/PySide2/glue/qtgui.cpp
+++ b/sources/pyside2/PySide2/glue/qtgui.cpp
@@ -41,6 +41,27 @@
* INJECT CODE
********************************************************************/
+// @snippet qopenglcontext-versionfunctions
+
+// %CPPSELF.%FUNCTION_NAME(%1, %2); Pretend to shiboken we call the function
+
+// Import QtOpenGLFunctions and call the factory function
+// QOpenGLVersionFunctionsFactory.get()
+PyObject *module = PyImport_ImportModule("PySide2.QtOpenGLFunctions");
+if (module == nullptr)
+ return nullptr;
+PyObject *loc = PyModule_GetDict(module);
+static PyObject *const factoryName =
+ Shiboken::String::createStaticString("QOpenGLVersionFunctionsFactory");
+auto factory = PyDict_GetItem(loc, factoryName);
+if (factory == nullptr)
+ return nullptr;
+
+static PyObject *const getMethod = Shiboken::String::createStaticString("get");
+%PYARG_0 = PyObject_CallMethodObjArgs(factory, getMethod, pyArgs[0], %PYSELF,
+ nullptr);
+// @snippet qopenglcontext-versionfunctions
+
// @snippet glgetshadersource
GLsizei bufSize = 4096;
GLsizei length = bufSize - 1;
@@ -63,6 +84,10 @@ const char *sources[] = {buffer.constData()};
%CPPSELF->%FUNCTION_NAME(%1, 1, sources, nullptr);
// @snippet glshadersource
+// @snippet glgetstring-return
+%PYARG_0 = %CONVERTTOPYTHON[const char *](%0);
+// @snippet glgetstring-return
+
// @snippet qtransform-quadtoquad
QTransform _result;
if (QTransform::quadToQuad(%1, %2, _result)) {
diff --git a/sources/pyside2/PySide2/glue/qtopenglfunctions.cpp b/sources/pyside2/PySide2/glue/qtopenglfunctions.cpp
new file mode 100644
index 000000000..c839ae44b
--- /dev/null
+++ b/sources/pyside2/PySide2/glue/qtopenglfunctions.cpp
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt for Python.
+**
+** $QT_BEGIN_LICENSE:COMM$
+**
+** 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.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// @snippet qopenglversionfunctionsfactory-get
+QAbstractOpenGLFunctions *af = %CPPSELF.%FUNCTION_NAME(%1, %2);
+if (auto *f = dynamic_cast<QOpenGLFunctions_4_5_Core *>(af)) {
+ %PYARG_0 = %CONVERTTOPYTHON[QOpenGLFunctions_4_5_Core *](f);
+} else if (auto *f = dynamic_cast<QOpenGLFunctions_4_5_Compatibility *>(af)) {
+ %PYARG_0 = %CONVERTTOPYTHON[QOpenGLFunctions_4_5_Compatibility *](f);
+} else if (auto *f = dynamic_cast<QOpenGLFunctions_4_4_Core *>(af)) {
+ %PYARG_0 = %CONVERTTOPYTHON[QOpenGLFunctions_4_4_Core *](f);
+} else if (auto *f = dynamic_cast<QOpenGLFunctions_4_4_Compatibility *>(af)) {
+ %PYARG_0 = %CONVERTTOPYTHON[QOpenGLFunctions_4_4_Compatibility *](f);
+} else if (auto *f = dynamic_cast<QOpenGLFunctions_4_3_Core *>(af)) {
+ %PYARG_0 = %CONVERTTOPYTHON[QOpenGLFunctions_4_3_Core *](f);
+} else if (auto *f = dynamic_cast<QOpenGLFunctions_4_2_Core *>(af)) {
+ %PYARG_0 = %CONVERTTOPYTHON[QOpenGLFunctions_4_2_Core *](f);
+} else if (auto *f = dynamic_cast<QOpenGLFunctions_4_1_Core *>(af)) {
+ %PYARG_0 = %CONVERTTOPYTHON[QOpenGLFunctions_4_1_Core *](f);
+} else if (auto *f = dynamic_cast<QOpenGLFunctions_4_0_Core *>(af)) {
+ %PYARG_0 = %CONVERTTOPYTHON[QOpenGLFunctions_4_0_Core *](f);
+} else if (auto *f = dynamic_cast<QOpenGLFunctions_4_0_Compatibility *>(af)) {
+ %PYARG_0 = %CONVERTTOPYTHON[QOpenGLFunctions_4_0_Compatibility *](f);
+} else if (auto *f = dynamic_cast<QOpenGLFunctions_3_3_Core *>(af)) {
+ %PYARG_0 = %CONVERTTOPYTHON[QOpenGLFunctions_3_3_Core *](f);
+} else if (auto *f = dynamic_cast<QOpenGLFunctions_3_3_Compatibility *>(af)) {
+ %PYARG_0 = %CONVERTTOPYTHON[QOpenGLFunctions_3_3_Compatibility *](f);
+} else if (auto *f = dynamic_cast<QOpenGLFunctions_3_2_Core *>(af)) {
+ %PYARG_0 = %CONVERTTOPYTHON[QOpenGLFunctions_3_2_Core *](f);
+} else if (auto *f = dynamic_cast<QOpenGLFunctions_3_2_Compatibility *>(af)) {
+ %PYARG_0 = %CONVERTTOPYTHON[QOpenGLFunctions_3_2_Compatibility *](f);
+} else if (auto *f = dynamic_cast<QOpenGLFunctions_3_1 *>(af)) {
+ %PYARG_0 = %CONVERTTOPYTHON[QOpenGLFunctions_3_1 *](f);
+} else if (auto *f = dynamic_cast<QOpenGLFunctions_3_0 *>(af)) {
+ %PYARG_0 = %CONVERTTOPYTHON[QOpenGLFunctions_3_0 *](f);
+} else if (auto *f = dynamic_cast<QOpenGLFunctions_2_1 *>(af)) {
+ %PYARG_0 = %CONVERTTOPYTHON[QOpenGLFunctions_2_1 *](f);
+} else if (auto *f = dynamic_cast<QOpenGLFunctions_2_0 *>(af)) {
+ %PYARG_0 = %CONVERTTOPYTHON[QOpenGLFunctions_2_0 *](f);
+} else if (auto *f = dynamic_cast<QOpenGLFunctions_1_5 *>(af)) {
+ %PYARG_0 = %CONVERTTOPYTHON[QOpenGLFunctions_1_5 *](f);
+} else if (auto *f = dynamic_cast<QOpenGLFunctions_1_4 *>(af)) {
+ %PYARG_0 = %CONVERTTOPYTHON[QOpenGLFunctions_1_4 *](f);
+} else if (auto *f = dynamic_cast<QOpenGLFunctions_1_3 *>(af)) {
+ %PYARG_0 = %CONVERTTOPYTHON[QOpenGLFunctions_1_3 *](f);
+} else if (auto *f = dynamic_cast<QOpenGLFunctions_1_2 *>(af)) {
+ %PYARG_0 = %CONVERTTOPYTHON[QOpenGLFunctions_1_2 *](f);
+} else if (auto *f = dynamic_cast<QOpenGLFunctions_1_1 *>(af)) {
+ %PYARG_0 = %CONVERTTOPYTHON[QOpenGLFunctions_1_1 *](f);
+} else if (auto *f = dynamic_cast<QOpenGLFunctions_1_0 *>(af)) {
+ %PYARG_0 = %CONVERTTOPYTHON[QOpenGLFunctions_1_0 *](f);
+} else {
+ QString message;
+ QDebug(&message) << "No OpenGL functions could be obtained for" << %1;
+ PyErr_SetString(PyExc_RuntimeError, message.toUtf8().constData());
+ %PYARG_0 = Py_None;
+}
+// @snippet qopenglversionfunctionsfactory-get
diff --git a/sources/pyside2/PySide2/qopenglversionfunctionsfactory.h b/sources/pyside2/PySide2/qopenglversionfunctionsfactory.h
new file mode 100644
index 000000000..27b8373fa
--- /dev/null
+++ b/sources/pyside2/PySide2/qopenglversionfunctionsfactory.h
@@ -0,0 +1,45 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt for Python.
+**
+** $QT_BEGIN_LICENSE:COMM$
+**
+** 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.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QOPENGLVERSIONFUNCTIONSFACTORY_H
+#define QOPENGLVERSIONFUNCTIONSFACTORY_H
+
+#include <QtGui/QOpenGLContext>
+
+QT_BEGIN_NAMESPACE
+
+class QOpenGLVersionProfile;
+
+class QOpenGLVersionFunctionsFactory
+{
+public:
+ static QAbstractOpenGLFunctions *get(const QOpenGLVersionProfile &versionProfile,
+ QOpenGLContext *context)
+ {
+ return context
+ ? context->versionFunctions(versionProfile)
+ : nullptr;
+ }
+};
+
+QT_END_NAMESPACE
+
+#endif // QOPENGLVERSIONFUNCTIONSFACTORY_H
diff --git a/sources/pyside2/PySide2/templates/gui_common.xml b/sources/pyside2/PySide2/templates/gui_common.xml
index a139a5fe9..16116877f 100644
--- a/sources/pyside2/PySide2/templates/gui_common.xml
+++ b/sources/pyside2/PySide2/templates/gui_common.xml
@@ -80,8 +80,8 @@
</template>
<template name="qimage_buffer_constructor">
- auto ptr = reinterpret_cast&lt;uchar*&gt;(Shiboken::Buffer::getPointer(%PYARG_1));
- %0 = new %TYPE(ptr, %ARGS);
+ auto *ptr = reinterpret_cast&lt;uchar *&gt;(Shiboken::Buffer::copyData(%PYARG_1));
+ %0 = new %TYPE(ptr, %ARGS, std::free);
</template>
<template name="qcolor_repr">
diff --git a/sources/pyside2/doc/extras/QtCore.Property.rst b/sources/pyside2/doc/extras/QtCore.Property.rst
index 8aa629f6b..6bcfc2655 100644
--- a/sources/pyside2/doc/extras/QtCore.Property.rst
+++ b/sources/pyside2/doc/extras/QtCore.Property.rst
@@ -9,7 +9,9 @@ Detailed Description
The Property function lets you declare properties that
behave both as Qt and Python properties, and have their
-setters and getters defined as Python functions.
+getters and setters defined as Python functions.
+
+They are equivalent to the ``Q_PROPERTY`` macro in the `Qt Docs`_.
Here is an example that illustrates how to use this
function:
@@ -20,14 +22,14 @@ function:
from PySide2.QtCore import QObject, Property
class MyObject(QObject):
- def __init__(self,startval=42):
+ def __init__(self, startval=42):
QObject.__init__(self)
self.ppval = startval
def readPP(self):
return self.ppval
- def setPP(self,val):
+ def setPP(self, val):
self.ppval = val
pp = Property(int, readPP, setPP)
@@ -36,6 +38,68 @@ function:
obj.pp = 47
print(obj.pp)
+The full options for ``QtCore.Property`` can be found with ``QtCore.Property.__doc__``:
+
+.. code-block::
+
+ Property(self, type: type,
+ fget: Optional[Callable] = None,
+ fset: Optional[Callable] = None,
+ freset: Optional[Callable] = None,
+ fdel: Optional[Callable] = None,
+ doc: str = '', notify: Optional[Callable] = None,
+ designable: bool = True, scriptable: bool = True,
+ stored: bool = True, user: bool = False,
+ constant: bool = False, final: bool = False) -> PySide2.QtCore.Property
+
+Normally, only ``type``, ``fget``and ``fset`` are used.
+
+
+Properties compared with Python properties
+------------------------------------------
+
+``Python`` has property objects very similar to ``QtCore.Property``.
+Despite the fact that the latter has an extra ``freset`` function, the usage
+of properties is almost the same. The main difference is that ``QtCore.Property``
+requires a ``type`` parameter.
+
+In the above example, the following lines would be equivalent properties:
+
+.. code-block::
+
+ pp = QtCore.Property(int, readPP, setPP) # PySide version
+ pp = property(readPP, setPP) # Python version
+
+As you know from the `Python Docs`_, ``Python`` allows to break the property
+creation into multiple steps, using the decorator syntax. We can do this in
+``PySide`` as well:
+
+.. code-block::
+ :linenos:
+
+ from PySide2.QtCore import QObject, Property
+
+ class MyObject(QObject):
+ def __init__(self, startval=42):
+ QObject.__init__(self)
+ self.ppval = startval
+
+ @Property(int)
+ def pp(self):
+ return self.ppval
+
+ @pp.setter
+ def pp(self, val):
+ self.ppval = val
+
+ obj = MyObject()
+ obj.pp = 47
+ print(obj.pp)
+
+Please be careful here: The two ``Python`` functions have the same name, intentionally.
+This is needed to let ``Python`` know that these functions belong to the same property.
+
+
Properties in QML expressions
-----------------------------
@@ -61,3 +125,6 @@ example illustrating how to do this:
pass
name = Property(str, _name, notify=name_changed)
+
+.. _`Python Docs`: https://docs.python.org/3/library/functions.html?highlight=property#property
+.. _`Qt Docs`: https://doc.qt.io/qt-5/properties.html
diff --git a/sources/pyside2/doc/quickstart.rst b/sources/pyside2/doc/quickstart.rst
index 87471a8a8..db2e93280 100644
--- a/sources/pyside2/doc/quickstart.rst
+++ b/sources/pyside2/doc/quickstart.rst
@@ -52,12 +52,6 @@ constructs to print version information::
# Prints the Qt version used to compile PySide2
print(PySide2.QtCore.__version__)
-.. note::
-
- As it happened in 5.14.2, PySide had a couple of new releases to fix
- issues in 5.14.2, adding yet another version level. In that case, you
- will have different versions being shown for Qt and PySide.
-
Create a Simple Application
---------------------------
diff --git a/sources/pyside2/pyside_version.py b/sources/pyside2/pyside_version.py
index 0985e2559..ecc975ddf 100644
--- a/sources/pyside2/pyside_version.py
+++ b/sources/pyside2/pyside_version.py
@@ -39,7 +39,7 @@
major_version = "5"
minor_version = "15"
-patch_version = "3"
+patch_version = "4"
# For example: "a", "b", "rc"
# (which means "alpha", "beta", "release candidate").
diff --git a/sources/pyside2/tests/QtCore/bug_686.py b/sources/pyside2/tests/QtCore/bug_686.py
index 6e4f8994a..d944cafe8 100644
--- a/sources/pyside2/tests/QtCore/bug_686.py
+++ b/sources/pyside2/tests/QtCore/bug_686.py
@@ -49,6 +49,7 @@ class MyWriteThread(QThread):
self.started = True
while not self.lock.tryLockForWrite():
pass
+ self.lock.unlock()
self.canQuit = True
class MyReadThread(QThread):
@@ -62,6 +63,7 @@ class MyReadThread(QThread):
self.started = True
while not self.lock.tryLockForRead():
pass
+ self.lock.unlock()
self.canQuit = True
class MyMutexedThread(QThread):
diff --git a/sources/pyside2/tests/QtCore/qsettings_test.py b/sources/pyside2/tests/QtCore/qsettings_test.py
index 639f6d276..a9f42a5d5 100644
--- a/sources/pyside2/tests/QtCore/qsettings_test.py
+++ b/sources/pyside2/tests/QtCore/qsettings_test.py
@@ -38,7 +38,7 @@ init_test_paths(False)
from helper.helper import adjust_filename
import py3kcompat as py3k
-from PySide2.QtCore import QSettings
+from PySide2.QtCore import QDir, QSettings, QTemporaryDir
class TestQSettings(unittest.TestCase):
def testConversions(self):
@@ -59,7 +59,11 @@ class TestQSettings(unittest.TestCase):
def testDefaultValueConversion(self):
- settings = QSettings('foo.ini', QSettings.IniFormat)
+ temp_dir = QDir.tempPath()
+ dir = QTemporaryDir('{}/qsettings_XXXXXX'.format(temp_dir))
+ self.assertTrue(dir.isValid())
+ file_name = dir.filePath('foo.ini')
+ settings = QSettings(file_name, QSettings.IniFormat)
settings.setValue('zero_value', 0)
settings.setValue('empty_list', [])
settings.setValue('bool1', False)
@@ -67,7 +71,7 @@ class TestQSettings(unittest.TestCase):
del settings
# Loading values already set
- settings = QSettings('foo.ini', QSettings.IniFormat)
+ settings = QSettings(file_name, QSettings.IniFormat)
# Getting value that doesn't exist
r = settings.value("variable")
diff --git a/sources/pyside2/tests/QtDataVisualization/datavisualization_test.py b/sources/pyside2/tests/QtDataVisualization/datavisualization_test.py
index af6e5f5d5..32fd432e8 100644
--- a/sources/pyside2/tests/QtDataVisualization/datavisualization_test.py
+++ b/sources/pyside2/tests/QtDataVisualization/datavisualization_test.py
@@ -88,5 +88,18 @@ class QtDataVisualizationTestCase(UsesQGuiApplication):
QTimer.singleShot(500, self.app.quit)
self.app.exec_()
+ def testBarDataProxy(self):
+ '''PSYSIDE-1438, crashes in QBarDataProxy.addRow()'''
+ items = [QtDataVisualization.QBarDataItem(v) for v in [1.0, 2.0]]
+ data_proxy = QtDataVisualization.QBarDataProxy()
+ data_proxy.addRow(items)
+ data_proxy.addRow(items, 'bla')
+ data_proxy.insertRow(0, items)
+ data_proxy.insertRow(0, items, 'bla')
+ data_proxy.setRow(0, items)
+ data_proxy.setRow(0, items, 'bla')
+ self.assertTrue(data_proxy.rowCount(), 4)
+
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside2/tests/QtGui/qdatastream_gui_operators_test.py b/sources/pyside2/tests/QtGui/qdatastream_gui_operators_test.py
index c9b5c16a5..4db0a0a6e 100644
--- a/sources/pyside2/tests/QtGui/qdatastream_gui_operators_test.py
+++ b/sources/pyside2/tests/QtGui/qdatastream_gui_operators_test.py
@@ -47,7 +47,9 @@ class QPixmapQDatastream(UsesQApplication):
def setUp(self):
super(QPixmapQDatastream, self).setUp()
self.source_pixmap = QPixmap(100, 100)
- self.source_pixmap.fill(Qt.red)
+ # PYSIDE-1533: Use Qt.transparent to force Format_ARGB32_Premultiplied
+ # when converting to QImage in any case.
+ self.source_pixmap.fill(Qt.transparent)
self.output_pixmap = QPixmap()
self.buffer = QByteArray()
self.read_stream = QDataStream(self.buffer, QIODevice.ReadOnly)
@@ -60,8 +62,8 @@ class QPixmapQDatastream(UsesQApplication):
image = self.output_pixmap.toImage()
pixel = image.pixel(10,10)
- self.assertEqual(pixel, QColor(Qt.red).rgba())
- self.assertEqual(self.source_pixmap.toImage(), self.output_pixmap.toImage())
+ self.assertEqual(pixel, QColor(Qt.transparent).rgba())
+ self.assertEqual(self.source_pixmap.toImage(), image)
if __name__ == '__main__':