aboutsummaryrefslogtreecommitdiffstats
path: root/sources
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2018-04-17 16:06:59 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2018-04-17 16:09:00 +0200
commit40196663ea7e9d1a55c0991bfee593d02a992fd7 (patch)
treecfa99c89541488bf42c5709c95e33df2149a6fe0 /sources
parentac5d069b678bb95cd509e22c8ae9f5ef4ae0f838 (diff)
parent2156651b39fbb6717ed936c94dcd28295436e0a4 (diff)
Merge remote-tracking branch 'origin/5.11' into dev
Diffstat (limited to 'sources')
-rw-r--r--sources/pyside2/PySide2/Qt3DRender/CMakeLists.txt8
-rw-r--r--sources/pyside2/PySide2/Qt3DRender/typesystem_3drender.xml9
-rw-r--r--sources/pyside2/PySide2/QtCharts/typesystem_charts.xml2
-rw-r--r--sources/pyside2/PySide2/QtCore/CMakeLists.txt1
-rw-r--r--sources/pyside2/PySide2/QtCore/typesystem_core_common.xml3
-rw-r--r--sources/pyside2/PySide2/QtGui/CMakeLists.txt1
-rw-r--r--sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml3
-rw-r--r--sources/pyside2/PySide2/QtMultimedia/CMakeLists.txt5
-rw-r--r--sources/pyside2/PySide2/QtMultimedia/typesystem_multimedia_common.xml1
-rw-r--r--sources/pyside2/PySide2/QtNetwork/typesystem_network.xml5
-rw-r--r--sources/pyside2/doc/extras/PySide.QtHelp.rst19
-rw-r--r--sources/pyside2/doc/inheritance_diagram.py3
-rw-r--r--sources/pyside2/tests/QtCore/qabstractitemmodel_test.py4
-rw-r--r--sources/pyside2/tests/QtGui/CMakeLists.txt1
-rw-r--r--sources/pyside2/tests/QtGui/bug_300_test.py3
-rw-r--r--sources/pyside2/tests/QtGui/bug_716.py3
-rw-r--r--sources/pyside2/tests/QtPrintSupport/CMakeLists.txt3
-rw-r--r--sources/pyside2/tests/QtPrintSupport/bug_500.py (renamed from sources/pyside2/tests/QtGui/bug_500.py)0
-rw-r--r--sources/pyside2/tests/QtPrintSupport/returnquadruplesofnumbers_test.py (renamed from sources/pyside2/tests/QtWidgets/returnquadruplesofnumbers_test.py)20
-rw-r--r--sources/pyside2/tests/QtTest/CMakeLists.txt1
-rw-r--r--sources/pyside2/tests/QtTest/qvalidator_test.py (renamed from sources/pyside2/tests/QtWidgets/qvalidator_test.py)0
-rw-r--r--sources/pyside2/tests/QtWidgets/CMakeLists.txt2
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp11
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetabuilder_p.h2
-rw-r--r--sources/shiboken2/ApiExtractor/fileout.cpp34
-rw-r--r--sources/shiboken2/ApiExtractor/fileout.h6
-rw-r--r--sources/shiboken2/ApiExtractor/tests/testaddfunction.cpp12
-rw-r--r--sources/shiboken2/ApiExtractor/typedatabase.cpp10
-rw-r--r--sources/shiboken2/ApiExtractor/typedatabase.h3
-rw-r--r--sources/shiboken2/ApiExtractor/typesystem.cpp98
-rw-r--r--sources/shiboken2/ApiExtractor/typesystem.h54
-rw-r--r--sources/shiboken2/ApiExtractor/typesystem_p.h5
-rw-r--r--sources/shiboken2/CMakeLists.txt2
-rw-r--r--sources/shiboken2/generator/generator.h2
-rw-r--r--sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp33
-rw-r--r--sources/shiboken2/generator/qtdoc/qtdocgenerator.h18
-rw-r--r--sources/shiboken2/generator/shiboken2/cppgenerator.cpp6
-rw-r--r--sources/shiboken2/generator/shiboken2/cppgenerator.h2
-rw-r--r--sources/shiboken2/generator/shiboken2/headergenerator.cpp6
-rw-r--r--sources/shiboken2/generator/shiboken2/headergenerator.h2
-rw-r--r--sources/shiboken2/libshiboken/qapp_macro.cpp7
41 files changed, 237 insertions, 173 deletions
diff --git a/sources/pyside2/PySide2/Qt3DRender/CMakeLists.txt b/sources/pyside2/PySide2/Qt3DRender/CMakeLists.txt
index 07bd3d89f..1b859ca1e 100644
--- a/sources/pyside2/PySide2/Qt3DRender/CMakeLists.txt
+++ b/sources/pyside2/PySide2/Qt3DRender/CMakeLists.txt
@@ -117,6 +117,14 @@ if (Qt53DRender_VERSION VERSION_EQUAL 5.10.0 OR Qt53DRender_VERSION VERSION_GREA
)
endif()
+if (Qt53DRender_VERSION VERSION_EQUAL 5.11.0 OR Qt53DRender_VERSION VERSION_GREATER 5.11.0)
+ list(APPEND Qt3DRender_SRC
+ ${Qt3DRender_GEN_DIR}/qt3drender_qabstractraycaster_wrapper.cpp
+ ${Qt3DRender_GEN_DIR}/qt3drender_qraycaster_wrapper.cpp
+ ${Qt3DRender_GEN_DIR}/qt3drender_qraycasterhit_wrapper.cpp
+ ${Qt3DRender_GEN_DIR}/qt3drender_qscreenraycaster_wrapper.cpp)
+endif()
+
set(Qt3DRender_include_dirs
${Qt3DRender_SOURCE_DIR}
${Qt3DRender_BINARY_DIR}
diff --git a/sources/pyside2/PySide2/Qt3DRender/typesystem_3drender.xml b/sources/pyside2/PySide2/Qt3DRender/typesystem_3drender.xml
index cfa332742..013c79f37 100644
--- a/sources/pyside2/PySide2/Qt3DRender/typesystem_3drender.xml
+++ b/sources/pyside2/PySide2/Qt3DRender/typesystem_3drender.xml
@@ -48,6 +48,10 @@
<object-type name="QAbstractLight">
<enum-type name="Type"/>
</object-type>
+ <object-type name="QAbstractRayCaster" since="5.11">
+ <enum-type name="RunMode"/>
+ <enum-type name="FilterMode"/>
+ </object-type>
<object-type name="QAbstractTexture">
<enum-type name="CubeMapFace"/>
<enum-type name="ComparisonFunction"/>
@@ -163,6 +167,10 @@
</object-type>
<object-type name="QPolygonOffset"/>
<object-type name="QProximityFilter" since="5.10"/>
+ <object-type name="QRayCaster" since="5.11"/>
+ <value-type name="QRayCasterHit" since="5.11">
+ <enum-type name="HitType"/>
+ </value-type>
<object-type name="QRenderAspect">
<enum-type name="RenderType"/>
</object-type>
@@ -186,6 +194,7 @@
<enum-type name="ComponentType"/>
</object-type>
<object-type name="QScissorTest"/>
+ <object-type name="QScreenRayCaster" since="5.11"/>
<object-type name="QSeamlessCubemap"/>
<object-type name="QShaderData"/>
<object-type name="QShaderProgram">
diff --git a/sources/pyside2/PySide2/QtCharts/typesystem_charts.xml b/sources/pyside2/PySide2/QtCharts/typesystem_charts.xml
index ca7646421..5932365a7 100644
--- a/sources/pyside2/PySide2/QtCharts/typesystem_charts.xml
+++ b/sources/pyside2/PySide2/QtCharts/typesystem_charts.xml
@@ -72,7 +72,7 @@
<object-type name="QChart" since="5.7">
<enum-type name="ChartType"/>
<enum-type name="ChartTheme"/>
- <enum-type name="AnimationOption"/>
+ <enum-type name="AnimationOption" flags="AnimationOptions"/>
<modify-function signature="addSeries(QAbstractSeries*)">
<modify-argument index="1">
<parent index="this" action="add"/>
diff --git a/sources/pyside2/PySide2/QtCore/CMakeLists.txt b/sources/pyside2/PySide2/QtCore/CMakeLists.txt
index f2770f802..5a8a41ec5 100644
--- a/sources/pyside2/PySide2/QtCore/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtCore/CMakeLists.txt
@@ -121,6 +121,7 @@ ${QtCore_GEN_DIR}/qstatemachine_signalevent_wrapper.cpp
${QtCore_GEN_DIR}/qstatemachine_wrappedevent_wrapper.cpp
${QtCore_GEN_DIR}/qstatemachine_wrapper.cpp
${QtCore_GEN_DIR}/qstorageinfo_wrapper.cpp
+${QtCore_GEN_DIR}/qstringlistmodel_wrapper.cpp
${QtCore_GEN_DIR}/qsysinfo_wrapper.cpp
${QtCore_GEN_DIR}/qsystemsemaphore_wrapper.cpp
${QtCore_GEN_DIR}/qt_wrapper.cpp
diff --git a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
index 554111e35..360cc3983 100644
--- a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
+++ b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
@@ -1785,6 +1785,7 @@
</value-type>
<value-type name="QUuid">
+ <enum-type name="StringFormat" since="5.11"/>
<enum-type name="Variant"/>
<enum-type name="Version"/>
<add-function signature="__repr__" return-type="PyObject*">
@@ -2031,6 +2032,7 @@
</object-type>
<object-type name="QAbstractItemModel">
+ <enum-type name="CheckIndexOption" flags="CheckIndexOptions" class="yes" since="5.11"/>
<enum-type name="LayoutChangeHint" />
<!-- This function was replaced by a added function -->
<modify-function signature="createIndex(int, int, void*) const" remove="all"/>
@@ -4224,6 +4226,7 @@ s1.addTransition(button.clicked, s1h)&lt;/code>
<object-type name="QRunnable"/>
<object-type name="QPluginLoader"/>
+ <object-type name="QStringListModel"/>
<suppress-warning text="Unable to decide type of property: 'QLibrary::LoadHints' in class 'QPluginLoader'" />
<suppress-warning text="enum '_ISalnum' does not have a type entry or is not an enum" />
diff --git a/sources/pyside2/PySide2/QtGui/CMakeLists.txt b/sources/pyside2/PySide2/QtGui/CMakeLists.txt
index 784280ca6..807f9b31e 100644
--- a/sources/pyside2/PySide2/QtGui/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtGui/CMakeLists.txt
@@ -121,7 +121,6 @@ ${QtGui_GEN_DIR}/qshowevent_wrapper.cpp
${QtGui_GEN_DIR}/qstandarditem_wrapper.cpp
${QtGui_GEN_DIR}/qstandarditemmodel_wrapper.cpp
${QtGui_GEN_DIR}/qstatustipevent_wrapper.cpp
-${QtGui_GEN_DIR}/qstringlistmodel_wrapper.cpp
${QtGui_GEN_DIR}/qopenglbuffer_wrapper.cpp
${QtGui_GEN_DIR}/qopenglcontext_wrapper.cpp
${QtGui_GEN_DIR}/qaccessible_wrapper.cpp
diff --git a/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml b/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml
index 0f6d48968..0c43fde1f 100644
--- a/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml
+++ b/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml
@@ -1655,7 +1655,6 @@
<!-- ??? -->
<modify-function signature="operator&lt;(QStandardItem)const" remove="all"/>
</object-type>
- <object-type name="QStringListModel"/>
<object-type name="QSyntaxHighlighter">
<modify-function signature="setCurrentBlockUserData(QTextBlockUserData*)">
<modify-argument index="1">
@@ -1762,7 +1761,7 @@
<object-type name="QDropEvent" polymorphic-id-expression="%1-&gt;type() == QEvent::Drop">
<modify-function signature="source() const">
<modify-argument index="return">
- <define-ownership owner="target"/>
+ <define-ownership class="target" owner="default" />
</modify-argument>
</modify-function>
</object-type>
diff --git a/sources/pyside2/PySide2/QtMultimedia/CMakeLists.txt b/sources/pyside2/PySide2/QtMultimedia/CMakeLists.txt
index cfca07862..030426b05 100644
--- a/sources/pyside2/PySide2/QtMultimedia/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtMultimedia/CMakeLists.txt
@@ -82,6 +82,11 @@ ${QtMultimedia_GEN_DIR}/qvideowindowcontrol_wrapper.cpp
${QtMultimedia_GEN_DIR}/qtmultimedia_module_wrapper.cpp
)
+if (Qt5Multimedia_VERSION VERSION_EQUAL 5.11.0 OR Qt5Multimedia_VERSION VERSION_GREATER 5.11.0)
+ list(APPEND QtMultimedia_SRC
+ ${QtMultimedia_GEN_DIR}/qcustomaudiorolecontrol_wrapper.cpp)
+endif()
+
set(QtMultimedia_include_dirs ${QtMultimedia_SOURCE_DIR}
${QtMultimedia_BINARY_DIR}
${Qt5Core_INCLUDE_DIRS}
diff --git a/sources/pyside2/PySide2/QtMultimedia/typesystem_multimedia_common.xml b/sources/pyside2/PySide2/QtMultimedia/typesystem_multimedia_common.xml
index 8058954a1..35effbc73 100644
--- a/sources/pyside2/PySide2/QtMultimedia/typesystem_multimedia_common.xml
+++ b/sources/pyside2/PySide2/QtMultimedia/typesystem_multimedia_common.xml
@@ -264,6 +264,7 @@
<value-type name="QMediaContent"/>
<object-type name="QMediaGaplessPlaybackControl"/>
<object-type name="QMediaControl"/>
+ <object-type name="QCustomAudioRoleControl" since="5.11"/>
<object-type name="QMediaNetworkAccessControl"/>
<!-- Causes compile errors
<namespace-type name="QMediaMetaData"/>
diff --git a/sources/pyside2/PySide2/QtNetwork/typesystem_network.xml b/sources/pyside2/PySide2/QtNetwork/typesystem_network.xml
index 06a402e3c..4e47c6ef5 100644
--- a/sources/pyside2/PySide2/QtNetwork/typesystem_network.xml
+++ b/sources/pyside2/PySide2/QtNetwork/typesystem_network.xml
@@ -192,10 +192,13 @@
<modify-function signature="lookupHost(QString,QObject*,const char*)" access="private"/>
</value-type>
- <value-type name="QNetworkAddressEntry" />
+ <value-type name="QNetworkAddressEntry">
+ <enum-type name="DnsEligibilityStatus" since="5.11"/>
+ </value-type>
<value-type name="QNetworkInterface">
<enum-type name="InterfaceFlag" flags="InterfaceFlags"/>
+ <enum-type name="InterfaceType" since="5.11"/>
</value-type>
<value-type name="QNetworkProxy">
diff --git a/sources/pyside2/doc/extras/PySide.QtHelp.rst b/sources/pyside2/doc/extras/PySide.QtHelp.rst
index 5e101a795..239f4faa6 100644
--- a/sources/pyside2/doc/extras/PySide.QtHelp.rst
+++ b/sources/pyside2/doc/extras/PySide.QtHelp.rst
@@ -3,22 +3,3 @@ To include the definitions of the module's classes, use the following directive:
::
import PySide2.QtHelp
-
-License Information
--------------------
-
-The QtHelp module uses the CLucene indexing library to provide full-text searching capabilities for Qt Assistant and applications that use the features of QtHelp.
-
-Qt Commercial Edition licensees that wish to distribute applications that use these features of the QtHelp module need to be aware of their obligations under the GNU Lesser General Public License (LGPL).
-
-Developers using the Open Source Edition can choose to redistribute the module under the appropriate version of the GNU LGPL; version 2.1 for applications and libraries licensed under the GNU GPL version 2, or version 3 for applications and libraries licensed under the GNU GPL version 3.
-
-Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
-
-Changes are Copyright (C) 2016 The Qt Company Ltd.
-
-This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
-
-This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
diff --git a/sources/pyside2/doc/inheritance_diagram.py b/sources/pyside2/doc/inheritance_diagram.py
index 038c22f29..054cb7be9 100644
--- a/sources/pyside2/doc/inheritance_diagram.py
+++ b/sources/pyside2/doc/inheritance_diagram.py
@@ -47,10 +47,9 @@ except ImportError:
from md5 import md5
from docutils import nodes
-from docutils.parsers.rst import directives
+from docutils.parsers.rst import directives, Directive
from sphinx.ext.graphviz import render_dot_html, render_dot_latex
-from sphinx.util.compat import Directive
class InheritanceException(Exception):
pass
diff --git a/sources/pyside2/tests/QtCore/qabstractitemmodel_test.py b/sources/pyside2/tests/QtCore/qabstractitemmodel_test.py
index 0c9da65c5..a59b5c64c 100644
--- a/sources/pyside2/tests/QtCore/qabstractitemmodel_test.py
+++ b/sources/pyside2/tests/QtCore/qabstractitemmodel_test.py
@@ -43,6 +43,10 @@ class TestQModelIndexInternalPointer(unittest.TestCase):
m = MyModel()
foo = Foo()
idx = m.createIndex(0,0, foo)
+ check = m.checkIndex(idx, QAbstractItemModel.CheckIndexOption.IndexIsValid
+ | QAbstractItemModel.CheckIndexOption.DoNotUseParent
+ | QAbstractItemModel.CheckIndexOption.ParentIsInvalid)
+ self.assertTrue(check)
def testPassQPersistentModelIndexAsQModelIndex(self):
# Related to bug #716
diff --git a/sources/pyside2/tests/QtGui/CMakeLists.txt b/sources/pyside2/tests/QtGui/CMakeLists.txt
index eeb7c7e36..b487a2401 100644
--- a/sources/pyside2/tests/QtGui/CMakeLists.txt
+++ b/sources/pyside2/tests/QtGui/CMakeLists.txt
@@ -3,7 +3,6 @@
PYSIDE_TEST(bug_300_test.py)
PYSIDE_TEST(bug_367.py)
PYSIDE_TEST(bug_480.py)
-PYSIDE_TEST(bug_500.py)
PYSIDE_TEST(bug_606.py)
PYSIDE_TEST(bug_617.py)
PYSIDE_TEST(bug_652.py)
diff --git a/sources/pyside2/tests/QtGui/bug_300_test.py b/sources/pyside2/tests/QtGui/bug_300_test.py
index 1ab71569a..e8adca014 100644
--- a/sources/pyside2/tests/QtGui/bug_300_test.py
+++ b/sources/pyside2/tests/QtGui/bug_300_test.py
@@ -26,8 +26,7 @@
##
#############################################################################
-from PySide2.QtGui import QStringListModel
-from PySide2.QtCore import QModelIndex
+from PySide2.QtCore import QModelIndex, QStringListModel
import unittest
class TestQAbstractItemModelSignals(unittest.TestCase):
diff --git a/sources/pyside2/tests/QtGui/bug_716.py b/sources/pyside2/tests/QtGui/bug_716.py
index 49a329bc2..8bf07d6e2 100644
--- a/sources/pyside2/tests/QtGui/bug_716.py
+++ b/sources/pyside2/tests/QtGui/bug_716.py
@@ -26,8 +26,7 @@
##
#############################################################################
-from PySide2.QtCore import Qt, QPersistentModelIndex
-from PySide2.QtGui import QStringListModel
+from PySide2.QtCore import Qt, QPersistentModelIndex, QStringListModel
if __name__ == '__main__':
stringListModel = QStringListModel(['one', 'two'])
diff --git a/sources/pyside2/tests/QtPrintSupport/CMakeLists.txt b/sources/pyside2/tests/QtPrintSupport/CMakeLists.txt
index 2f7cb08b9..510c5fe0b 100644
--- a/sources/pyside2/tests/QtPrintSupport/CMakeLists.txt
+++ b/sources/pyside2/tests/QtPrintSupport/CMakeLists.txt
@@ -1 +1,2 @@
-# Please add some tests, here
+PYSIDE_TEST(bug_500.py)
+PYSIDE_TEST(returnquadruplesofnumbers_test.py)
diff --git a/sources/pyside2/tests/QtGui/bug_500.py b/sources/pyside2/tests/QtPrintSupport/bug_500.py
index b6f941633..b6f941633 100644
--- a/sources/pyside2/tests/QtGui/bug_500.py
+++ b/sources/pyside2/tests/QtPrintSupport/bug_500.py
diff --git a/sources/pyside2/tests/QtWidgets/returnquadruplesofnumbers_test.py b/sources/pyside2/tests/QtPrintSupport/returnquadruplesofnumbers_test.py
index 6e4cfeb63..f6f2490f0 100644
--- a/sources/pyside2/tests/QtWidgets/returnquadruplesofnumbers_test.py
+++ b/sources/pyside2/tests/QtPrintSupport/returnquadruplesofnumbers_test.py
@@ -30,7 +30,7 @@ from __future__ import print_function
import unittest
from PySide2.QtGui import QTextCursor
-from PySide2.QtPrintSupport import QPrinter
+from PySide2.QtPrintSupport import QPrinter, QPrinterInfo
from PySide2.QtWidgets import QLayout, QWidget, QGraphicsLayout, QGraphicsLayoutItem
from helper import UsesQApplication
@@ -81,14 +81,22 @@ class ReturnsQuadruplesOfNumbers(UsesQApplication):
self.assertEqual(obj.selectedTableCells(), (-1, -1, -1, -1))
def testQPrinterGetPageMargins(self):
- # Bug #742
- obj = QPrinter()
+ # Bug #742. Find a printer like PDF/XPS on which arbitrary margins can be set.
+ printer = None
+ for printerInfo in QPrinterInfo.availablePrinters():
+ name = printerInfo.printerName().lower()
+ if "xps" in name or "pdf" in name:
+ printer = QPrinter(printerInfo)
+ break
+ if not printer:
+ printer = QPrinter()
# On macOS the minimum margin of a page is ~12, setting something lower than that will
# actually fail to set all the margins.
values = (15.0, 16.0, 17.0, 18.0, QPrinter.Point)
- obj.setPageMargins(*values)
- print(obj.getPageMargins(QPrinter.Point), values[:-1])
- self.assertTrue(self.compareTuples(obj.getPageMargins(QPrinter.Point), values[:-1]))
+ printer.setPageMargins(*values)
+ actual = printer.getPageMargins(QPrinter.Point)
+ print(printer.printerName(), actual, values[:-1])
+ self.assertTrue(self.compareTuples(actual, values[:-1]))
if __name__ == "__main__":
unittest.main()
diff --git a/sources/pyside2/tests/QtTest/CMakeLists.txt b/sources/pyside2/tests/QtTest/CMakeLists.txt
index 2a95b70f7..cf72dfa5c 100644
--- a/sources/pyside2/tests/QtTest/CMakeLists.txt
+++ b/sources/pyside2/tests/QtTest/CMakeLists.txt
@@ -2,3 +2,4 @@ PYSIDE_TEST(click_test.py)
PYSIDE_TEST(eventfilter_test.py)
# The test is currently permanently broken, needs to be fixed.
#PYSIDE_TEST(touchevent_test.py)
+PYSIDE_TEST(qvalidator_test.py)
diff --git a/sources/pyside2/tests/QtWidgets/qvalidator_test.py b/sources/pyside2/tests/QtTest/qvalidator_test.py
index dd5eaadb3..dd5eaadb3 100644
--- a/sources/pyside2/tests/QtWidgets/qvalidator_test.py
+++ b/sources/pyside2/tests/QtTest/qvalidator_test.py
diff --git a/sources/pyside2/tests/QtWidgets/CMakeLists.txt b/sources/pyside2/tests/QtWidgets/CMakeLists.txt
index 4efd9d803..fa64d1c3b 100644
--- a/sources/pyside2/tests/QtWidgets/CMakeLists.txt
+++ b/sources/pyside2/tests/QtWidgets/CMakeLists.txt
@@ -123,13 +123,11 @@ PYSIDE_TEST(qtextedit_signal_test.py)
PYSIDE_TEST(qtreeview_test.py)
PYSIDE_TEST(qtoolbar_test.py)
PYSIDE_TEST(qtoolbox_test.py)
-PYSIDE_TEST(qvalidator_test.py)
PYSIDE_TEST(qvariant_test.py)
PYSIDE_TEST(qwidget_setlayout_test.py)
PYSIDE_TEST(qwidget_test.py)
PYSIDE_TEST(qcolormap_test.py)
PYSIDE_TEST(reference_count_test.py)
-PYSIDE_TEST(returnquadruplesofnumbers_test.py)
PYSIDE_TEST(standardpixmap_test.py)
PYSIDE_TEST(test_module_template.py)
PYSIDE_TEST(virtual_protected_inheritance_test.py)
diff --git a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
index 37b82e99f..1afc7d135 100644
--- a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
+++ b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
@@ -1053,7 +1053,7 @@ AbstractMetaEnum *AbstractMetaBuilderPrivate::traverseEnum(EnumModelItem enumIte
QString nspace;
if (names.size() > 1)
nspace = QStringList(names.mid(0, names.size() - 1)).join(colonColon());
- typeEntry = new EnumTypeEntry(nspace, enumName, 0);
+ typeEntry = new EnumTypeEntry(nspace, enumName, QVersionNumber(0, 0));
TypeDatabase::instance()->addType(typeEntry);
} else if (!enumItem->isAnonymous()) {
typeEntry = TypeDatabase::instance()->findType(qualifiedName);
@@ -1937,7 +1937,7 @@ AbstractMetaFunction* AbstractMetaBuilderPrivate::traverseFunction(const AddedFu
metaFunction->setUserAdded(true);
AbstractMetaAttributes::Attribute isStatic = addedFunc.isStatic() ? AbstractMetaFunction::Static : AbstractMetaFunction::None;
metaFunction->setAttributes(metaFunction->attributes() | AbstractMetaAttributes::FinalInTargetLang | isStatic);
- metaFunction->setType(translateType(addedFunc.version(), addedFunc.returnType()));
+ metaFunction->setType(translateType(addedFunc.returnType()));
QVector<AddedFunction::TypeInfo> args = addedFunc.arguments();
@@ -1946,7 +1946,7 @@ AbstractMetaFunction* AbstractMetaBuilderPrivate::traverseFunction(const AddedFu
for (int i = 0; i < args.count(); ++i) {
AddedFunction::TypeInfo& typeInfo = args[i];
AbstractMetaArgument *metaArg = new AbstractMetaArgument;
- AbstractMetaType* type = translateType(addedFunc.version(), typeInfo);
+ AbstractMetaType *type = translateType(typeInfo);
decideUsagePattern(type);
metaArg->setType(type);
metaArg->setArgumentIndex(i);
@@ -2404,8 +2404,7 @@ AbstractMetaFunction *AbstractMetaBuilderPrivate::traverseFunction(FunctionModel
return metaFunction;
}
-AbstractMetaType *AbstractMetaBuilderPrivate::translateType(double vr,
- const AddedFunction::TypeInfo &typeInfo)
+AbstractMetaType *AbstractMetaBuilderPrivate::translateType(const AddedFunction::TypeInfo &typeInfo)
{
Q_ASSERT(!typeInfo.name.isEmpty());
TypeDatabase* typeDb = TypeDatabase::instance();
@@ -2462,7 +2461,7 @@ AbstractMetaType *AbstractMetaBuilderPrivate::translateType(double vr,
metaType->setConstant(typeInfo.isConstant);
if (isTemplate) {
for (const QString& templateArg : qAsConst(templateArgs)) {
- AbstractMetaType* metaArgType = translateType(vr, AddedFunction::TypeInfo::fromSignature(templateArg));
+ AbstractMetaType *metaArgType = translateType(AddedFunction::TypeInfo::fromSignature(templateArg));
metaType->addInstantiation(metaArgType);
}
metaType->setTypeUsagePattern(AbstractMetaType::ContainerPattern);
diff --git a/sources/shiboken2/ApiExtractor/abstractmetabuilder_p.h b/sources/shiboken2/ApiExtractor/abstractmetabuilder_p.h
index 9e15541f6..7a2565914 100644
--- a/sources/shiboken2/ApiExtractor/abstractmetabuilder_p.h
+++ b/sources/shiboken2/ApiExtractor/abstractmetabuilder_p.h
@@ -124,7 +124,7 @@ public:
QString fixDefaultValue(ArgumentModelItem item, AbstractMetaType *type,
AbstractMetaFunction *fnc, AbstractMetaClass *,
int argumentIndex);
- AbstractMetaType* translateType(double vr, const AddedFunction::TypeInfo &typeInfo);
+ AbstractMetaType *translateType(const AddedFunction::TypeInfo &typeInfo);
AbstractMetaType *translateType(const TypeInfo &type, bool *ok,
bool resolveType = true,
bool resolveScope = true);
diff --git a/sources/shiboken2/ApiExtractor/fileout.cpp b/sources/shiboken2/ApiExtractor/fileout.cpp
index be0023c3c..4ee5abd52 100644
--- a/sources/shiboken2/ApiExtractor/fileout.cpp
+++ b/sources/shiboken2/ApiExtractor/fileout.cpp
@@ -174,6 +174,27 @@ static void diff(QList<QByteArray> a, QList<QByteArray> b)
FileOut::State FileOut::done()
{
+ QString errorMessage;
+ const State result = done(&errorMessage);
+ if (result == Failure)
+ qCWarning(lcShiboken, "%s", qPrintable(errorMessage));
+ return result;
+}
+
+QString FileOut::msgCannotOpenForReading(const QFile &f)
+{
+ return QStringLiteral("Failed to open file '%1' for reading: %2")
+ .arg(QDir::toNativeSeparators(f.fileName()), f.errorString());
+}
+
+QString FileOut::msgCannotOpenForWriting(const QFile &f)
+{
+ return QStringLiteral("Failed to open file '%1' for writing: %2")
+ .arg(QDir::toNativeSeparators(f.fileName()), f.errorString());
+}
+
+FileOut::State FileOut::done(QString *errorMessage)
+{
Q_ASSERT(!isDone);
if (name.isEmpty())
return Failure;
@@ -186,9 +207,7 @@ FileOut::State FileOut::done()
QByteArray original;
if (info.exists() && (diff || (info.size() == tmp.size()))) {
if (!fileRead.open(QIODevice::ReadOnly)) {
- qCWarning(lcShiboken).noquote().nospace()
- << QStringLiteral("failed to open file '%1' for reading")
- .arg(QDir::toNativeSeparators(fileRead.fileName()));
+ *errorMessage = msgCannotOpenForReading(fileRead);
return Failure;
}
@@ -203,17 +222,14 @@ FileOut::State FileOut::done()
if (!FileOut::dummy) {
QDir dir(info.absolutePath());
if (!dir.mkpath(dir.absolutePath())) {
- qCWarning(lcShiboken).noquote().nospace()
- << QStringLiteral("unable to create directory '%1'")
- .arg(QDir::toNativeSeparators(dir.absolutePath()));
+ *errorMessage = QStringLiteral("unable to create directory '%1'")
+ .arg(QDir::toNativeSeparators(dir.absolutePath()));
return Failure;
}
QFile fileWrite(name);
if (!fileWrite.open(QIODevice::WriteOnly)) {
- qCWarning(lcShiboken).noquote().nospace()
- << QStringLiteral("failed to open file '%1' for writing")
- .arg(QDir::toNativeSeparators(fileWrite.fileName()));
+ *errorMessage = msgCannotOpenForWriting(fileWrite);
return Failure;
}
QTextCodec *codec = QTextCodec::codecForName("UTF-8");
diff --git a/sources/shiboken2/ApiExtractor/fileout.h b/sources/shiboken2/ApiExtractor/fileout.h
index 14ce3a251..de08a824c 100644
--- a/sources/shiboken2/ApiExtractor/fileout.h
+++ b/sources/shiboken2/ApiExtractor/fileout.h
@@ -32,6 +32,8 @@
#include <QtCore/QObject>
#include <QtCore/QTextStream>
+QT_FORWARD_DECLARE_CLASS(QFile)
+
class FileOut : public QObject
{
private:
@@ -49,6 +51,10 @@ public:
}
State done();
+ State done(QString *errorMessage);
+
+ static QString msgCannotOpenForReading(const QFile &f);
+ static QString msgCannotOpenForWriting(const QFile &f);
QTextStream stream;
diff --git a/sources/shiboken2/ApiExtractor/tests/testaddfunction.cpp b/sources/shiboken2/ApiExtractor/tests/testaddfunction.cpp
index bcc5238bc..9ad846a52 100644
--- a/sources/shiboken2/ApiExtractor/tests/testaddfunction.cpp
+++ b/sources/shiboken2/ApiExtractor/tests/testaddfunction.cpp
@@ -36,7 +36,7 @@ void TestAddFunction::testParsingFuncNameAndConstness()
{
// generic test...
const char sig1[] = "func(type1, const type2, const type3* const)";
- AddedFunction f1(QLatin1String(sig1), QLatin1String("void"), 0);
+ AddedFunction f1(QLatin1String(sig1), QLatin1String("void"));
QCOMPARE(f1.name(), QLatin1String("func"));
QCOMPARE(f1.arguments().count(), 3);
AddedFunction::TypeInfo retval = f1.returnType();
@@ -47,7 +47,7 @@ void TestAddFunction::testParsingFuncNameAndConstness()
// test with a ugly template as argument and other ugly stuff
const char sig2[] = " _fu__nc_ ( type1, const type2, const Abc<int& , C<char*> * > * *, const type3* const ) const ";
- AddedFunction f2(QLatin1String(sig2), QLatin1String("const Abc<int& , C<char*> * > * *"), 0);
+ AddedFunction f2(QLatin1String(sig2), QLatin1String("const Abc<int& , C<char*> * > * *"));
QCOMPARE(f2.name(), QLatin1String("_fu__nc_"));
QVector< AddedFunction::TypeInfo > args = f2.arguments();
QCOMPARE(args.count(), 4);
@@ -64,7 +64,7 @@ void TestAddFunction::testParsingFuncNameAndConstness()
// function with no args.
const char sig3[] = "func()";
- AddedFunction f3(QLatin1String(sig3), QLatin1String("void"), 0);
+ AddedFunction f3(QLatin1String(sig3), QLatin1String("void"));
QCOMPARE(f3.name(), QLatin1String("func"));
QCOMPARE(f3.arguments().count(), 0);
}
@@ -181,7 +181,7 @@ void TestAddFunction::testAddFunctionCodeSnippets()
void TestAddFunction::testAddFunctionWithoutParenteses()
{
const char sig1[] = "func";
- AddedFunction f1(QLatin1String(sig1), QLatin1String("void"), 0);
+ AddedFunction f1(QLatin1String(sig1), QLatin1String("void"));
QCOMPARE(f1.name(), QLatin1String("func"));
QCOMPARE(f1.arguments().count(), 0);
@@ -211,7 +211,7 @@ void TestAddFunction::testAddFunctionWithoutParenteses()
void TestAddFunction::testAddFunctionWithDefaultArgs()
{
const char sig1[] = "func";
- AddedFunction f1(QLatin1String(sig1), QLatin1String("void"), 0);
+ AddedFunction f1(QLatin1String(sig1), QLatin1String("void"));
QCOMPARE(f1.name(), QLatin1String("func"));
QCOMPARE(f1.arguments().count(), 0);
@@ -276,7 +276,7 @@ void TestAddFunction::testAddFunctionAtModuleLevel()
void TestAddFunction::testAddFunctionWithVarargs()
{
const char sig1[] = "func(int,char,...)";
- AddedFunction f1( QLatin1String(sig1), QLatin1String("void"), 0);
+ AddedFunction f1( QLatin1String(sig1), QLatin1String("void"));
QCOMPARE(f1.name(), QLatin1String("func"));
QCOMPARE(f1.arguments().count(), 3);
diff --git a/sources/shiboken2/ApiExtractor/typedatabase.cpp b/sources/shiboken2/ApiExtractor/typedatabase.cpp
index 76953a51e..e94d952a3 100644
--- a/sources/shiboken2/ApiExtractor/typedatabase.cpp
+++ b/sources/shiboken2/ApiExtractor/typedatabase.cpp
@@ -672,15 +672,9 @@ bool TypeDatabase::setApiVersion(const QString& packageWildcardPattern, const QS
return true;
}
-bool TypeDatabase::checkApiVersion(const QString& package, const QString& version) const
+bool TypeDatabase::checkApiVersion(const QString &package,
+ const QVersionNumber &versionNumber) const
{
- const QVersionNumber versionNumber = QVersionNumber::fromString(version);
- if (versionNumber.isNull()) {
- qCWarning(lcShiboken).noquote().nospace()
- << "checkApiVersion: Invalid version \"" << version << "\" specified for package "
- << package << '.';
- return false;
- }
const ApiVersions &versions = *apiVersions();
for (int i = 0, size = versions.size(); i < size; ++i) {
if (versions.at(i).first.match(package).hasMatch())
diff --git a/sources/shiboken2/ApiExtractor/typedatabase.h b/sources/shiboken2/ApiExtractor/typedatabase.h
index dfddfc300..30d261d35 100644
--- a/sources/shiboken2/ApiExtractor/typedatabase.h
+++ b/sources/shiboken2/ApiExtractor/typedatabase.h
@@ -39,6 +39,7 @@
#include <QtCore/QStringList>
QT_FORWARD_DECLARE_CLASS(QIODevice)
+QT_FORWARD_DECLARE_CLASS(QVersionNumber)
class ComplexTypeEntry;
class ContainerTypeEntry;
@@ -148,7 +149,7 @@ public:
bool setApiVersion(const QString& package, const QString& version);
- bool checkApiVersion(const QString& package, const QString &version) const;
+ bool checkApiVersion(const QString &package, const QVersionNumber &version) const;
bool hasDroppedTypeEntries() const { return !m_dropTypeEntries.isEmpty(); }
diff --git a/sources/shiboken2/ApiExtractor/typesystem.cpp b/sources/shiboken2/ApiExtractor/typesystem.cpp
index 69dccbb86..600536aba 100644
--- a/sources/shiboken2/ApiExtractor/typesystem.cpp
+++ b/sources/shiboken2/ApiExtractor/typesystem.cpp
@@ -215,6 +215,17 @@ static QString msgReaderError(const QXmlStreamReader &reader)
return msgReaderError(reader, reader.errorString());
}
+static QString msgInvalidVersion(const QStringRef &version, const QString &package = QString())
+{
+ QString result;
+ QTextStream str(&result);
+ str << "Invalid version \"" << version << '"';
+ if (!package.isEmpty())
+ str << "\" specified for package " << package;
+ str << '.';
+ return result;
+}
+
bool Handler::parse(QXmlStreamReader &reader)
{
m_error.clear();
@@ -605,7 +616,8 @@ static QString checkSignatureError(const QString& signature, const QString& tag)
}
void Handler::addFlags(const QString &name, QString flagName,
- const QHash<QString, QString> &attributes, double since)
+ const QHash<QString, QString> &attributes,
+ const QVersionNumber &since)
{
FlagsTypeEntry *ftype = new FlagsTypeEntry(QLatin1String("QFlags<") + name + QLatin1Char('>'), since);
ftype->setOriginator(m_currentEnum);
@@ -640,7 +652,7 @@ void Handler::addFlags(const QString &name, QString flagName,
bool Handler::handleSmartPointerEntry(StackElement *element,
QHash<QString, QString> &attributes,
const QString &name,
- double since)
+ const QVersionNumber &since)
{
QString smartPointerType = attributes[QLatin1String("type")];
if (smartPointerType.isEmpty()) {
@@ -692,9 +704,19 @@ bool Handler::startElement(const QStringRef &n, const QXmlStreamAttributes &atts
return true;
}
- if (!m_defaultPackage.isEmpty() && atts.hasAttribute(sinceAttribute())) {
+ QVersionNumber since(0, 0);
+ const QStringRef sinceSpec = atts.value(sinceAttribute());
+ if (!sinceSpec.isNull()) {
+ since = QVersionNumber::fromString(sinceSpec.toString());
+ if (since.isNull()) {
+ m_error = msgInvalidVersion(sinceSpec, m_defaultPackage);
+ return false;
+ }
+ }
+
+ if (!m_defaultPackage.isEmpty() && since > QVersionNumber(0, 0)) {
TypeDatabase* td = TypeDatabase::instance();
- if (!td->checkApiVersion(m_defaultPackage, atts.value(sinceAttribute()).toString())) {
+ if (!td->checkApiVersion(m_defaultPackage, since)) {
++m_ignoreDepth;
return true;
}
@@ -734,7 +756,7 @@ bool Handler::startElement(const QStringRef &n, const QXmlStreamAttributes &atts
QHash<QString, QString> attributes;
attributes.insert(nameAttribute(), QString());
attributes.insert(QLatin1String("revision"), QLatin1String("0"));
- attributes.insert(sinceAttribute(), QLatin1String("0"));
+ attributes.insert(sinceAttribute(), QString()); // dummy for matching allowed attributes
switch (element->type) {
case StackElement::PrimitiveTypeEntry:
@@ -798,7 +820,6 @@ bool Handler::startElement(const QStringRef &n, const QXmlStreamAttributes &atts
fetchAttributeValues(tagName, atts, &attributes);
QString name = attributes[nameAttribute()];
- double since = attributes[sinceAttribute()].toDouble();
if (m_database->hasDroppedTypeEntries()) {
QString identifier = getNamePrefix(element) + QLatin1Char('.');
@@ -1097,7 +1118,7 @@ bool Handler::startElement(const QStringRef &n, const QXmlStreamAttributes &atts
QHash<QString, QString> attributes;
attributes.insert(QLatin1String("mode"), QLatin1String("replace"));
attributes.insert(QLatin1String("format"), QLatin1String("native"));
- attributes.insert(sinceAttribute(), QLatin1String("0"));
+ attributes.insert(sinceAttribute(), QString()); // dummy for matching allowed attributes
fetchAttributeValues(tagName, atts, &attributes);
@@ -1144,7 +1165,7 @@ bool Handler::startElement(const QStringRef &n, const QXmlStreamAttributes &atts
// check the XML tag attributes
QHash<QString, QString> attributes;
attributes.insert(xPathAttribute(), QString());
- attributes.insert(sinceAttribute(), QLatin1String("0"));
+ attributes.insert(sinceAttribute(), QString()); // dummy for matching allowed attributes
fetchAttributeValues(tagName, atts, &attributes);
const int validParent = StackElement::TypeEntryMask
@@ -1179,7 +1200,7 @@ bool Handler::startElement(const QStringRef &n, const QXmlStreamAttributes &atts
element->entry = topElement.entry;
QHash<QString, QString> attributes;
- attributes.insert(sinceAttribute(), QLatin1String("0"));
+ attributes.insert(sinceAttribute(), QString()); // dummy for matching allowed attributes
switch (element->type) {
case StackElement::Root:
attributes.insert(QLatin1String("package"), QString());
@@ -1309,11 +1330,8 @@ bool Handler::startElement(const QStringRef &n, const QXmlStreamAttributes &atts
{ };
};
- double since = 0;
- if (attributes.count() > 0) {
+ if (!attributes.isEmpty())
fetchAttributeValues(tagName, atts, &attributes);
- since = attributes[sinceAttribute()].toDouble();
- }
switch (element->type) {
case StackElement::Root:
@@ -1718,7 +1736,7 @@ bool Handler::startElement(const QStringRef &n, const QXmlStreamAttributes &atts
return false;
}
- AddedFunction func(signature, attributes[QLatin1String("return-type")], since);
+ AddedFunction func(signature, attributes[QLatin1String("return-type")]);
func.setStatic(attributes[QLatin1String("static")] == yesAttributeValue());
if (!signature.contains(QLatin1Char('(')))
signature += QLatin1String("()");
@@ -2082,7 +2100,7 @@ bool Handler::startElement(const QStringRef &n, const QXmlStreamAttributes &atts
return true;
}
-PrimitiveTypeEntry::PrimitiveTypeEntry(const QString &name, double vr) :
+PrimitiveTypeEntry::PrimitiveTypeEntry(const QString &name, const QVersionNumber &vr) :
TypeEntry(name, PrimitiveType, vr),
m_preferredConversion(true),
m_preferredTargetLangType(true)
@@ -2471,8 +2489,7 @@ static AddedFunction::TypeInfo parseType(const QString& signature, int startPos
return result;
}
-AddedFunction::AddedFunction(QString signature, QString returnType, double vr) :
- m_version(vr),
+AddedFunction::AddedFunction(QString signature, const QString &returnType) :
m_access(Public)
{
Q_ASSERT(!returnType.isEmpty());
@@ -2540,7 +2557,8 @@ AddedFunction::TypeInfo AddedFunction::TypeInfo::fromSignature(const QString& si
return parseType(signature);
}
-ComplexTypeEntry::ComplexTypeEntry(const QString &name, TypeEntry::Type t, double vr) :
+ComplexTypeEntry::ComplexTypeEntry(const QString &name, TypeEntry::Type t,
+ const QVersionNumber &vr) :
TypeEntry(QString(name).replace(QLatin1String(".*::"), QString()), t, vr),
m_qualifiedCppName(name),
m_qobject(false),
@@ -2581,7 +2599,7 @@ bool StringTypeEntry::isNativeIdBased() const
return false;
}
-CharTypeEntry::CharTypeEntry(const QString &name, double vr) :
+CharTypeEntry::CharTypeEntry(const QString &name, const QVersionNumber &vr) :
ValueTypeEntry(name, CharType, vr)
{
setCodeGeneration(GenerateNothing);
@@ -2606,7 +2624,7 @@ bool CharTypeEntry::isNativeIdBased() const
return false;
}
-VariantTypeEntry::VariantTypeEntry(const QString &name, double vr) :
+VariantTypeEntry::VariantTypeEntry(const QString &name, const QVersionNumber &vr) :
ValueTypeEntry(name, VariantType, vr)
{
}
@@ -2695,7 +2713,7 @@ bool TypeEntry::isCppPrimitive() const
typedef QHash<const TypeEntry*, CustomConversion*> TypeEntryCustomConversionMap;
Q_GLOBAL_STATIC(TypeEntryCustomConversionMap, typeEntryCustomConversionMap);
-TypeEntry::TypeEntry(const QString &name, TypeEntry::Type t, double vr) :
+TypeEntry::TypeEntry(const QString &name, TypeEntry::Type t, const QVersionNumber &vr) :
m_name(name),
m_type(t),
m_version(vr)
@@ -2729,27 +2747,27 @@ CustomConversion* TypeEntry::customConversion() const
return 0;
}
-TypeSystemTypeEntry::TypeSystemTypeEntry(const QString &name, double vr) :
+TypeSystemTypeEntry::TypeSystemTypeEntry(const QString &name, const QVersionNumber &vr) :
TypeEntry(name, TypeSystemType, vr)
{
}
VoidTypeEntry::VoidTypeEntry() :
- TypeEntry(QLatin1String("void"), VoidType, 0)
+ TypeEntry(QLatin1String("void"), VoidType, QVersionNumber(0, 0))
{
}
VarargsTypeEntry::VarargsTypeEntry() :
- TypeEntry(QLatin1String("..."), VarargsType, 0)
+ TypeEntry(QLatin1String("..."), VarargsType, QVersionNumber(0, 0))
{
}
-TemplateArgumentEntry::TemplateArgumentEntry(const QString &name, double vr) :
+TemplateArgumentEntry::TemplateArgumentEntry(const QString &name, const QVersionNumber &vr) :
TypeEntry(name, TemplateArgumentType, vr)
{
}
-ArrayTypeEntry::ArrayTypeEntry(const TypeEntry *nested_type, double vr) :
+ArrayTypeEntry::ArrayTypeEntry(const TypeEntry *nested_type, const QVersionNumber &vr) :
TypeEntry(QLatin1String("Array"), ArrayType, vr),
m_nestedType(nested_type)
{
@@ -2769,7 +2787,8 @@ QString ArrayTypeEntry::targetLangApiName() const
return QLatin1String("jobjectArray");
}
-EnumTypeEntry::EnumTypeEntry(const QString &nspace, const QString &enumName, double vr) :
+EnumTypeEntry::EnumTypeEntry(const QString &nspace, const QString &enumName,
+ const QVersionNumber &vr) :
TypeEntry(nspace.isEmpty() ? enumName : nspace + QLatin1String("::") + enumName,
EnumType, vr),
m_qualifier(nspace),
@@ -2792,19 +2811,22 @@ QString EnumTypeEntry::targetLangName() const
return m_targetLangName;
}
-EnumValueTypeEntry::EnumValueTypeEntry(const QString& name, const QString& value, const EnumTypeEntry* enclosingEnum, double vr) :
+EnumValueTypeEntry::EnumValueTypeEntry(const QString &name, const QString &value,
+ const EnumTypeEntry *enclosingEnum,
+ const QVersionNumber &vr) :
TypeEntry(name, TypeEntry::EnumValue, vr),
m_value(value),
m_enclosingEnum(enclosingEnum)
{
}
-FlagsTypeEntry::FlagsTypeEntry(const QString &name, double vr) :
+FlagsTypeEntry::FlagsTypeEntry(const QString &name, const QVersionNumber &vr) :
TypeEntry(name, FlagsType, vr)
{
}
-ContainerTypeEntry::ContainerTypeEntry(const QString &name, Type type, double vr) :
+ContainerTypeEntry::ContainerTypeEntry(const QString &name, Type type,
+ const QVersionNumber &vr) :
ComplexTypeEntry(name, ContainerType, vr),
m_type(type)
{
@@ -2815,7 +2837,7 @@ SmartPointerTypeEntry::SmartPointerTypeEntry(const QString &name,
const QString &getterName,
const QString &smartPointerType,
const QString &refCountMethodName,
- double vr) :
+ const QVersionNumber &vr) :
ComplexTypeEntry(name, SmartPointerType, vr),
m_getterName(getterName),
m_smartPointerType(smartPointerType),
@@ -2823,12 +2845,12 @@ SmartPointerTypeEntry::SmartPointerTypeEntry(const QString &name,
{
}
-NamespaceTypeEntry::NamespaceTypeEntry(const QString &name, double vr) :
+NamespaceTypeEntry::NamespaceTypeEntry(const QString &name, const QVersionNumber &vr) :
ComplexTypeEntry(name, NamespaceType, vr)
{
}
-ValueTypeEntry::ValueTypeEntry(const QString &name, double vr) :
+ValueTypeEntry::ValueTypeEntry(const QString &name, const QVersionNumber &vr) :
ComplexTypeEntry(name, BasicValueType, vr)
{
}
@@ -2843,12 +2865,12 @@ bool ValueTypeEntry::isNativeIdBased() const
return true;
}
-ValueTypeEntry::ValueTypeEntry(const QString &name, Type t, double vr) :
+ValueTypeEntry::ValueTypeEntry(const QString &name, Type t, const QVersionNumber &vr) :
ComplexTypeEntry(name, t, vr)
{
}
-StringTypeEntry::StringTypeEntry(const QString &name, double vr) :
+StringTypeEntry::StringTypeEntry(const QString &name, const QVersionNumber &vr) :
ValueTypeEntry(name, StringType, vr)
{
setCodeGeneration(GenerateNothing);
@@ -3007,7 +3029,7 @@ void CustomConversion::TargetToNativeConversion::setConversion(const QString& co
m_d->conversion = conversion;
}
-InterfaceTypeEntry::InterfaceTypeEntry(const QString &name, double vr) :
+InterfaceTypeEntry::InterfaceTypeEntry(const QString &name, const QVersionNumber &vr) :
ComplexTypeEntry(name, InterfaceType, vr)
{
}
@@ -3024,13 +3046,13 @@ QString InterfaceTypeEntry::qualifiedCppName() const
}
FunctionTypeEntry::FunctionTypeEntry(const QString &name, const QString &signature,
- double vr) :
+ const QVersionNumber &vr) :
TypeEntry(name, FunctionType, vr)
{
addSignature(signature);
}
-ObjectTypeEntry::ObjectTypeEntry(const QString &name, double vr)
+ObjectTypeEntry::ObjectTypeEntry(const QString &name, const QVersionNumber &vr)
: ComplexTypeEntry(name, ObjectType, vr)
{
}
diff --git a/sources/shiboken2/ApiExtractor/typesystem.h b/sources/shiboken2/ApiExtractor/typesystem.h
index 62d348f69..2f534c93d 100644
--- a/sources/shiboken2/ApiExtractor/typesystem.h
+++ b/sources/shiboken2/ApiExtractor/typesystem.h
@@ -40,6 +40,7 @@
#include <QtCore/QStringList>
#include <QtCore/QMap>
#include <QtCore/QVector>
+#include <QtCore/QVersionNumber>
//Used to identify the conversion rule to avoid break API
#define TARGET_CONVERSION_RULE_FLAG "0"
@@ -415,7 +416,7 @@ struct AddedFunction
};
/// Creates a new AddedFunction with a signature and a return type.
- explicit AddedFunction(QString signature, QString returnType, double vr);
+ explicit AddedFunction(QString signature, const QString &returnType);
AddedFunction() = default;
/// Returns the function name.
@@ -466,15 +467,10 @@ struct AddedFunction
return m_isStatic;
}
- double version() const
- {
- return m_version;
- }
private:
QString m_name;
QVector<TypeInfo> m_arguments;
TypeInfo m_returnType;
- double m_version = 0;
Access m_access = Protected;
bool m_isConst = false;
bool m_isStatic = false;
@@ -573,7 +569,7 @@ public:
};
Q_ENUM(CodeGeneration)
- explicit TypeEntry(const QString &name, Type t, double vr);
+ explicit TypeEntry(const QString &name, Type t, const QVersionNumber &vr);
virtual ~TypeEntry();
@@ -867,7 +863,7 @@ public:
return !m_conversionRule.isEmpty();
}
- double version() const
+ QVersionNumber version() const
{
return m_version;
}
@@ -903,13 +899,13 @@ private:
QHash<QString, bool> m_includesUsed;
QString m_conversionRule;
bool m_stream = false;
- double m_version;
+ QVersionNumber m_version;
};
class TypeSystemTypeEntry : public TypeEntry
{
public:
- explicit TypeSystemTypeEntry(const QString &name, double vr);
+ explicit TypeSystemTypeEntry(const QString &name, const QVersionNumber &vr);
};
class VoidTypeEntry : public TypeEntry
@@ -927,7 +923,7 @@ public:
class TemplateArgumentEntry : public TypeEntry
{
public:
- explicit TemplateArgumentEntry(const QString &name, double vr);
+ explicit TemplateArgumentEntry(const QString &name, const QVersionNumber &vr);
int ordinal() const
{
@@ -945,7 +941,7 @@ private:
class ArrayTypeEntry : public TypeEntry
{
public:
- explicit ArrayTypeEntry(const TypeEntry *nested_type, double vr);
+ explicit ArrayTypeEntry(const TypeEntry *nested_type, const QVersionNumber &vr);
void setNestedTypeEntry(TypeEntry *nested)
{
@@ -967,7 +963,7 @@ private:
class PrimitiveTypeEntry : public TypeEntry
{
public:
- explicit PrimitiveTypeEntry(const QString &name, double vr);
+ explicit PrimitiveTypeEntry(const QString &name, const QVersionNumber &vr);
QString targetLangName() const override;
void setTargetLangName(const QString &targetLangName)
@@ -1051,7 +1047,8 @@ public:
EnumClass // C++ 11 : enum class Foo { value1, value2 }
};
- explicit EnumTypeEntry(const QString &nspace, const QString &enumName, double vr);
+ explicit EnumTypeEntry(const QString &nspace, const QString &enumName,
+ const QVersionNumber &vr);
QString targetLangPackage() const override;
void setTargetLangPackage(const QString &package);
@@ -1164,7 +1161,7 @@ private:
class EnumValueTypeEntry : public TypeEntry
{
public:
- explicit EnumValueTypeEntry(const QString& name, const QString& value, const EnumTypeEntry* enclosingEnum, double vr);
+ explicit EnumValueTypeEntry(const QString& name, const QString& value, const EnumTypeEntry* enclosingEnum, const QVersionNumber &vr);
QString value() const { return m_value; }
const EnumTypeEntry* enclosingEnum() const { return m_enclosingEnum; }
@@ -1176,7 +1173,7 @@ private:
class FlagsTypeEntry : public TypeEntry
{
public:
- explicit FlagsTypeEntry(const QString &name, double vr);
+ explicit FlagsTypeEntry(const QString &name, const QVersionNumber &vr);
QString qualifiedTargetLangName() const override;
QString targetLangName() const override;
@@ -1240,7 +1237,7 @@ public:
Unknown
};
- explicit ComplexTypeEntry(const QString &name, Type t, double vr);
+ explicit ComplexTypeEntry(const QString &name, Type t, const QVersionNumber &vr);
bool isComplex() const override;
@@ -1458,7 +1455,7 @@ public:
};
Q_ENUM(Type)
- explicit ContainerTypeEntry(const QString &name, Type type, double vr);
+ explicit ContainerTypeEntry(const QString &name, Type type, const QVersionNumber &vr);
Type type() const
{
@@ -1501,7 +1498,7 @@ public:
const QString &getterName,
const QString &smartPointerType,
const QString &refCountMethodName,
- double vr);
+ const QVersionNumber &vr);
QString getter() const
{
@@ -1522,28 +1519,28 @@ private:
class NamespaceTypeEntry : public ComplexTypeEntry
{
public:
- explicit NamespaceTypeEntry(const QString &name, double vr);
+ explicit NamespaceTypeEntry(const QString &name, const QVersionNumber &vr);
};
class ValueTypeEntry : public ComplexTypeEntry
{
public:
- explicit ValueTypeEntry(const QString &name, double vr);
+ explicit ValueTypeEntry(const QString &name, const QVersionNumber &vr);
bool isValue() const override;
bool isNativeIdBased() const override;
protected:
- explicit ValueTypeEntry(const QString &name, Type t, double vr);
+ explicit ValueTypeEntry(const QString &name, Type t, const QVersionNumber &vr);
};
class StringTypeEntry : public ValueTypeEntry
{
public:
- explicit StringTypeEntry(const QString &name, double vr);
+ explicit StringTypeEntry(const QString &name, const QVersionNumber &vr);
QString targetLangApiName() const override;
QString targetLangName() const override;
@@ -1555,7 +1552,7 @@ public:
class CharTypeEntry : public ValueTypeEntry
{
public:
- explicit CharTypeEntry(const QString &name, double vr);
+ explicit CharTypeEntry(const QString &name, const QVersionNumber &vr);
QString targetLangApiName() const override;
QString targetLangName() const override;
@@ -1567,7 +1564,7 @@ public:
class VariantTypeEntry: public ValueTypeEntry
{
public:
- explicit VariantTypeEntry(const QString &name, double vr);
+ explicit VariantTypeEntry(const QString &name, const QVersionNumber &vr);
QString targetLangApiName() const override;
QString targetLangName() const override;
@@ -1580,7 +1577,7 @@ public:
class InterfaceTypeEntry : public ComplexTypeEntry
{
public:
- explicit InterfaceTypeEntry(const QString &name, double vr);
+ explicit InterfaceTypeEntry(const QString &name, const QVersionNumber &vr);
static QString interfaceName(const QString &name)
{
@@ -1607,7 +1604,8 @@ private:
class FunctionTypeEntry : public TypeEntry
{
public:
- explicit FunctionTypeEntry(const QString& name, const QString& signature, double vr);
+ explicit FunctionTypeEntry(const QString& name, const QString& signature,
+ const QVersionNumber &vr);
void addSignature(const QString& signature)
{
m_signatures << signature;
@@ -1629,7 +1627,7 @@ private:
class ObjectTypeEntry : public ComplexTypeEntry
{
public:
- explicit ObjectTypeEntry(const QString &name, double vr);
+ explicit ObjectTypeEntry(const QString &name, const QVersionNumber &vr);
InterfaceTypeEntry *designatedInterface() const override;
void setDesignatedInterface(InterfaceTypeEntry *entry)
diff --git a/sources/shiboken2/ApiExtractor/typesystem_p.h b/sources/shiboken2/ApiExtractor/typesystem_p.h
index d3485726e..d4707acb7 100644
--- a/sources/shiboken2/ApiExtractor/typesystem_p.h
+++ b/sources/shiboken2/ApiExtractor/typesystem_p.h
@@ -145,7 +145,7 @@ private:
bool handleSmartPointerEntry(StackElement *element,
QHash<QString, QString> &attributes,
const QString &name,
- double since);
+ const QVersionNumber &since);
bool endElement(const QStringRef& localName);
template <class String> // QString/QStringRef
bool characters(const String &ch);
@@ -154,7 +154,8 @@ private:
bool importFileElement(const QXmlStreamAttributes &atts);
void addFlags(const QString &name, QString flagName,
- const QHash<QString, QString> &attributes, double since);
+ const QHash<QString, QString> &attributes,
+ const QVersionNumber &since);
TypeDatabase* m_database;
StackElement* m_current;
diff --git a/sources/shiboken2/CMakeLists.txt b/sources/shiboken2/CMakeLists.txt
index d9e110d6d..e774a172b 100644
--- a/sources/shiboken2/CMakeLists.txt
+++ b/sources/shiboken2/CMakeLists.txt
@@ -50,7 +50,7 @@ macro(get_llvm_config)
"
OUTPUT_VARIABLE LLVM_CONFIG
OUTPUT_STRIP_TRAILING_WHITESPACE)
- message("LLMV_CONFIG: " ${LLVM_CONFIG})
+ message("LLVM_CONFIG: " ${LLVM_CONFIG})
endmacro()
set(CLANG_DIR "")
diff --git a/sources/shiboken2/generator/generator.h b/sources/shiboken2/generator/generator.h
index f0b2a5e41..98f3ce4b8 100644
--- a/sources/shiboken2/generator/generator.h
+++ b/sources/shiboken2/generator/generator.h
@@ -366,7 +366,7 @@ protected:
* for which the file name must be returned
* \return the file name used to write the binding code for the class
*/
- virtual QString fileNamePrefix() const = 0;
+ virtual QString fileNameSuffix() const = 0;
virtual QString fileNameForContext(GeneratorContext &context) const = 0;
diff --git a/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp b/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp
index 7cce97ae1..842c68b90 100644
--- a/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp
+++ b/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp
@@ -157,6 +157,14 @@ static QTextStream &ensureEndl(QTextStream &s)
return s;
}
+static void formatSince(QTextStream &s, const char *what, const TypeEntry *te)
+{
+ if (te && te->version() > QVersionNumber(0, 0)) {
+ s << ".. note:: This " << what << " was introduced in Qt "
+ << te->version().toString() << '.' << endl;
+ }
+}
+
static QString msgTagWarning(const QXmlStreamReader &reader, const QString &context,
const QString &tag, const QString &message)
{
@@ -1133,11 +1141,12 @@ void QtXmlToSphinx::Table::normalize()
if (cell.rowSpan > 0) {
QtXmlToSphinx::TableCell newCell;
newCell.rowSpan = -1;
- int max = std::min(cell.rowSpan - 1, count());
+ int targetRow = row + 1;
+ const int targetEndRow =
+ std::min(targetRow + cell.rowSpan - 1, count());
cell.rowSpan = 0;
- for (int i = 0; i < max; ++i) {
- self[row+i+1].insert(col, newCell);
- }
+ for ( ; targetRow < targetEndRow; ++targetRow)
+ self[targetRow].insert(col, newCell);
row++;
}
}
@@ -1275,7 +1284,7 @@ QtDocGenerator::~QtDocGenerator()
delete m_docParser;
}
-QString QtDocGenerator::fileNamePrefix() const
+QString QtDocGenerator::fileNameSuffix() const
{
return QLatin1String(".rst");
}
@@ -1284,11 +1293,11 @@ QString QtDocGenerator::fileNameForContext(GeneratorContext &context) const
{
const AbstractMetaClass *metaClass = context.metaClass();
if (!context.forSmartPointer()) {
- return getClassTargetFullName(metaClass, false) + fileNamePrefix();
+ return getClassTargetFullName(metaClass, false) + fileNameSuffix();
} else {
const AbstractMetaType *smartPointerType = context.preciseType();
QString fileNameBase = getFileNameBaseForSmartPointer(smartPointerType, metaClass);
- return fileNameBase + fileNamePrefix();
+ return fileNameBase + fileNameSuffix();
}
}
@@ -1368,8 +1377,7 @@ void QtDocGenerator::generateClass(QTextStream &s, GeneratorContext &classContex
writeInheritedByList(s, metaClass, classes());
- if (metaClass->typeEntry() && (metaClass->typeEntry()->version() != 0))
- s << ".. note:: This class was introduced in Qt " << metaClass->typeEntry()->version() << endl;
+ formatSince(s, "class", metaClass->typeEntry());
writeFunctionList(s, metaClass);
@@ -1490,9 +1498,7 @@ void QtDocGenerator::writeEnums(QTextStream& s, const AbstractMetaClass* cppClas
for (AbstractMetaEnum *en : enums) {
s << section_title << getClassTargetFullName(cppClass) << '.' << en->name() << endl << endl;
writeFormattedText(s, en->documentation(), cppClass);
-
- if (en->typeEntry() && (en->typeEntry()->version() != 0))
- s << ".. note:: This enum was introduced or modified in Qt " << en->typeEntry()->version() << endl;
+ formatSince(s, "enum", en->typeEntry());
}
}
@@ -1807,8 +1813,7 @@ void QtDocGenerator::writeFunction(QTextStream& s, bool writeDoc, const Abstract
writeFunctionSignature(s, cppClass, func);
s << endl;
- if (func->typeEntry() && (func->typeEntry()->version() != 0))
- s << ".. note:: This method was introduced in Qt " << func->typeEntry()->version() << endl;
+ formatSince(s, "method", func->typeEntry());
if (writeDoc) {
s << endl;
diff --git a/sources/shiboken2/generator/qtdoc/qtdocgenerator.h b/sources/shiboken2/generator/qtdoc/qtdocgenerator.h
index af26b7fab..9f08a4e8d 100644
--- a/sources/shiboken2/generator/qtdoc/qtdocgenerator.h
+++ b/sources/shiboken2/generator/qtdoc/qtdocgenerator.h
@@ -210,14 +210,14 @@ public:
QString docDataDir() const { return m_docDataDir; }
- bool doSetup(const QMap<QString, QString>& args);
+ bool doSetup(const QMap<QString, QString>& args) override;
- const char* name() const
+ const char* name() const override
{
return "QtDocGenerator";
}
- OptionDescriptions options() const;
+ OptionDescriptions options() const override;
QStringList codeSnippetDirs() const
{
@@ -225,13 +225,13 @@ public:
}
protected:
- QString fileNamePrefix() const;
- QString fileNameForContext(GeneratorContext &context) const;
- void generateClass(QTextStream &s, GeneratorContext &classContext);
- bool finishGeneration();
+ QString fileNameSuffix() const override;
+ QString fileNameForContext(GeneratorContext &context) const override;
+ void generateClass(QTextStream &s, GeneratorContext &classContext) override;
+ bool finishGeneration() override;
- void writeFunctionArguments(QTextStream&, const AbstractMetaFunction*, Options) const {}
- void writeArgumentNames(QTextStream&, const AbstractMetaFunction*, Options) const {}
+ void writeFunctionArguments(QTextStream&, const AbstractMetaFunction*, Options) const override {}
+ void writeArgumentNames(QTextStream&, const AbstractMetaFunction*, Options) const override {}
private:
void writeEnums(QTextStream& s, const AbstractMetaClass* cppClass);
diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
index be42adb0f..18670eae6 100644
--- a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
+++ b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
@@ -135,7 +135,7 @@ CppGenerator::CppGenerator()
m_mpFuncs.insert(QLatin1String("__msetitem__"), QLatin1String("mp_ass_subscript"));
}
-QString CppGenerator::fileNamePrefix() const
+QString CppGenerator::fileNameSuffix() const
{
return QLatin1String("_wrapper.cpp");
}
@@ -146,11 +146,11 @@ QString CppGenerator::fileNameForContext(GeneratorContext &context) const
if (!context.forSmartPointer()) {
QString fileNameBase = metaClass->qualifiedCppName().toLower();
fileNameBase.replace(QLatin1String("::"), QLatin1String("_"));
- return fileNameBase + fileNamePrefix();
+ return fileNameBase + fileNameSuffix();
} else {
const AbstractMetaType *smartPointerType = context.preciseType();
QString fileNameBase = getFileNameBaseForSmartPointer(smartPointerType, metaClass);
- return fileNameBase + fileNamePrefix();
+ return fileNameBase + fileNameSuffix();
}
}
diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.h b/sources/shiboken2/generator/shiboken2/cppgenerator.h
index cce1842ab..52da437ee 100644
--- a/sources/shiboken2/generator/shiboken2/cppgenerator.h
+++ b/sources/shiboken2/generator/shiboken2/cppgenerator.h
@@ -39,7 +39,7 @@ class CppGenerator : public ShibokenGenerator
public:
CppGenerator();
protected:
- QString fileNamePrefix() const override;
+ QString fileNameSuffix() const override;
QString fileNameForContext(GeneratorContext &context) const override;
QVector<AbstractMetaFunctionList> filterGroupedOperatorFunctions(const AbstractMetaClass* metaClass,
uint query);
diff --git a/sources/shiboken2/generator/shiboken2/headergenerator.cpp b/sources/shiboken2/generator/shiboken2/headergenerator.cpp
index a033cb69a..3b32825f3 100644
--- a/sources/shiboken2/generator/shiboken2/headergenerator.cpp
+++ b/sources/shiboken2/generator/shiboken2/headergenerator.cpp
@@ -37,7 +37,7 @@
#include <QtCore/QVariant>
#include <QtCore/QDebug>
-QString HeaderGenerator::fileNamePrefix() const
+QString HeaderGenerator::fileNameSuffix() const
{
return QLatin1String("_wrapper.h");
}
@@ -48,11 +48,11 @@ QString HeaderGenerator::fileNameForContext(GeneratorContext &context) const
if (!context.forSmartPointer()) {
QString fileNameBase = metaClass->qualifiedCppName().toLower();
fileNameBase.replace(QLatin1String("::"), QLatin1String("_"));
- return fileNameBase + fileNamePrefix();
+ return fileNameBase + fileNameSuffix();
} else {
const AbstractMetaType *smartPointerType = context.preciseType();
QString fileNameBase = getFileNameBaseForSmartPointer(smartPointerType, metaClass);
- return fileNameBase + fileNamePrefix();
+ return fileNameBase + fileNameSuffix();
}
}
diff --git a/sources/shiboken2/generator/shiboken2/headergenerator.h b/sources/shiboken2/generator/shiboken2/headergenerator.h
index d9dc8ffe8..b6596967c 100644
--- a/sources/shiboken2/generator/shiboken2/headergenerator.h
+++ b/sources/shiboken2/generator/shiboken2/headergenerator.h
@@ -43,7 +43,7 @@ class HeaderGenerator : public ShibokenGenerator
public:
OptionDescriptions options() const override { return OptionDescriptions(); }
protected:
- QString fileNamePrefix() const override;
+ QString fileNameSuffix() const override;
QString fileNameForContext(GeneratorContext &context) const override;
void generateClass(QTextStream& s, GeneratorContext &classContext) override;
bool finishGeneration() override;
diff --git a/sources/shiboken2/libshiboken/qapp_macro.cpp b/sources/shiboken2/libshiboken/qapp_macro.cpp
index b31e98d06..9b940aaaa 100644
--- a/sources/shiboken2/libshiboken/qapp_macro.cpp
+++ b/sources/shiboken2/libshiboken/qapp_macro.cpp
@@ -97,9 +97,10 @@ reset_qApp_var()
for (mod_ptr = qApp_moduledicts; *mod_ptr != NULL; mod_ptr++) {
// We respect whatever the user may have set.
- if (PyDict_GetItem(*mod_ptr, qApp_var) == NULL)
+ if (PyDict_GetItem(*mod_ptr, qApp_var) == NULL) {
if (PyDict_SetItem(*mod_ptr, qApp_var, qApp_content) < 0)
return -1;
+ }
}
return 0;
}
@@ -157,7 +158,9 @@ setup_qApp_var(PyObject *module)
qApp_var = Py_BuildValue("s", "qApp");
if (qApp_var == NULL)
return -1;
+ // This is a borrowed reference
qApp_moduledicts[0] = PyEval_GetBuiltins();
+ Py_INCREF(qApp_content);
init_done = 1;
}
@@ -165,7 +168,9 @@ setup_qApp_var(PyObject *module)
// into __builtins__, to let it appear like a real macro.
module_index = qApp_module_index(module);
if (module_index) {
+ // This line gets a borrowed reference
qApp_moduledicts[module_index] = PyModule_GetDict(module);
+ Py_INCREF(qApp_content);
if (reset_qApp_var() < 0)
return -1;
}