aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build_scripts/config.py4
-rw-r--r--dist/changes-5.13.237
-rw-r--r--sources/pyside2/PySide2/QtCharts/typesystem_charts.xml3
-rw-r--r--sources/pyside2/PySide2/QtMultimedia/typesystem_multimedia_common.xml11
-rw-r--r--sources/pyside2/PySide2/glue/qtcore.cpp43
-rw-r--r--sources/pyside2/PySide2/glue/qtmultimedia.cpp7
-rw-r--r--sources/pyside2/doc/conf.py.in2
-rw-r--r--sources/pyside2/doc/contents.rst1
-rw-r--r--sources/pyside2/doc/index.rst28
-rw-r--r--sources/pyside2/doc/modules.rst87
-rw-r--r--sources/pyside2/doc/overview.rst14
-rw-r--r--sources/pyside2/doc/tutorials/datavisualize/add_chart.rst2
-rw-r--r--sources/pyside2/doc/tutorials/datavisualize/add_tableview.rst2
-rw-r--r--sources/pyside2/doc/tutorials/portingguide/chapter3/chapter3.rst2
-rw-r--r--sources/pyside2/pyside_version.py2
-rw-r--r--sources/pyside2/tests/QtCore/attr_cache_py3k.py6
-rw-r--r--sources/pyside2/tests/QtCore/qsettings_test.py46
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_862.py33
-rw-r--r--sources/pyside2/tests/pysidetest/CMakeLists.txt2
-rw-r--r--sources/pyside2/tests/pysidetest/repr_test.py83
-rw-r--r--sources/pyside2/tests/pysidetest/testobject.cpp22
-rw-r--r--sources/pyside2/tests/pysidetest/testobject.h12
-rw-r--r--sources/pyside2/tests/pysidetest/typesystem_pysidetest.xml7
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp23
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetabuilder_p.h3
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetalang.h9
-rw-r--r--sources/shiboken2/ApiExtractor/tests/testdtorinformation.cpp33
-rw-r--r--sources/shiboken2/ApiExtractor/tests/testdtorinformation.h1
-rw-r--r--sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp6
-rw-r--r--sources/shiboken2/generator/shiboken2/cppgenerator.cpp11
-rw-r--r--sources/shiboken2/generator/shiboken2/cppgenerator.h2
-rw-r--r--sources/shiboken2/libshiboken/shibokenbuffer.cpp4
-rw-r--r--sources/shiboken2/shiboken_version.py2
-rw-r--r--sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/lib/enum_sig.py5
34 files changed, 445 insertions, 110 deletions
diff --git a/build_scripts/config.py b/build_scripts/config.py
index 25036a65f..edd7fdbf7 100644
--- a/build_scripts/config.py
+++ b/build_scripts/config.py
@@ -88,8 +88,6 @@ class Config(object):
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
- 'Programming Language :: Python :: 3.3',
- 'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
@@ -135,6 +133,8 @@ class Config(object):
setup_kwargs['zip_safe'] = False
setup_kwargs['cmdclass'] = cmd_class_dict
setup_kwargs['version'] = package_version
+ setup_kwargs['python_requires'] = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <3.8"
+
if quiet:
# Tells distutils / setuptools to be quiet, and only print warnings or errors.
diff --git a/dist/changes-5.13.2 b/dist/changes-5.13.2
new file mode 100644
index 000000000..52edd7a46
--- /dev/null
+++ b/dist/changes-5.13.2
@@ -0,0 +1,37 @@
+Qt for Python 5.13.2 is a bug-fix release.
+
+For more details, refer to the online documentation included in this
+distribution. The documentation is also available online:
+
+https://doc.qt.io/qtforpython/
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* PySide2 *
+****************************************************************************
+
+ - [PYSIDE-785] Release ownership in QAbstractVideoFilterWrapper::createFilterRunnable
+ - [PYSIDE-820] Fix booleans and empty list cases in QSettings
+ - [PYSIDE-849] Add inject-code for QVideoFrame::bits()
+ - [PYSIDE-1007] Remove extra ref on QDataStream::setDevice
+ - [PYSIDE-1019] libpyside: Fix compiler warning
+ - [PYSIDE-1049] Split build instructions to build and packaging
+ - [PYSIDE-1051] Fix heaptype conflict with QtCore.QObject.__new__in Python 2.7
+ - [PYSIDE-1089] Fix formatting of the deployment documentation
+ - [PYSIDE-1093] Fix bad shutdown effect on QApplication.instance()
+
+
+****************************************************************************
+* Shiboken2 *
+****************************************************************************
+
+ - [PYSIDE-1095] shiboken: Fix handling of modified default expressions
+
+
diff --git a/sources/pyside2/PySide2/QtCharts/typesystem_charts.xml b/sources/pyside2/PySide2/QtCharts/typesystem_charts.xml
index b8550ef2c..a14177586 100644
--- a/sources/pyside2/PySide2/QtCharts/typesystem_charts.xml
+++ b/sources/pyside2/PySide2/QtCharts/typesystem_charts.xml
@@ -41,6 +41,9 @@
-->
<typesystem package="PySide2.QtCharts">
<load-typesystem name="QtWidgets/typesystem_widgets.xml" generate="no"/>
+ <!-- PYSIDE-1101 Removing inherited method to avoid argument conflict
+ on the QChart::scroll overload -->
+ <rejection class="QGraphicsItem" function-name="scroll"/>
<namespace-type name="QtCharts">
<object-type name="QAbstractAxis" since="5.7">
<enum-type name="AxisType"/>
diff --git a/sources/pyside2/PySide2/QtMultimedia/typesystem_multimedia_common.xml b/sources/pyside2/PySide2/QtMultimedia/typesystem_multimedia_common.xml
index f7ac67857..3667b2c55 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>
diff --git a/sources/pyside2/PySide2/glue/qtcore.cpp b/sources/pyside2/PySide2/glue/qtcore.cpp
index 93f7321aa..a218e433f 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);
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/doc/conf.py.in b/sources/pyside2/doc/conf.py.in
index 33f408354..e197b1ac7 100644
--- a/sources/pyside2/doc/conf.py.in
+++ b/sources/pyside2/doc/conf.py.in
@@ -75,7 +75,7 @@ release = '@BINDING_API_VERSION_FULL@'
# List of directories, relative to source directory, that shouldn't be searched
# for source files.
-exclude_trees = ['_build', 'extras']
+exclude_patterns = ['_build', 'extras']
# The reST default role (used for this markup: `text`) to use for all documents.
#default_role = None
diff --git a/sources/pyside2/doc/contents.rst b/sources/pyside2/doc/contents.rst
index 675a5b73a..c4867f250 100644
--- a/sources/pyside2/doc/contents.rst
+++ b/sources/pyside2/doc/contents.rst
@@ -11,6 +11,7 @@
deployment.rst
pysideapi2.rst
licenses.rst
+ modules.rst
Module Index
============
diff --git a/sources/pyside2/doc/index.rst b/sources/pyside2/doc/index.rst
index b0bb1d19c..acc1d6d40 100644
--- a/sources/pyside2/doc/index.rst
+++ b/sources/pyside2/doc/index.rst
@@ -24,23 +24,23 @@ Basic modules
-------------
These are the main modules that will help you build a Widget based UI.
- `Qt Core <PySide2/QtCore/index.html>`_
+ :mod:`Qt Core <PySide2.QtCore>`
Provides core non-GUI functionality, like signal and slots, properties, base classes of item models, serialization, etc.
- `Qt Gui <PySide2/QtGui/index.html>`_
+ :mod:`Qt Gui <PySide2.QtGui>`
Extends QtCore with GUI functionality: Events, windows and screens, OpenGL and raster-based 2D painting, images.
- `Qt Widgets <PySide2/QtWidgets/index.html>`_
+ :mod:`Qt Widgets <PySide2.QtWidgets>`
Ready to use Widgets for your application, including also graphical elements for your UI.
QML and Qt Quick
----------------
- If you want to use the `Qml Language <https://doc.qt.io/qt-5/qmlapplications.html>`, these
+ If you want to use the `Qml Language <https://doc.qt.io/qt-5.qmlapplications>`, these
modules will help you interact with it from Python.
- `Qt Qml <PySide2/QtQml/index.html>`_
+ :mod:`Qt Qml <PySide2.QtQml>`
Base Python API to interact with the QML module.
- `Qt Quick <PySide2/QtQuick/index.html>`_
+ :mod:`Qt Quick <PySide2.QtQuick>`
Provides classes for embedding Qt Quick in Qt applications.
- `Qt QuickWidgets <PySide2/QtQuickWidgets/index.html>`_
+ :mod:`Qt QuickWidgets <PySide2.QtQuickWidgets>`
Provides the QQuickWidget class for embedding Qt Quick in widget-based applications.
Data visualization
@@ -49,9 +49,9 @@ Data visualization
Charts, diagrams, animations: these modules provide a large amount
of classes that can help you include these elements in your UI.
- `Qt Charts <PySide2/QtCharts/index.html>`_
+ :mod:`Qt Charts <PySide2.QtCharts>`
Provides a set of easy to use chart components.
- `Qt DataVisualization <PySide2/QtDataVisualization/index.html>`_
+ :mod:`Qt DataVisualization <PySide2.QtDataVisualization>`
Provides a way to visualize data in 3D as bar, scatter, and surface graphs.
Multimedia
@@ -60,9 +60,9 @@ Multimedia
Audio, video, and hardware interaction: check these modules if you are
looking for multimedia solutions.
- `Qt Multimedia <PySide2/QtMultimedia/index.html>`_
+ :mod:`Qt Multimedia <PySide2.QtMultimedia>`
Provides low-level multimedia functionality.
- `Qt MultimediaWidgets <PySide2/QtMultimediaWidgets/index.html>`_
+ :mod:`Qt MultimediaWidgets <PySide2.QtMultimediaWidgets>`
Provides the widget-based multimedia API.
WebEngine
@@ -71,9 +71,9 @@ WebEngine
If your project is based on a browser or the features around web
based applications, these modules will help you to interact with them.
- `Qt WebEngineWidgets <PySide2/QtWebEngineWidgets/index.html>`_
+ :mod:`Qt WebEngineWidgets <PySide2.QtWebEngineWidgets>`
Provides widgets that can handle web content.
- `Qt WebChannel <PySide2/QtWebChannel/index.html>`_
+ :mod:`Qt WebChannel <PySide2.QtWebChannel>`
Enables peer-to-peer communication between a server and a client
(HTML/JavaScript or QML application).
@@ -83,5 +83,5 @@ All the modules
There are many other modules currently supported by |pymodname|,
here you can find a complete list of them.
- `Check all the modules <modules.html>`_
+ :doc:`Check all the modules <modules>`
Display a table with all the currently supported Qt modules.
diff --git a/sources/pyside2/doc/modules.rst b/sources/pyside2/doc/modules.rst
index 1d6564300..6741b465d 100644
--- a/sources/pyside2/doc/modules.rst
+++ b/sources/pyside2/doc/modules.rst
@@ -1,94 +1,101 @@
Qt Modules
===========
+.. toctree::
+ :hidden:
+ :glob:
+
+ PySide2/Qt**
+
.. list-table::
:widths: 150, 150
:align: left
- * - `Qt Core <PySide2/QtCore/index.html>`_
+ * - :mod:`Qt Core <PySide2.QtCore>`
Provides core non-GUI functionality.
- - `Qt 3D Animation <PySide2/Qt3DAnimation/index.html>`_
+ - :mod:`Qt 3D Animation <PySide2.Qt3DAnimation>`
Provides basic elements required to animate 3D objects.
- * - `Qt Gui <PySide2/QtGui/index.html>`_
+ * - :mod:`Qt Gui <PySide2.QtGui>`
Extends QtCore with GUI functionality.
- - `Qt Help <PySide2/QtHelp/index.html>`_
+ - :mod:`Qt Help <PySide2.QtHelp>`
Provides classes for integrating online documentation in applications.
- * - `Qt Network <PySide2/QtNetwork/index.html>`_
+ * - :mod:`Qt Network <PySide2.QtNetwork>`
Offers classes that let you to write TCP/IP clients and servers.
- - `Qt OpenGL <PySide2/QtOpenGL/index.html>`_
+ - :mod:`Qt OpenGL <PySide2.QtOpenGL>`
Offers classes that make it easy to use OpenGL in Qt applications.
- * - `Qt PrintSupport <PySide2/QtPrintSupport/index.html>`_
+ * - :mod:`Qt PrintSupport <PySide2.QtPrintSupport>`
Provides extensive cross-platform support for printing.
- - `Qt Qml <PySide2/QtQml/index.html>`_
+ - :mod:`Qt Qml <PySide2.QtQml>`
Python API for Qt QML.
- * - `Qt Charts <PySide2/QtCharts/index.html>`_
+ * - :mod:`Qt Charts <PySide2.QtCharts>`
Provides a set of easy to use chart components.
- - `Qt Quick <PySide2/QtQuick/index.html>`_
+ - :mod:`Qt Quick <PySide2.QtQuick>`
Provides classes for embedding Qt Quick in Qt applications.
- * - `Qt DataVisualization <PySide2/QtDataVisualization/index.html>`_
+ * - :mod:`Qt DataVisualization <PySide2.QtDataVisualization>`
Provides a way to visualize data in 3D as bar, scatter, and surface graphs.
- - `Qt QuickWidgets <PySide2/QtQuickWidgets/index.html>`_
+ - :mod:`Qt QuickWidgets <PySide2.QtQuickWidgets>`
Provides the QQuickWidget class for embedding Qt Quick in widget-based applications.
- * - `Qt TextToSpeech <PySide2/QtTextToSpeech/index.html>`_
+ * - :mod:`Qt TextToSpeech <PySide2.QtTextToSpeech>`
Provides API to access text-to-speech engines.
- - `Qt Sql <PySide2/QtSql/index.html>`_
+ - :mod:`Qt Sql <PySide2.QtSql>`
Helps you provide seamless database integration to your Qt applications.
- * - `Qt Multimedia <PySide2/QtMultimedia/index.html>`_
+ * - :mod:`Qt Multimedia <PySide2.QtMultimedia>`
Provides low-level multimedia functionality.
- - `Qt MultimediaWidgets <PySide2/QtMultimediaWidgets/index.html>`_
+ - :mod:`Qt MultimediaWidgets <PySide2.QtMultimediaWidgets>`
Provides the widget-based multimedia API.
- * - `Qt MacExtras <PySide2/QtMacExtras/index.html>`_
+ * - :mod:`Qt MacExtras <PySide2.QtMacExtras>`
Provides classes and functions specific to
macOS and iOS operating systems.
- - `Qt Svg <PySide2/QtSvg/index.html>`_
+ - :mod:`Qt Svg <PySide2.QtSvg>`
Provides classes for displaying the contents of SVG files.
- * - `Qt UiTools <PySide2/QtUiTools/index.html>`_
+ * - :mod:`Qt UiTools <PySide2.QtUiTools>`
Provides classes to handle forms created with Qt Designer.
- - `Qt Test <PySide2/QtTest/index.html>`_
+ - :mod:`Qt Test <PySide2.QtTest>`
Provides classes for unit testing Qt applications and libraries.
- * - `Qt Concurrent <PySide2/QtConcurrent/index.html>`_
+ * - :mod:`Qt Concurrent <PySide2.QtConcurrent>`
Provides high-level APIs that make it possible
to write multi-threaded programs without using low-level threading
primitives such as mutexes, read-write locks, wait conditions, or semaphores.
- - `Qt AxContainer <PySide2/QtAxContainer/index.html>`_
+ - :mod:`Qt AxContainer <PySide2.QtAxContainer>`
Provides QAxObject and QAxWidget which act as
containers for COM objects and ActiveX controls.
- * - `Qt WebEngineCore <PySide2/QtWebEngineCore/index.html>`_
+ * - :mod:`Qt WebEngineCore <PySide2.QtWebEngineCore>`
Provides the core functionality to integrate web content.
- - `Qt WebEngineWidgets <PySide2/QtWebEngineWidgets/index.html>`_
+ - :mod:`Qt WebEngineWidgets <PySide2.QtWebEngineWidgets>`
Provides widgets that can handle web content.
- * - `Qt WebChannel <PySide2/QtWebChannel/index.html>`_
+ * - :mod:`Qt WebChannel <PySide2.QtWebChannel>`
Enables peer-to-peer communication between a server and a client
(HTML/JavaScript or QML application).
- - `Qt WebSockets <PySide2/QtWebSockets/index.html>`_
+ - :mod:`Qt WebSockets <PySide2.QtWebSockets>`
Provides interfaces that enable Qt applications
to act as a server that can process WebSocket requests, or a client that
can consume data received from the server, or both.
- * - `Qt Widgets <PySide2/QtWidgets/index.html>`_
+ * - :mod:`Qt Widgets <PySide2.QtWidgets>`
Extends Qt GUI with C++ widget functionality.
- - `Qt WinExtras <PySide2/QtWinExtras/index.html>`_
+ - :mod:`Qt WinExtras <PySide2.QtWinExtras>`
Provides classes and functions for using some Windows APIs in a Qt way.
- * - `Qt X11Extras <PySide2/QtX11Extras/index.html>`_
+ * - :mod:`Qt X11Extras <PySide2.QtX11Extras>`
Provides information about the X display configuration.
- - `Qt Xml <PySide2/QtXml/index.html>`_
+ - :mod:`Qt Xml <PySide2.QtXml>`
Provides C++ implementations of SAX and DOM.
- * - `Qt XmlPatterns <PySide2/QtXmlPatterns/index.html>`_
+ * - :mod:`Qt XmlPatterns <PySide2.QtXmlPatterns>`
Provides support for XPath, XQuery, XSLTi, and XML Schema validation.
- - `Qt 3D Core <PySide2/Qt3DCore/index.html>`_
+ - :mod:`Qt 3D Core <PySide2.Qt3DCore>`
Contains functionality to support near-realtime simulation systems.
- * - `Qt 3D Extras <PySide2/Qt3DExtras/index.html>`_
+ * - :mod:`Qt 3D Extras <PySide2.Qt3DExtras>`
Provides a set of prebuilt elements to help you get started with Qt 3D.
- - `Qt 3D Input <PySide2/Qt3DInput/index.html>`_
+ - :mod:`Qt 3D Input <PySide2.Qt3DInput>`
Provides classes for handling user input in applications using Qt 3D.
- * - `Qt 3D Logic <PySide2/Qt3DLogic/index.html>`_
+ * - :mod:`Qt 3D Logic <PySide2.Qt3DLogic>`
Enables synchronizing frames with the Qt 3D backend.
- - `Qt 3D Render <PySide2/Qt3DRender/index.html>`_
+ - :mod:`Qt 3D Render <PySide2.Qt3DRender>`
Contains functionality to support 2D and 3D rendering using Qt 3D.
- * - `Qt Positioning <PySide2/QtPositioning/index.html>`_
+ * - :mod:`Qt Positioning <PySide2.QtPositioning>`
Provides positioning information via QML and Python interfaces.
- - `Qt Location <PySide2/QtLocation/index.html>`_
+ - :mod:`Qt Location <PySide2.QtLocation>`
Helps you create viable mapping solutions using the data available from some of the popular location services.
- * - `Qt Sensors <PySide2/QtSensors/index.html>`_
+ * - :mod:`Qt Sensors <PySide2.QtSensors>`
Provides access to sensor hardware via QML and Python interfaces and a motion gesture recognition API for devices.
- - `Qt Scxml <PySide2/QtScxml/index.html>`_
+ - :mod:`Qt Scxml <PySide2.QtScxml>`
Provides classes to create and use state machines from SCXML files.
+
diff --git a/sources/pyside2/doc/overview.rst b/sources/pyside2/doc/overview.rst
index e8a8ace00..86c3a54fe 100644
--- a/sources/pyside2/doc/overview.rst
+++ b/sources/pyside2/doc/overview.rst
@@ -40,3 +40,17 @@ A simple Hello World example in PySide2 looks like this:
label = QLabel("Hello World")
label.show()
sys.exit(app.exec_())
+
+
+Additional overviews
+--------------------
+
+These additional topics provide detailed information about
+several Qt-specific features:
+
+.. toctree::
+ :titlesonly:
+ :glob:
+
+ overviews/*
+
diff --git a/sources/pyside2/doc/tutorials/datavisualize/add_chart.rst b/sources/pyside2/doc/tutorials/datavisualize/add_chart.rst
index 0c9803269..95b2092b3 100644
--- a/sources/pyside2/doc/tutorials/datavisualize/add_chart.rst
+++ b/sources/pyside2/doc/tutorials/datavisualize/add_chart.rst
@@ -15,6 +15,6 @@ previous chapter to add a QChartView:
.. literalinclude:: datavisualize5/main_widget.py
:linenos:
:lines: 40-
- :emphasize-lines: 2-3,6,22-37,48-51
+ :emphasize-lines: 2-3,6,22-36,48-50
diff --git a/sources/pyside2/doc/tutorials/datavisualize/add_tableview.rst b/sources/pyside2/doc/tutorials/datavisualize/add_tableview.rst
index bbf27f2da..720918008 100644
--- a/sources/pyside2/doc/tutorials/datavisualize/add_tableview.rst
+++ b/sources/pyside2/doc/tutorials/datavisualize/add_tableview.rst
@@ -59,10 +59,12 @@ In the following snippets you'll see those changes highlighted:
.. literalinclude:: datavisualize4/main_window.py
:language: python
:linenos:
+ :lines: 40-
:emphasize-lines: 8,11
.. literalinclude:: datavisualize4/main.py
:language: python
:linenos:
+ :lines: 40-
:emphasize-lines: 46-47
diff --git a/sources/pyside2/doc/tutorials/portingguide/chapter3/chapter3.rst b/sources/pyside2/doc/tutorials/portingguide/chapter3/chapter3.rst
index 6ed7e47d4..71b254811 100644
--- a/sources/pyside2/doc/tutorials/portingguide/chapter3/chapter3.rst
+++ b/sources/pyside2/doc/tutorials/portingguide/chapter3/chapter3.rst
@@ -106,7 +106,7 @@ to generate ``rc_books.py``.
pyside2-rcc books.qrc > rc_books.py
Once you have the Python script generated, make the
-following changes to ``main.py`` and ``bookdelegate.py``:
+following changes to ``bookdelegate.py`` and ``main.py``:
.. literalinclude:: bookdelegate.py
:diff: ../chapter2/bookdelegate.py
diff --git a/sources/pyside2/pyside_version.py b/sources/pyside2/pyside_version.py
index 93c9fe6be..0d5681cc5 100644
--- a/sources/pyside2/pyside_version.py
+++ b/sources/pyside2/pyside_version.py
@@ -39,7 +39,7 @@
major_version = "5"
minor_version = "13"
-patch_version = "2"
+patch_version = "3"
# For example: "a", "b", "rc"
diff --git a/sources/pyside2/tests/QtCore/attr_cache_py3k.py b/sources/pyside2/tests/QtCore/attr_cache_py3k.py
index ec0575b02..f9761a9d3 100644
--- a/sources/pyside2/tests/QtCore/attr_cache_py3k.py
+++ b/sources/pyside2/tests/QtCore/attr_cache_py3k.py
@@ -56,9 +56,9 @@ class A(QObject):
def test(cls):
cls.instance
cls.instance = cls()
- assert "<__main__.A object " in repr(cls.__dict__['instance'])
- assert "<__main__.A object " in repr(cls.instance)
- assert "<__main__.A object " in repr(type.__getattribute__(cls, 'instance'))
+ assert "<__main__.A(0x" in repr(cls.__dict__['instance'])
+ assert "<__main__.A(0x" in repr(cls.instance)
+ assert "<__main__.A(0x" in repr(type.__getattribute__(cls, 'instance'))
if __name__ == "__main__":
diff --git a/sources/pyside2/tests/QtCore/qsettings_test.py b/sources/pyside2/tests/QtCore/qsettings_test.py
index 6d64b0db3..36a4c3c62 100644
--- a/sources/pyside2/tests/QtCore/qsettings_test.py
+++ b/sources/pyside2/tests/QtCore/qsettings_test.py
@@ -55,15 +55,55 @@ class TestQSettings(unittest.TestCase):
def testDefaultValueConversion(self):
settings = QSettings('foo.ini', QSettings.IniFormat)
- r = settings.value('lala', 22)
+ settings.setValue('zero_value', 0)
+ settings.setValue('empty_list', [])
+ settings.setValue('bool1', False)
+ settings.setValue('bool2', True)
+ del settings
+
+ # Loading values already set
+ settings = QSettings('foo.ini', QSettings.IniFormat)
+
+ # Getting value that doesn't exist
+ r = settings.value("variable")
+ self.assertEqual(type(r), type(None))
+
+ # Handling zero value
+ r = settings.value('zero_value')
if py3k.IS_PY3K:
self.assertEqual(type(r), int)
else:
self.assertEqual(type(r), long)
- r = settings.value('lala', 22, type=str)
- self.assertEqual(type(r), str)
+ r = settings.value('zero_value', type=int)
+ self.assertEqual(type(r), int)
+
+ # Empty list
+ r = settings.value('empty_list')
+ self.assertTrue(len(r) == 0)
+ self.assertEqual(type(r), list)
+
+ r = settings.value('empty_list', type=list)
+ self.assertTrue(len(r) == 0)
+ self.assertEqual(type(r), list)
+
+ # Booleans
+ r = settings.value('bool1')
+ self.assertEqual(type(r), bool)
+
+ r = settings.value('bool2')
+ self.assertEqual(type(r), bool)
+
+ r = settings.value('bool1', type=bool)
+ self.assertEqual(type(r), bool)
+
+ r = settings.value('bool2', type=int)
+ self.assertEqual(type(r), int)
+
+ r = settings.value('bool2', type=bool)
+ self.assertEqual(type(r), bool)
+ # Not set variable, but with default value
r = settings.value('lala', 22, type=bytes)
self.assertEqual(type(r), bytes)
diff --git a/sources/pyside2/tests/QtWidgets/bug_862.py b/sources/pyside2/tests/QtWidgets/bug_862.py
index ac0325536..4621fc3b4 100644
--- a/sources/pyside2/tests/QtWidgets/bug_862.py
+++ b/sources/pyside2/tests/QtWidgets/bug_862.py
@@ -26,6 +26,29 @@
##
#############################################################################
+
+#
+# Test for bug 862, original description was:
+#
+# print seems to be broken at least for QGraphicsItems-derived objects. The
+# attached code shows:
+#
+# <__main__.MyQObject object at 0xf99f38>
+# <__main__.MyQWidget object at 0xf99f38>
+# <PySide.QtGui.MyQGraphicsObject (this = 0x11c0d60 , parent = 0x0 , pos =
+# QPointF(0, 0) , z = 0 , flags = ( ) ) at 0xf99f38>
+# <PySide.QtGui.QGraphicsItem (this = 0x11c2e60 , parent = 0x0 , pos = QPointF(0,
+# 0) , z = 0 , flags = ( ) ) at 0xf99f38>
+#
+# Where it should be showing something like:
+#
+# <__main__.MyQObject object at 0x7f55cf226c20>
+# <__main__.MyQWidget object at 0x7f55cf226c20>
+# <__main__.MyQGraphicsObject object at 0x7f55cf226c20>
+# <__main__.MyQGraphicsItem object at 0x7f55cf226c20>
+#
+
+
from PySide2.QtCore import QObject
from PySide2.QtWidgets import *
import PySide2.QtCore
@@ -53,14 +76,14 @@ class TestRepr (unittest.TestCase):
app = QApplication([])
- self.assertEqual("<__main__.MyQObject object at ", repr(MyQObject())[:30])
- self.assertEqual("<__main__.MyQWidget object at ", repr(MyQWidget())[:30])
+ self.assertEqual("<__main__.MyQObject(0x", repr(MyQObject())[:22])
+ self.assertEqual("<__main__.MyQWidget(0x", repr(MyQWidget())[:22])
self.assertEqual("<__main__.MyQGraphicsObject(0x", repr(MyQGraphicsObject())[:30])
self.assertEqual("<__main__.MyQGraphicsItem(0x", repr(MyQGraphicsItem())[:28])
- self.assertEqual("<PySide2.QtCore.QObject object at ", repr(QObject())[:34])
- self.assertEqual("<PySide2.QtCore.QObject object at ", repr(PySide2.QtCore.QObject())[:34])
- self.assertEqual("<PySide2.QtWidgets.QWidget object at ", repr(QWidget())[:37])
+ self.assertEqual("<PySide2.QtCore.QObject(0x", repr(QObject())[:26])
+ self.assertEqual("<PySide2.QtCore.QObject(0x", repr(PySide2.QtCore.QObject())[:26])
+ self.assertEqual("<PySide2.QtWidgets.QWidget(0x", repr(QWidget())[:29])
self.assertEqual("<PySide2.QtWidgets.QGraphicsWidget(0x", repr(QGraphicsWidget())[:37])
if __name__ == "__main__":
diff --git a/sources/pyside2/tests/pysidetest/CMakeLists.txt b/sources/pyside2/tests/pysidetest/CMakeLists.txt
index 3c993cf4e..b8ec54270 100644
--- a/sources/pyside2/tests/pysidetest/CMakeLists.txt
+++ b/sources/pyside2/tests/pysidetest/CMakeLists.txt
@@ -30,6 +30,7 @@ ${CMAKE_CURRENT_BINARY_DIR}/testbinding/testobject_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/testbinding/intvalue_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/testbinding/pysidecpp_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/testbinding/pysidecpp_testobjectwithnamespace_wrapper.cpp
+${CMAKE_CURRENT_BINARY_DIR}/testbinding/pysidecpp_testobject2withnamespace_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/testbinding/pysidecpp2_testobjectwithoutnamespace_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/testbinding/testview_wrapper.cpp
${CMAKE_CURRENT_BINARY_DIR}/testbinding/testbinding_module_wrapper.cpp
@@ -142,3 +143,4 @@ PYSIDE_TEST(signal_slot_warning.py)
PYSIDE_TEST(all_modules_load_test.py)
PYSIDE_TEST(qapp_like_a_macro_test.py)
PYSIDE_TEST(embedding_test.py)
+PYSIDE_TEST(repr_test.py)
diff --git a/sources/pyside2/tests/pysidetest/repr_test.py b/sources/pyside2/tests/pysidetest/repr_test.py
new file mode 100644
index 000000000..295084f17
--- /dev/null
+++ b/sources/pyside2/tests/pysidetest/repr_test.py
@@ -0,0 +1,83 @@
+# -*- coding: utf-8 -*-
+
+#############################################################################
+##
+## Copyright (C) 2019 The Qt Company Ltd.
+## Copyright (C) 2019 Andreas Beckermann
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of Qt for Python.
+##
+## $QT_BEGIN_LICENSE:LGPL$
+## 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 Lesser General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU Lesser
+## General Public License version 3 as published by the Free Software
+## Foundation and appearing in the file LICENSE.LGPL3 included in the
+## packaging of this file. Please review the following information to
+## ensure the GNU Lesser General Public License version 3 requirements
+## will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+##
+## GNU General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU
+## General Public License version 2.0 or (at your option) the GNU General
+## Public license version 3 or any later version approved by the KDE Free
+## Qt Foundation. The licenses are as published by the Free Software
+## Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+## 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-2.0.html and
+## https://www.gnu.org/licenses/gpl-3.0.html.
+##
+## $QT_END_LICENSE$
+##
+#############################################################################
+
+import unittest
+from testbinding import PySideCPP, TestObject
+
+class QObjectDerivedReprTest(unittest.TestCase):
+ """Test the __repr__ implementation of QObject derived classes"""
+
+ def testReprWithoutNamespace(self):
+ """Test that classes outside a namespace that have a operator<<(QDebug,...) defined use that
+ for __repr__"""
+ t = TestObject(123)
+
+ # We don't define __str__, so str(q) should call __repr__
+ self.assertEqual(t.__repr__(), str(t))
+
+ # __repr__ should use the operator<<(QDebug,...) implementation
+ self.assertIn('TestObject(id=123)', str(t))
+
+ def testReprWithNamespace(self):
+ """Test that classes inside a namespace that have a operator<<(QDebug,...) defined use that
+ for __repr__"""
+ t = PySideCPP.TestObjectWithNamespace(None)
+
+ # We don't define __str__, so str(q) should call __repr__
+ self.assertEqual(t.__repr__(), str(t))
+
+ # __repr__ should use the operator<<(QDebug,...) implementation
+ self.assertIn('TestObjectWithNamespace("TestObjectWithNamespace")', str(t))
+
+ def testReprInject(self):
+ """Test that injecting __repr__ via typesystem overrides the operator<<(QDebug, ...)"""
+ t = PySideCPP.TestObject2WithNamespace(None)
+
+ # We don't define __str__, so str(q) should call __repr__
+ self.assertEqual(t.__repr__(), str(t))
+
+ # __repr__ should use the operator<<(QDebug,...) implementation
+ self.assertEqual(str(t), "TestObject2WithNamespace(injected_repr)")
+
+if __name__ == '__main__':
+ unittest.main()
+
diff --git a/sources/pyside2/tests/pysidetest/testobject.cpp b/sources/pyside2/tests/pysidetest/testobject.cpp
index 03a7a965c..441ae872f 100644
--- a/sources/pyside2/tests/pysidetest/testobject.cpp
+++ b/sources/pyside2/tests/pysidetest/testobject.cpp
@@ -52,3 +52,25 @@ void TestObject::emitSignalWithTypedefValue(int value)
{
emit signalWithTypedefValue(TypedefValue(value));
}
+
+QDebug operator<<(QDebug dbg, TestObject& testObject)
+{
+ QDebugStateSaver saver(dbg);
+ dbg.nospace() << "TestObject(id=" << testObject.idValue() << ") ";
+ return dbg;
+}
+
+namespace PySideCPP {
+ QDebug operator<<(QDebug dbg, TestObjectWithNamespace& testObject)
+ {
+ QDebugStateSaver saver(dbg);
+ dbg.nospace() << "TestObjectWithNamespace(" << testObject.name() << ") ";
+ return dbg;
+ }
+ QDebug operator<<(QDebug dbg, TestObject2WithNamespace& testObject)
+ {
+ QDebugStateSaver saver(dbg);
+ dbg.nospace() << "TestObject2WithNamespace(" << testObject.name() << ") ";
+ return dbg;
+ }
+}
diff --git a/sources/pyside2/tests/pysidetest/testobject.h b/sources/pyside2/tests/pysidetest/testobject.h
index 6cfb01101..f8a174d46 100644
--- a/sources/pyside2/tests/pysidetest/testobject.h
+++ b/sources/pyside2/tests/pysidetest/testobject.h
@@ -33,6 +33,7 @@
#include <QApplication>
#include <QMetaType>
#include <QVariant>
+#include <QDebug>
#ifdef pysidetest_EXPORTS
#define PYSIDE_EXPORTS 1
#endif
@@ -81,6 +82,7 @@ private:
int m_idValue;
QList<QObject*> m_children;
};
+PYSIDE_API QDebug operator<<(QDebug dbg, TestObject &testObject);
typedef int PySideInt;
@@ -104,6 +106,16 @@ signals:
void emitSignalWithNamespace(PySideCPP::TestObjectWithNamespace* obj);
void emitSignalWithTypedef(PySideInt val);
};
+PYSIDE_API QDebug operator<<(QDebug dbg, TestObjectWithNamespace &testObject);
+
+class PYSIDE_API TestObject2WithNamespace : public QObject
+{
+ Q_OBJECT
+public:
+ TestObject2WithNamespace(QObject* parent) : QObject(parent) {}
+ QString name() { return "TestObject2WithNamespace"; }
+};
+PYSIDE_API QDebug operator<<(QDebug dbg, TestObject2WithNamespace& testObject);
} // Namespace PySideCPP
diff --git a/sources/pyside2/tests/pysidetest/typesystem_pysidetest.xml b/sources/pyside2/tests/pysidetest/typesystem_pysidetest.xml
index 1904f236f..1e777edd2 100644
--- a/sources/pyside2/tests/pysidetest/typesystem_pysidetest.xml
+++ b/sources/pyside2/tests/pysidetest/typesystem_pysidetest.xml
@@ -37,6 +37,13 @@
<namespace-type name="PySideCPP">
<object-type name="TestObjectWithNamespace"/>
+ <object-type name="TestObject2WithNamespace">
+ <add-function signature="__repr__" return-type="PyObject*">
+ <inject-code class="target" position="beginning">
+ %PYARG_0 = Shiboken::String::fromCString("TestObject2WithNamespace(injected_repr)");
+ </inject-code>
+ </add-function>
+ </object-type>
</namespace-type>
<namespace-type name="PySideCPP2" generate="no">
diff --git a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
index 4b31dbb05..84721968d 100644
--- a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
+++ b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
@@ -248,6 +248,15 @@ void AbstractMetaBuilderPrivate::registerHashFunction(const FunctionModelItem &f
}
}
+void AbstractMetaBuilderPrivate::registerToStringCapabilityIn(const NamespaceModelItem &nsItem)
+{
+ const FunctionList &streamOps = nsItem->findFunctions(QLatin1String("operator<<"));
+ for (const FunctionModelItem &item : streamOps)
+ registerToStringCapability(item, nullptr);
+ for (const NamespaceModelItem &ni : nsItem->namespaces())
+ registerToStringCapabilityIn(ni);
+}
+
/**
* Check if a class has a debug stream operator that can be used as toString
*/
@@ -261,7 +270,7 @@ void AbstractMetaBuilderPrivate::registerToStringCapability(const FunctionModelI
const ArgumentModelItem &arg = arguments.at(1);
if (AbstractMetaClass *cls = argumentToClass(arg, currentClass)) {
if (arg->type().indirections() < 2)
- cls->setToStringCapability(true);
+ cls->setToStringCapability(true, arg->type().indirections());
}
}
}
@@ -503,8 +512,12 @@ void AbstractMetaBuilderPrivate::traverseDom(const FileModelItem &dom)
ReportHandler::startProgress("Fixing class inheritance...");
for (AbstractMetaClass *cls : qAsConst(m_metaClasses)) {
- if (!cls->isInterface() && !cls->isNamespace())
+ if (!cls->isInterface() && !cls->isNamespace()) {
setupInheritance(cls);
+ if (!cls->hasVirtualDestructor() && cls->baseClass()
+ && cls->baseClass()->hasVirtualDestructor())
+ cls->setHasVirtualDestructor(true);
+ }
}
ReportHandler::startProgress("Detecting inconsistencies in class model...");
@@ -591,11 +604,7 @@ void AbstractMetaBuilderPrivate::traverseDom(const FileModelItem &dom)
registerHashFunction(item, nullptr);
}
- {
- const FunctionList &streamOps = dom->findFunctions(QLatin1String("operator<<"));
- for (const FunctionModelItem &item : streamOps)
- registerToStringCapability(item, nullptr);
- }
+ registerToStringCapabilityIn(dom);
{
FunctionList binaryOperators = dom->findFunctions(QStringLiteral("operator=="));
diff --git a/sources/shiboken2/ApiExtractor/abstractmetabuilder_p.h b/sources/shiboken2/ApiExtractor/abstractmetabuilder_p.h
index fec2eddb9..18c5afc17 100644
--- a/sources/shiboken2/ApiExtractor/abstractmetabuilder_p.h
+++ b/sources/shiboken2/ApiExtractor/abstractmetabuilder_p.h
@@ -56,7 +56,7 @@ public:
void dumpLog() const;
AbstractMetaClassList classesTopologicalSorted(const AbstractMetaClassList &classList,
const Dependencies &additionalDependencies = Dependencies()) const;
- ScopeModelItem popScope() { return m_scopes.takeLast(); }
+ NamespaceModelItem popScope() { return m_scopes.takeLast(); }
void pushScope(const NamespaceModelItem &item);
@@ -106,6 +106,7 @@ public:
void checkFunctionModifications();
void registerHashFunction(const FunctionModelItem &functionItem,
AbstractMetaClass *currentClass);
+ void registerToStringCapabilityIn(const NamespaceModelItem &namespaceItem);
void registerToStringCapability(const FunctionModelItem &functionItem,
AbstractMetaClass *currentClass);
diff --git a/sources/shiboken2/ApiExtractor/abstractmetalang.h b/sources/shiboken2/ApiExtractor/abstractmetalang.h
index afb4e5fbd..91ca4d7a9 100644
--- a/sources/shiboken2/ApiExtractor/abstractmetalang.h
+++ b/sources/shiboken2/ApiExtractor/abstractmetalang.h
@@ -1691,9 +1691,10 @@ public:
return m_stream;
}
- void setToStringCapability(bool value)
+ void setToStringCapability(bool value, uint indirections = 0)
{
m_hasToStringCapability = value;
+ m_toStringCapabilityIndirections = indirections;
}
bool hasToStringCapability() const
@@ -1701,6 +1702,11 @@ public:
return m_hasToStringCapability;
}
+ uint toStringCapabilityIndirections() const
+ {
+ return m_toStringCapabilityIndirections;
+ }
+
bool deleteInMainThread() const;
static AbstractMetaClass *findClass(const AbstractMetaClassList &classes,
@@ -1753,6 +1759,7 @@ private:
// FunctionModelItem m_qDebugStreamFunction;
bool m_stream = false;
+ uint m_toStringCapabilityIndirections = 0;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(AbstractMetaClass::FunctionQueryOptions)
diff --git a/sources/shiboken2/ApiExtractor/tests/testdtorinformation.cpp b/sources/shiboken2/ApiExtractor/tests/testdtorinformation.cpp
index f4204e9b9..0eee8af24 100644
--- a/sources/shiboken2/ApiExtractor/tests/testdtorinformation.cpp
+++ b/sources/shiboken2/ApiExtractor/tests/testdtorinformation.cpp
@@ -69,6 +69,39 @@ void TestDtorInformation::testDtorIsVirtual()
QCOMPARE(AbstractMetaClass::findClass(classes, QLatin1String("Subject"))->hasVirtualDestructor(), true);
}
+void TestDtorInformation::testDtorFromBaseIsVirtual()
+{
+ const char* cppCode = R"CPP(class ControlBase { public: ~ControlBase() {} };
+class Control : public ControlBase {};
+class SubjectBase { public: virtual ~SubjectBase() {} };
+class Subject : public SubjectBase {};
+)CPP";
+ const char* xmlCode = R"XML(<typesystem package="Foo"><value-type name="ControlBase"/>
+<value-type name="Control"/>"
+<value-type name="SubjectBase"/>"
+<value-type name="Subject"/>
+</typesystem>
+)XML";
+ QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
+ QVERIFY(!builder.isNull());
+ AbstractMetaClassList classes = builder->classes();
+ QCOMPARE(classes.count(), 4);
+
+ auto klass = AbstractMetaClass::findClass(classes, QLatin1String("ControlBase"));
+ QVERIFY(klass);
+ QVERIFY(!klass->hasVirtualDestructor());
+ klass = AbstractMetaClass::findClass(classes, QLatin1String("Control"));
+ QVERIFY(klass);
+ QVERIFY(!klass->hasVirtualDestructor());
+
+ klass = AbstractMetaClass::findClass(classes, QLatin1String("SubjectBase"));
+ QVERIFY(klass);
+ QVERIFY(klass->hasVirtualDestructor());
+ klass = AbstractMetaClass::findClass(classes, QLatin1String("Subject"));
+ QVERIFY(klass);
+ QVERIFY(klass->hasVirtualDestructor());
+}
+
void TestDtorInformation::testClassWithVirtualDtorIsPolymorphic()
{
const char* cppCode ="class Control { public: virtual ~Control() {} }; class Subject { protected: virtual ~Subject() {} };";
diff --git a/sources/shiboken2/ApiExtractor/tests/testdtorinformation.h b/sources/shiboken2/ApiExtractor/tests/testdtorinformation.h
index 068ef4952..0a57dd8d1 100644
--- a/sources/shiboken2/ApiExtractor/tests/testdtorinformation.h
+++ b/sources/shiboken2/ApiExtractor/tests/testdtorinformation.h
@@ -40,6 +40,7 @@ private slots:
void testDtorIsPrivate();
void testDtorIsProtected();
void testDtorIsVirtual();
+ void testDtorFromBaseIsVirtual();
void testClassWithVirtualDtorIsPolymorphic();
};
diff --git a/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp b/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp
index 3b6d1c870..86abf21b0 100644
--- a/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp
+++ b/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp
@@ -1236,10 +1236,6 @@ void QtXmlToSphinx::handlePageTag(QXmlStreamReader &reader)
: writeEscapedRstText(m_output, fullTitle);
m_output << endl << Pad('*', size) << endl << endl;
-
- const QStringRef brief = reader.attributes().value(briefAttribute());
- if (!brief.isEmpty())
- m_output << escape(brief) << endl << endl;
}
void QtXmlToSphinx::handleTargetTag(QXmlStreamReader &reader)
@@ -1625,7 +1621,7 @@ void QtDocGenerator::generateClass(QTextStream &s, GeneratorContext &classContex
m_docParser->setPackageName(metaClass->package());
m_docParser->fillDocumentation(const_cast<AbstractMetaClass*>(metaClass));
- s << ".. module:: " << metaClass->package() << endl;
+ s << ".. currentmodule:: " << metaClass->package() << endl;
QString className = getClassTargetFullName(metaClass, false);
s << ".. _" << className << ":" << endl << endl;
diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
index 7de0cfc09..61429b383 100644
--- a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
+++ b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
@@ -3933,9 +3933,10 @@ void CppGenerator::writeClassDefinition(QTextStream &s,
m_tpFuncs[func->name()] = cpythonFunctionName(func);
}
if (m_tpFuncs.value(QLatin1String("__repr__")).isEmpty()
- && !metaClass->isQObject()
&& metaClass->hasToStringCapability()) {
- m_tpFuncs[QLatin1String("__repr__")] = writeReprFunction(s, classContext);
+ m_tpFuncs[QLatin1String("__repr__")] = writeReprFunction(s,
+ classContext,
+ metaClass->toStringCapabilityIndirections());
}
// class or some ancestor has multiple inheritance
@@ -6006,7 +6007,9 @@ void CppGenerator::writeIndexError(QTextStream &s, const QString &errorMsg)
s << INDENT << '}' << endl;
}
-QString CppGenerator::writeReprFunction(QTextStream &s, GeneratorContext &context)
+QString CppGenerator::writeReprFunction(QTextStream &s,
+ GeneratorContext &context,
+ uint indirections)
{
const AbstractMetaClass *metaClass = context.metaClass();
QString funcName = cpythonBaseName(metaClass) + QLatin1String("__repr__");
@@ -6019,7 +6022,7 @@ QString CppGenerator::writeReprFunction(QTextStream &s, GeneratorContext &contex
s << INDENT << "buffer.open(QBuffer::ReadWrite);" << endl;
s << INDENT << "QDebug dbg(&buffer);" << endl;
s << INDENT << "dbg << ";
- if (metaClass->typeEntry()->isValue())
+ if (metaClass->typeEntry()->isValue() || indirections == 0)
s << '*';
s << CPP_SELF_VAR << ';' << endl;
s << INDENT << "buffer.close();" << endl;
diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.h b/sources/shiboken2/generator/shiboken2/cppgenerator.h
index ae6da9582..005518f96 100644
--- a/sources/shiboken2/generator/shiboken2/cppgenerator.h
+++ b/sources/shiboken2/generator/shiboken2/cppgenerator.h
@@ -336,7 +336,7 @@ private:
/// Helper function for writeStdListWrapperMethods.
void writeIndexError(QTextStream &s, const QString &errorMsg);
- QString writeReprFunction(QTextStream &s, GeneratorContext &context);
+ QString writeReprFunction(QTextStream &s, GeneratorContext &context, uint indirections);
const AbstractMetaFunction *boolCast(const AbstractMetaClass *metaClass) const;
bool hasBoolCast(const AbstractMetaClass *metaClass) const
diff --git a/sources/shiboken2/libshiboken/shibokenbuffer.cpp b/sources/shiboken2/libshiboken/shibokenbuffer.cpp
index 330470183..dd6e46320 100644
--- a/sources/shiboken2/libshiboken/shibokenbuffer.cpp
+++ b/sources/shiboken2/libshiboken/shibokenbuffer.cpp
@@ -43,7 +43,11 @@
bool Shiboken::Buffer::checkType(PyObject *pyObj)
{
+#ifdef IS_PY3K
+ return PyObject_CheckBuffer(pyObj) != 0;
+#else
return PyObject_CheckReadBuffer(pyObj) != 0;
+#endif
}
void *Shiboken::Buffer::getPointer(PyObject *pyObj, Py_ssize_t *size)
diff --git a/sources/shiboken2/shiboken_version.py b/sources/shiboken2/shiboken_version.py
index 93c9fe6be..0d5681cc5 100644
--- a/sources/shiboken2/shiboken_version.py
+++ b/sources/shiboken2/shiboken_version.py
@@ -39,7 +39,7 @@
major_version = "5"
minor_version = "13"
-patch_version = "2"
+patch_version = "3"
# For example: "a", "b", "rc"
diff --git a/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/lib/enum_sig.py b/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/lib/enum_sig.py
index b026a5d20..a5e3247b1 100644
--- a/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/lib/enum_sig.py
+++ b/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/lib/enum_sig.py
@@ -96,11 +96,6 @@ class ExactEnumerator(object):
return ret
def klass(self, class_name, klass):
- modname = klass.__module__
- if not (modname.startswith("PySide2") or modname.startswith("shiboken2")):
- # don't look into any foreign classes!
- ret = self.result_type()
- return ret
bases_list = []
for base in klass.__bases__:
name = base.__name__