aboutsummaryrefslogtreecommitdiffstats
path: root/sources
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-01-06 17:03:40 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-01-06 17:03:40 +0100
commit37cdf54f7b7134b1330ab7e6bf0651f9111759cc (patch)
tree3f1c230cfdbcf0f1382aaabf7cf296bdbb95888d /sources
parenta3e70f98630f79c1857fd45b1be3272e966bfb7d (diff)
parente4aa9e13ac6e4d38c473fc32ea4ace3777df7a57 (diff)
Merge remote-tracking branch 'origin/5.15' into dev
Diffstat (limited to 'sources')
-rw-r--r--sources/pyside2/doc/api.rst94
-rw-r--r--sources/pyside2/doc/index.rst2
-rw-r--r--sources/pyside2/doc/modules.rst2
-rw-r--r--sources/shiboken2/ApiExtractor/CMakeLists.txt3
-rw-r--r--sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp4
-rw-r--r--sources/shiboken2/libshiboken/qapp_macro.cpp65
-rw-r--r--sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/mapping.py4
7 files changed, 117 insertions, 57 deletions
diff --git a/sources/pyside2/doc/api.rst b/sources/pyside2/doc/api.rst
index 2cc258c75..337d383b4 100644
--- a/sources/pyside2/doc/api.rst
+++ b/sources/pyside2/doc/api.rst
@@ -5,64 +5,86 @@
Basic modules
-------------
- These are the main modules that will help you build a Widget based UI.
- :mod:`Qt Core <PySide2.QtCore>`
- Provides core non-GUI functionality, like signal and slots, properties, base classes of item models, serialization, etc.
- :mod:`Qt GUI <PySide2.QtGui>`
- Extends QtCore with GUI functionality: Events, windows and screens, OpenGL and raster-based 2D painting, images.
- :mod:`Qt Widgets <PySide2.QtWidgets>`
- Ready to use Widgets for your application, including also graphical elements for your UI.
+These are the main modules that help you build a Widget-based UI.
+
++---------------------------------------+--------------------------------------------------------+
+| :mod:`Qt Core <PySide2.QtCore>` | Provides core non-GUI functionality, like signal and |
+| | slots, properties, base classes of item models, |
+| | serialization, and more. |
++---------------------------------------+--------------------------------------------------------+
+| :mod:`Qt GUI <PySide2.QtGui>` | Extends QtCore with GUI functionality: Events, windows |
+| | and screens, OpenGL and raster-based 2D painting, as |
+| | well as images. |
++---------------------------------------+--------------------------------------------------------+
+| :mod:`Qt Widgets <PySide2.QtWidgets>` | Provides ready to use Widgets for your application, |
+| | including graphical elements for your UI. |
++---------------------------------------+--------------------------------------------------------+
QML and Qt Quick
----------------
- 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.
- :mod:`Qt QML <PySide2.QtQml>`
- Base Python API to interact with the QML module.
- :mod:`Qt Quick <PySide2.QtQuick>`
- Provides classes for embedding Qt Quick in Qt applications.
- :mod:`Qt QuickWidgets <PySide2.QtQuickWidgets>`
- Provides the QQuickWidget class for embedding Qt Quick in widget-based applications.
+Use these modules to interact with the `QML Language <https://doc.qt.io/qt-5.qmlapplications>`,
+from Python.
+
++-------------------------------------------------+----------------------------------------------+
+| :mod:`Qt QML <PySide2.QtQml>` | The base Python API to interact with the |
+| | module. |
++-------------------------------------------------+----------------------------------------------+
+| :mod:`Qt Quick <PySide2.QtQuick>` | Provides classes to embed Qt Quick in Qt |
+| | applications. |
++-------------------------------------------------+----------------------------------------------+
+| :mod:`Qt QuickWidgets <PySide2.QtQuickWidgets>` | Provides the QQuickWidget class to embed Qt |
+| | Quick in widget-based applications. |
++-------------------------------------------------+----------------------------------------------+
Data visualization
------------------
- Charts and diagrams: these modules provide a large amount
- of classes that can help you include these elements in your UI.
+Charts, diagrams, animations: these modules provide classes to help you include these elements in
+your UI.
- :mod:`Qt Charts <PySide2.QtCharts>`
- Provides a set of easy to use chart components.
- :mod:`Qt DataVisualization <PySide2.QtDataVisualization>`
- Provides a way to visualize data in 3D as bar, scatter, and surface graphs.
++------------------------------------------------------------+-----------------------------------+
+| :mod:`Qt Charts <PySide2.QtCharts>` | Provides a set of easy to use |
+| | chart components. |
++------------------------------------------------------------+-----------------------------------+
+| :mod:`Qt DataVisualization <PySide2.QtDataVisualization>` | Provides a way to visualize data |
+| | in 3D as bar, scatter, or surface |
+| | graphs. |
++------------------------------------------------------------+-----------------------------------+
Multimedia
-----------
- Audio, video, and hardware interaction: check these modules if you are
- looking for multimedia solutions.
+Audio, video, and hardware interaction: use these modules for multimedia solutions.
- :mod:`Qt Multimedia <PySide2.QtMultimedia>`
- Provides low-level multimedia functionality.
- :mod:`Qt MultimediaWidgets <PySide2.QtMultimediaWidgets>`
- Provides the widget-based multimedia API.
++------------------------------------------------------------+-----------------------------------+
+| :mod:`Qt Multimedia <PySide2.QtMultimedia>` | Provides low-level multimedia |
+| | functionality. |
++------------------------------------------------------------+-----------------------------------+
+| :mod:`Qt MultimediaWidgets <PySide2.QtMultimediaWidgets>` | Provides the widget-based |
+| | multimedia API. |
++------------------------------------------------------------+-----------------------------------+
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.
+If your project is based on a browser or the features around Web-based applications, use these
+modules to interact with them.
- :mod:`Qt WebEngineWidgets <PySide2.QtWebEngineWidgets>`
- Provides widgets that can handle web content.
- :mod:`Qt WebChannel <PySide2.QtWebChannel>`
- Enables peer-to-peer communication between a server and a client
- (HTML/JavaScript or QML application).
++---------------------------------------------------------+--------------------------------------+
+| :mod:`Qt WebEngineWidgets <PySide2.QtWebEngineWidgets>` | Provides widgets to handle Web |
+| | content. |
++---------------------------------------------------------+--------------------------------------+
+| :mod:`Qt WebChannel <PySide2.QtWebChannel>` | Enables peer-to-peer communication |
+| | between a server and a client |
+| | (HTML/JavaScript or QML application).|
++---------------------------------------------------------+--------------------------------------+
All the modules
---------------
- Here is a complete list of modules supported by |pymodname|.
+There are many other modules currently supported by |pymodname|, here you can find a complete list
+of them.
- :doc:`Modules <modules>`
+ :doc:`Check all the modules <modules>`
diff --git a/sources/pyside2/doc/index.rst b/sources/pyside2/doc/index.rst
index 93e3451c5..96cbf2ab2 100644
--- a/sources/pyside2/doc/index.rst
+++ b/sources/pyside2/doc/index.rst
@@ -2,7 +2,7 @@
*********
**Qt for Python** offers the official Python bindings for `Qt`_ (`PySide2`_),
-enabling the use of its APIs in Python applications, and a binding generator tool (`Shiboken2`_)
+so that you can use Qt5 APIs in your Python applications, and a binding generator tool (`Shiboken2`_)
which can be used to expose C++ projects into Python.
|project| is available under the LGPLv3/GPLv3 and the Qt commercial license.
diff --git a/sources/pyside2/doc/modules.rst b/sources/pyside2/doc/modules.rst
index d9accd664..bb4b112a1 100644
--- a/sources/pyside2/doc/modules.rst
+++ b/sources/pyside2/doc/modules.rst
@@ -5,7 +5,7 @@ Qt Modules
:hidden:
:glob:
- PySide2/Qt*/*
+ PySide2/Qt*/index
.. list-table::
:widths: 150, 150
diff --git a/sources/shiboken2/ApiExtractor/CMakeLists.txt b/sources/shiboken2/ApiExtractor/CMakeLists.txt
index c2a4c208e..65150eb92 100644
--- a/sources/shiboken2/ApiExtractor/CMakeLists.txt
+++ b/sources/shiboken2/ApiExtractor/CMakeLists.txt
@@ -46,6 +46,9 @@ if(NOT Qt5XmlPatterns_FOUND AND NOT HAS_LIBXSLT)
"Documentation will not be built due to missing dependency (no Qt5XmlPatterns found).")
endif()
+# Export to parent scope so that generator/CMakeLists.txt gets it
+set(DISABLE_DOCSTRINGS ${DISABLE_DOCSTRINGS} PARENT_SCOPE)
+
add_library(apiextractor STATIC ${apiextractor_SRC})
target_include_directories(apiextractor PRIVATE ${CLANG_EXTRA_INCLUDES}
${CMAKE_CURRENT_SOURCE_DIR}
diff --git a/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp b/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp
index 2b7efd6e7..40cc255f0 100644
--- a/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp
+++ b/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp
@@ -1621,9 +1621,9 @@ void QtDocGenerator::generateClass(QTextStream &s, GeneratorContext &classContex
m_docParser->setPackageName(metaClass->package());
m_docParser->fillDocumentation(const_cast<AbstractMetaClass*>(metaClass));
- s << ".. currentmodule:: " << metaClass->package() << Qt::endl;
QString className = getClassTargetFullName(metaClass, false);
- s << ".. _" << className << ":\n\n";
+ s << ".. _" << className << ":" << "\n\n";
+ s << ".. currentmodule:: " << metaClass->package() << "\n\n\n";
s << className << Qt::endl;
s << Pad('*', className.count()) << Qt::endl << Qt::endl;
diff --git a/sources/shiboken2/libshiboken/qapp_macro.cpp b/sources/shiboken2/libshiboken/qapp_macro.cpp
index 306f53b74..827c240c5 100644
--- a/sources/shiboken2/libshiboken/qapp_macro.cpp
+++ b/sources/shiboken2/libshiboken/qapp_macro.cpp
@@ -53,19 +53,17 @@ extern "C"
// variable that monitors Q*Application.instance().
// This variable is also able to destroy the app by deleting qApp.
//
+static const char *mod_names[3] = {"PySide2.QtCore", "PySide2.QtGui", "PySide2.QtWidgets"};
+static const char *app_names[3] = {"QCoreApplication", "QGuiApplication", "QApplication"};
+
static int
qApp_module_index(PyObject *module)
{
const char *name = PyModule_GetName(module);
- int ret = 0;
-
- if (strcmp(name, "PySide2.QtCore") == 0)
- ret = 1;
- else if (strcmp(name, "PySide2.QtGui") == 0)
- ret = 2;
- else if (strcmp(name, "PySide2.QtWidgets") == 0)
- ret = 3;
- return ret;
+ for (int idx = 0; idx < 3; idx++)
+ if (strcmp(name, mod_names[idx]) == 0)
+ return idx + 1;
+ return 0;
}
#define PYTHON_IS_PYTHON3 (PY_VERSION_HEX >= 0x03000000)
@@ -109,6 +107,8 @@ reset_qApp_var(void)
return 0;
}
+static bool app_created = false;
+
/*
* Note:
* The PYSIDE-585 problem was that shutdown is called one more often
@@ -120,7 +120,6 @@ reset_qApp_var(void)
PyObject *
MakeSingletonQAppWrapper(PyTypeObject *type)
{
- static bool app_created = false;
if (type == nullptr)
type = Py_NONE_TYPE;
if (!(type == Py_NONE_TYPE || Py_TYPE(qApp_content) == Py_NONE_TYPE)) {
@@ -163,7 +162,7 @@ MakeSingletonQAppWrapper(PyTypeObject *type)
if (__moduleShutdown != nullptr)
Py_XDECREF(PyObject_CallFunction(__moduleShutdown, const_cast<char *>("()")));
} else {
- PyObject_INIT(qApp_content, type);
+ PyObject_Init(qApp_content, type);
app_created = true;
}
Py_INCREF(qApp_content);
@@ -245,13 +244,45 @@ NotifyModuleForQApp(PyObject *module, void *qApp)
* Therefore, the implementation is very simple and just redirects the
* qApp_contents variable and assigns the instance, instead of vice-versa.
*/
- PyObject *coreDict = qApp_moduledicts[1];
- if (qApp != nullptr && coreDict != nullptr) {
- PyObject *coreApp = PyDict_GetItemString(coreDict, "QCoreApplication");
- if (coreApp != nullptr) {
- qApp_content = PyObject_CallMethod(coreApp, "instance", "");
- reset_qApp_var();
+
+ // PYSIDE-1135: Make sure that at least QtCore gets imported.
+ // That problem exists when a derived instance is created in C++.
+ // PYSIDE-1164: Use the highest Q*Application module possible,
+ // because in embedded mode the instance() seems to be sticky.
+ static bool oneshot_active = false;
+ if (qApp == nullptr || app_created || oneshot_active)
+ return;
+
+ // qApp exists without an application created.
+ // We assume that we are embedded, and we simply try to import all three modules.
+ oneshot_active = true;
+ int mod_found = 0;
+ const char *mod_name, *app_name;
+ const char *thismod_name = PyModule_GetName(module);
+
+ // First go through all three modules, import and set qApp_moduledicts.
+ for (int idx = 0; idx < 3; idx++) {
+ // only import if it is not already the module
+ PyObject *mod = strcmp(thismod_name, mod_names[idx]) == 0 ? module
+ : PyImport_ImportModule(mod_names[idx]);
+ if (mod != nullptr) {
+ mod_found = idx + 1;
+ qApp_moduledicts[mod_found] = PyModule_GetDict(mod);
+ mod_name = PyModule_GetName(mod);
+ app_name = app_names[idx];
+ continue;
}
+ PyErr_Clear();
+ }
+
+ // Then take the highest module and call instance() on it.
+ if (mod_found) {
+ PyObject *mod_dict = qApp_moduledicts[mod_found];
+ PyObject *app_class = PyDict_GetItemString(mod_dict, app_name);
+ qApp_content = PyObject_CallMethod(app_class, const_cast<char *>("instance"),
+ const_cast<char *>(""));
+ app_created = true;
+ reset_qApp_var();
}
}
diff --git a/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/mapping.py b/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/mapping.py
index 2110ebe7a..0767e8fd4 100644
--- a/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/mapping.py
+++ b/sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/mapping.py
@@ -489,6 +489,10 @@ def init_PySide2_QtCore():
PySide2.QtCore.QCborStringResultByteArray,
"PySide2.QtCore.QCborStreamReader.StringResult[QString]":
PySide2.QtCore.QCborStringResultString,
+ "PySide2.QtCore.QCborStreamReader.QCborStringResultByteArray":
+ PySide2.QtCore.QCborStringResultByteArray, # 5.14, why?
+ "PySide2.QtCore.QCborStreamReader.QCborStringResultString":
+ PySide2.QtCore.QCborStringResultString, # 5.14, why?
"PySide2.QtCore.QUrl.ComponentFormattingOptions":
PySide2.QtCore.QUrl.ComponentFormattingOption, # mismatch option/enum, why???
"PyUnicode": typing.Text,