aboutsummaryrefslogtreecommitdiffstats
path: root/sources
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2018-05-18 16:45:35 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2018-05-18 16:45:35 +0200
commit3f8c8702ea295f39357e7c66f46e5138f56bcc9f (patch)
tree9ca65a7f94d544ba4b36f239c4a48852ad8a7b09 /sources
parent5fce76074c01e52a22151133a1e3a2cf71cfe535 (diff)
parentdf1a619d65d8e5db91f3c8db46b00872b461e334 (diff)
Merge remote-tracking branch 'origin/5.9' into 5.11
Diffstat (limited to 'sources')
-rw-r--r--sources/pyside2/CMakeLists.txt28
-rw-r--r--sources/pyside2/PySide2/CMakeLists.txt6
-rw-r--r--sources/pyside2/PySide2/QtCore/CMakeLists.txt5
-rw-r--r--sources/pyside2/PySide2/QtCore/typesystem_core_common.xml59
-rw-r--r--sources/pyside2/PySide2/QtGui/CMakeLists.txt22
-rw-r--r--sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml64
-rw-r--r--sources/pyside2/PySide2/QtMultimedia/CMakeLists.txt15
-rw-r--r--sources/pyside2/PySide2/QtMultimedia/typesystem_multimedia_common.xml23
-rw-r--r--sources/pyside2/PySide2/QtWidgets/CMakeLists.txt4
-rw-r--r--sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml27
-rw-r--r--sources/pyside2/doc/_templates/layout.html2
-rw-r--r--sources/pyside2/doc/_themes/pysidedocs/static/pysidelogo.pngbin12969 -> 9473 bytes
-rw-r--r--sources/pyside2/doc/additionaldocs.lst2
-rw-r--r--sources/pyside2/doc/conf.py.in9
-rw-r--r--sources/pyside2/doc/contents.rst16
-rw-r--r--sources/pyside2/doc/index.rst4
-rw-r--r--sources/pyside2/tests/QtCore/CMakeLists.txt5
-rw-r--r--sources/pyside2/tests/QtCore/blocking_signals_test.py11
-rw-r--r--sources/pyside2/tests/QtCore/qabstractitemmodel_test.py9
-rw-r--r--sources/pyside2/tests/QtCore/qcoreapplication_test.py40
-rw-r--r--sources/pyside2/tests/QtCore/qlockfile_test.py55
-rw-r--r--sources/pyside2/tests/QtCore/qmessageauthenticationcode_test.py45
-rw-r--r--sources/pyside2/tests/QtCore/qoperatingsystemversion_test.py40
-rw-r--r--sources/pyside2/tests/QtCore/qsocketnotifier_test.py59
-rw-r--r--sources/pyside2/tests/QtGui/CMakeLists.txt1
-rw-r--r--sources/pyside2/tests/QtGui/qguiapplication_test.py40
-rw-r--r--sources/pyside2/tests/QtWidgets/CMakeLists.txt1
-rw-r--r--sources/pyside2/tests/QtWidgets/qapplication_test.py40
-rw-r--r--sources/pyside2/tests/QtWidgets/qstyle_test.py26
-rw-r--r--sources/pyside2/tests/registry/exists_darwin_5_9_4_ci.py2
-rw-r--r--sources/pyside2/tests/registry/exists_linux_5_9_4_ci.py2
-rw-r--r--sources/pyside2/tests/registry/exists_win32_5_9_4_ci.py2
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp40
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetalang.cpp25
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetalang.h6
-rw-r--r--sources/shiboken2/ApiExtractor/docparser.cpp7
-rw-r--r--sources/shiboken2/ApiExtractor/qtdocparser.cpp192
-rw-r--r--sources/shiboken2/ApiExtractor/qtdocparser.h9
-rw-r--r--sources/shiboken2/CMakeLists.txt4
-rw-r--r--sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp77
-rw-r--r--sources/shiboken2/generator/shiboken2/shibokengenerator.cpp85
-rw-r--r--sources/shiboken2/generator/shiboken2/shibokengenerator.h3
-rw-r--r--sources/shiboken2/tests/libsample/objecttype.h4
-rw-r--r--sources/shiboken2/tests/samplebinding/enum_test.py8
44 files changed, 939 insertions, 185 deletions
diff --git a/sources/pyside2/CMakeLists.txt b/sources/pyside2/CMakeLists.txt
index 3e56881df..d4150c93b 100644
--- a/sources/pyside2/CMakeLists.txt
+++ b/sources/pyside2/CMakeLists.txt
@@ -17,8 +17,8 @@ if (USE_PYTHON_VERSION)
find_package(PythonInterp ${USE_PYTHON_VERSION} REQUIRED)
find_package(PythonLibs ${USE_PYTHON_VERSION} REQUIRED)
else()
- find_package(PythonInterp 2.6)
- find_package(PythonLibs 2.6)
+ find_package(PythonInterp 2.7)
+ find_package(PythonLibs 2.7)
endif()
set(PYSIDE_VERSION_FILE_PATH "${CMAKE_SOURCE_DIR}/pyside_version.py")
@@ -293,19 +293,20 @@ macro(COLLECT_MODULE_IF_FOUND shortname)
endif()
# If the module was found, and also the module path is the same as the
- # Qt5Core base path, we will generate the list with the modules to be install
+ # Qt5Core base path, we will generate the list with the modules to be installed
+ set(looked_in_message ". Looked in: ${${_name_dir}}")
if("${${_name_found}}" AND (("${found_basepath}" GREATER "0") OR ("${found_basepath}" EQUAL "0")))
- message(STATUS "${module_state} module ${name} found (${ARGN})")
+ message(STATUS "${module_state} module ${name} found (${ARGN})${looked_in_message}")
# record the shortnames for the tests
list(APPEND all_module_shortnames ${shortname})
else()
if("${module_state}" STREQUAL "optional")
- message(STATUS "optional module ${name} skipped")
+ message(STATUS "optional module ${name} skipped${looked_in_message}")
elseif("${module_state}" STREQUAL "essential")
message(STATUS "skipped module ${name} is essential!\n"
- " We do not guarantee that all tests are working.")
+ " We do not guarantee that all tests are working.${looked_in_message}")
else()
- message(FATAL_ERROR "module ${name} MISSING")
+ message(FATAL_ERROR "module ${name} MISSING${looked_in_message}")
endif()
endif()
endmacro()
@@ -340,7 +341,10 @@ endif()
if(WIN32)
list(APPEND ALL_OPTIONAL_MODULES AxContainer)
endif()
-list(APPEND ALL_OPTIONAL_MODULES WebChannel WebEngineCore WebEngineWidgets WebKit WebKitWidgets WebSockets)
+# Disabling WebKit by default
+# If WebKit support is needed add the following elements
+# to the list: WebKit WebKitWidgets
+list(APPEND ALL_OPTIONAL_MODULES WebChannel WebEngineCore WebEngineWidgets WebSockets)
if (Qt5Core_VERSION VERSION_GREATER 5.9.3) # Depending on fixes in Qt3D
list(APPEND ALL_OPTIONAL_MODULES 3DCore 3DRender 3DInput 3DLogic 3DAnimation 3DExtras)
endif()
@@ -350,6 +354,14 @@ if (NOT MODULES)
set(MODULES "${ALL_ESSENTIAL_MODULES};${ALL_OPTIONAL_MODULES}")
endif()
+# Removing from the MODULES list the items that were defined with
+# -DSKIP_MODULES on command line
+if (SKIP_MODULES)
+ foreach(s ${SKIP_MODULES})
+ list(REMOVE_ITEM MODULES ${s})
+ endforeach()
+endif()
+
foreach(m ${MODULES})
COLLECT_MODULE_IF_FOUND(${m})
endforeach()
diff --git a/sources/pyside2/PySide2/CMakeLists.txt b/sources/pyside2/PySide2/CMakeLists.txt
index 651bf2734..c109b2e0e 100644
--- a/sources/pyside2/PySide2/CMakeLists.txt
+++ b/sources/pyside2/PySide2/CMakeLists.txt
@@ -10,7 +10,11 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/__init__.py.in"
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/_config.py.in"
"${CMAKE_CURRENT_BINARY_DIR}/_config.py" @ONLY)
-configure_file("${CMAKE_CURRENT_SOURCE_DIR}/../pyside_version.py"
+# Use absolute path instead of relative path, to avoid ninja build errors due to
+# duplicate file dependency inconsistency.
+set(pyside_version_relative_path "${CMAKE_CURRENT_SOURCE_DIR}/../pyside_version.py")
+get_filename_component(pyside_version_path ${pyside_version_relative_path} ABSOLUTE)
+configure_file("${pyside_version_path}"
"${CMAKE_CURRENT_BINARY_DIR}/_git_pyside_version.py" @ONLY)
# qt.conf needs to be placed next to QtWebEngineProcess so that the executable uses the correct
diff --git a/sources/pyside2/PySide2/QtCore/CMakeLists.txt b/sources/pyside2/PySide2/QtCore/CMakeLists.txt
index 5a8a41ec5..1d0b7d413 100644
--- a/sources/pyside2/PySide2/QtCore/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtCore/CMakeLists.txt
@@ -55,6 +55,7 @@ ${QtCore_GEN_DIR}/qfinalstate_wrapper.cpp
${QtCore_GEN_DIR}/qgenericargument_wrapper.cpp
${QtCore_GEN_DIR}/qgenericreturnargument_wrapper.cpp
${QtCore_GEN_DIR}/qhistorystate_wrapper.cpp
+${QtCore_GEN_DIR}/qidentityproxymodel_wrapper.cpp
${QtCore_GEN_DIR}/qiodevice_wrapper.cpp
${QtCore_GEN_DIR}/qjsonarray_wrapper.cpp
${QtCore_GEN_DIR}/qjsondocument_wrapper.cpp
@@ -67,8 +68,10 @@ ${QtCore_GEN_DIR}/qlibraryinfo_wrapper.cpp
${QtCore_GEN_DIR}/qline_wrapper.cpp
${QtCore_GEN_DIR}/qlinef_wrapper.cpp
${QtCore_GEN_DIR}/qlocale_wrapper.cpp
+${QtCore_GEN_DIR}/qlockfile_wrapper.cpp
${QtCore_GEN_DIR}/qmargins_wrapper.cpp
${QtCore_GEN_DIR}/qmarginsf_wrapper.cpp
+${QtCore_GEN_DIR}/qmessageauthenticationcode_wrapper.cpp
${QtCore_GEN_DIR}/qmessagelogcontext_wrapper.cpp
${QtCore_GEN_DIR}/qmetaclassinfo_wrapper.cpp
${QtCore_GEN_DIR}/qmetaenum_wrapper.cpp
@@ -83,6 +86,7 @@ ${QtCore_GEN_DIR}/qmodelindex_wrapper.cpp
${QtCore_GEN_DIR}/qmutex_wrapper.cpp
${QtCore_GEN_DIR}/qmutexlocker_wrapper.cpp
${QtCore_GEN_DIR}/qobject_wrapper.cpp
+${QtCore_GEN_DIR}/qoperatingsystemversion_wrapper.cpp
${QtCore_GEN_DIR}/qparallelanimationgroup_wrapper.cpp
${QtCore_GEN_DIR}/qpauseanimation_wrapper.cpp
${QtCore_GEN_DIR}/qpersistentmodelindex_wrapper.cpp
@@ -109,6 +113,7 @@ ${QtCore_GEN_DIR}/qsemaphore_wrapper.cpp
${QtCore_GEN_DIR}/qsemaphorereleaser_wrapper.cpp
${QtCore_GEN_DIR}/qsequentialanimationgroup_wrapper.cpp
${QtCore_GEN_DIR}/qsettings_wrapper.cpp
+${QtCore_GEN_DIR}/qsignalblocker_wrapper.cpp
${QtCore_GEN_DIR}/qsignalmapper_wrapper.cpp
${QtCore_GEN_DIR}/qsignaltransition_wrapper.cpp
${QtCore_GEN_DIR}/qsize_wrapper.cpp
diff --git a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
index 77d074077..994bc10c8 100644
--- a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
+++ b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
@@ -1976,6 +1976,11 @@
</inject-code>
</add-function>
</value-type>
+ <object-type name="QLockFile">
+ <enum-type name="LockError"/>
+ </object-type>
+ <object-type name="QMessageAuthenticationCode"/>
+ <object-type name="QSignalBlocker"/>
<value-type name="QStorageInfo"/>
<!-- QReadWriteLock does not have a copy ctor! -->
<object-type name="QReadWriteLock">
@@ -2126,6 +2131,7 @@
<modify-function signature="filterChanged()" remove="all"/>
<!--### End of obsolete section -->
</object-type>
+ <object-type name="QIdentityProxyModel"/>
<!-- QObject is created manually -->
<object-type name="QObject">
<extra-includes>
@@ -2957,6 +2963,9 @@
</inject-code>
</modify-function>
</object-type>
+ <value-type name="QOperatingSystemVersion" since="5.9">
+ <enum-type name="OSType"/>
+ </value-type>
<object-type name="QLibraryInfo">
<enum-type name="LibraryLocation"/>
</object-type>
@@ -3006,27 +3015,27 @@
<object-type name="QSocketNotifier">
<enum-type name="Type"/>
- <add-function signature="QSocketNotifier(PyObject*,QSocketNotifier::Type,QObject*)">
- <modify-argument index="3">
- <replace-default-expression with="0" />
- <rename to="parent" />
- </modify-argument>
- <inject-code>
- Shiboken::AutoDecRef fileNo(PyObject_GetAttrString(%PYARG_1, "fileno"));
- if (!fileNo.isNull()) {
- Shiboken::AutoDecRef fileNoValue(PyObject_CallObject(fileNo, 0));
- if (%CHECKTYPE[int](fileNoValue)) {
- int cppFileNoValue = %CONVERTTOCPP[int](fileNoValue);
- /* Qt4 version:
- * %0 = new %TYPE(cppFileNoValue, %2, %3);
- * Qt5 has qintptr instead.
- * XXX check if this means a pointer or just the pointer size cast (what I implemented)
- */
- qintptr socket = (qintptr)cppFileNoValue;
- %0 = new %TYPE(socket, %2, %3);
- }
- }
- </inject-code>
+ <add-function signature="QSocketNotifier(PyObject*, QSocketNotifier::Type, QObject*)">
+ <modify-argument index="3">
+ <replace-default-expression with="0" />
+ <rename to="parent" />
+ </modify-argument>
+ <inject-code>
+ Shiboken::AutoDecRef socket(%PYARG_1);
+ if (!socket.isNull()) {
+ // We use qintptr as PyLong, but we check for int
+ // since it is currently an alias to be Python2 compatible.
+ // Internally, ints are qlonglongs.
+ if (%CHECKTYPE[int](socket)) {
+ int cppSocket = %CONVERTTOCPP[int](socket);
+ qintptr socket = (qintptr)cppSocket;
+ %0 = new %TYPE(socket, %2, %3);
+ } else {
+ PyErr_SetString(PyExc_TypeError,
+ "QSocketNotifier: first argument (socket) must be an int.");
+ }
+ }
+ </inject-code>
</add-function>
</object-type>
@@ -3262,6 +3271,14 @@
QCoreApplicationConstructor(%PYSELF, args, &amp;%0);
</inject-code>
</add-function>
+ <add-function signature="QCoreApplication()">
+ <inject-code>
+ PyObject *empty = PyTuple_New(2);
+ if (!PyTuple_SetItem(empty, 0, PyList_New(0))) {
+ QCoreApplicationConstructor(%PYSELF, empty, &amp;%0);
+ }
+ </inject-code>
+ </add-function>
<!-- blocking functions -->
<modify-function signature="processEvents(QFlags&lt;QEventLoop::ProcessEventsFlag&gt;,int)" allow-thread="yes"/>
<modify-function signature="processEvents(QFlags&lt;QEventLoop::ProcessEventsFlag&gt;)" allow-thread="yes"/>
diff --git a/sources/pyside2/PySide2/QtGui/CMakeLists.txt b/sources/pyside2/PySide2/QtGui/CMakeLists.txt
index 807f9b31e..bee58bde2 100644
--- a/sources/pyside2/PySide2/QtGui/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtGui/CMakeLists.txt
@@ -7,7 +7,21 @@ ${QtGui_GEN_DIR}/qabstractopenglfunctions_wrapper.cpp
${QtGui_GEN_DIR}/qabstracttextdocumentlayout_paintcontext_wrapper.cpp
${QtGui_GEN_DIR}/qabstracttextdocumentlayout_selection_wrapper.cpp
${QtGui_GEN_DIR}/qabstracttextdocumentlayout_wrapper.cpp
+${QtGui_GEN_DIR}/qaccessible_wrapper.cpp
+${QtGui_GEN_DIR}/qaccessibleeditabletextinterface_wrapper.cpp
${QtGui_GEN_DIR}/qaccessibleevent_wrapper.cpp
+${QtGui_GEN_DIR}/qaccessibleobject_wrapper.cpp
+${QtGui_GEN_DIR}/qaccessiblestatechangeevent_wrapper.cpp
+${QtGui_GEN_DIR}/qaccessibletablecellinterface_wrapper.cpp
+${QtGui_GEN_DIR}/qaccessibletablemodelchangeevent_wrapper.cpp
+${QtGui_GEN_DIR}/qaccessibletextcursorevent_wrapper.cpp
+${QtGui_GEN_DIR}/qaccessibletextinsertevent_wrapper.cpp
+${QtGui_GEN_DIR}/qaccessibletextinterface_wrapper.cpp
+${QtGui_GEN_DIR}/qaccessibletextremoveevent_wrapper.cpp
+${QtGui_GEN_DIR}/qaccessibletextselectionevent_wrapper.cpp
+${QtGui_GEN_DIR}/qaccessibletextupdateevent_wrapper.cpp
+${QtGui_GEN_DIR}/qaccessiblevaluechangeevent_wrapper.cpp
+${QtGui_GEN_DIR}/qaccessiblevalueinterface_wrapper.cpp
${QtGui_GEN_DIR}/qactionevent_wrapper.cpp
${QtGui_GEN_DIR}/qbackingstore_wrapper.cpp
${QtGui_GEN_DIR}/qbitmap_wrapper.cpp
@@ -48,8 +62,10 @@ ${QtGui_GEN_DIR}/qimageiohandler_wrapper.cpp
${QtGui_GEN_DIR}/qimagereader_wrapper.cpp
${QtGui_GEN_DIR}/qimagewriter_wrapper.cpp
${QtGui_GEN_DIR}/qinputevent_wrapper.cpp
+${QtGui_GEN_DIR}/qinputmethod_wrapper.cpp
${QtGui_GEN_DIR}/qinputmethodevent_attribute_wrapper.cpp
${QtGui_GEN_DIR}/qinputmethodevent_wrapper.cpp
+${QtGui_GEN_DIR}/qinputmethodqueryevent_wrapper.cpp
${QtGui_GEN_DIR}/qintvalidator_wrapper.cpp
${QtGui_GEN_DIR}/qkeyevent_wrapper.cpp
${QtGui_GEN_DIR}/qkeysequence_wrapper.cpp
@@ -67,6 +83,7 @@ ${QtGui_GEN_DIR}/qmatrix4x4_wrapper.cpp
${QtGui_GEN_DIR}/qmouseevent_wrapper.cpp
${QtGui_GEN_DIR}/qmoveevent_wrapper.cpp
${QtGui_GEN_DIR}/qmovie_wrapper.cpp
+${QtGui_GEN_DIR}/qnativegestureevent_wrapper.cpp
${QtGui_GEN_DIR}/qoffscreensurface_wrapper.cpp
${QtGui_GEN_DIR}/qopenglcontextgroup_wrapper.cpp
${QtGui_GEN_DIR}/qopengldebuglogger_wrapper.cpp
@@ -78,6 +95,7 @@ ${QtGui_GEN_DIR}/qopenglfunctions_wrapper.cpp
${QtGui_GEN_DIR}/qopenglpixeltransferoptions_wrapper.cpp
${QtGui_GEN_DIR}/qopenglshaderprogram_wrapper.cpp
${QtGui_GEN_DIR}/qopengltexture_wrapper.cpp
+${QtGui_GEN_DIR}/qopengltextureblitter_wrapper.cpp
${QtGui_GEN_DIR}/qopengltimemonitor_wrapper.cpp
${QtGui_GEN_DIR}/qopengltimerquery_wrapper.cpp
${QtGui_GEN_DIR}/qopenglversionprofile_wrapper.cpp
@@ -107,6 +125,7 @@ ${QtGui_GEN_DIR}/qpixmap_wrapper.cpp
${QtGui_GEN_DIR}/qpixmapcache_key_wrapper.cpp
${QtGui_GEN_DIR}/qpixmapcache_wrapper.cpp
${QtGui_GEN_DIR}/qpixelformat_wrapper.cpp
+${QtGui_GEN_DIR}/qpointingdeviceuniqueid_wrapper.cpp
${QtGui_GEN_DIR}/qpolygon_wrapper.cpp
${QtGui_GEN_DIR}/qpolygonf_wrapper.cpp
${QtGui_GEN_DIR}/qpytextobject_wrapper.cpp
@@ -123,7 +142,6 @@ ${QtGui_GEN_DIR}/qstandarditemmodel_wrapper.cpp
${QtGui_GEN_DIR}/qstatustipevent_wrapper.cpp
${QtGui_GEN_DIR}/qopenglbuffer_wrapper.cpp
${QtGui_GEN_DIR}/qopenglcontext_wrapper.cpp
-${QtGui_GEN_DIR}/qaccessible_wrapper.cpp
${QtGui_GEN_DIR}/qaccessible_state_wrapper.cpp
${QtGui_GEN_DIR}/qaccessibleinterface_wrapper.cpp
${QtGui_GEN_DIR}/qscreen_wrapper.cpp
@@ -132,6 +150,8 @@ ${QtGui_GEN_DIR}/qopenglshader_wrapper.cpp
${QtGui_GEN_DIR}/qopenglframebufferobject_wrapper.cpp
${QtGui_GEN_DIR}/qrasterwindow_wrapper.cpp
${QtGui_GEN_DIR}/qrawfont_wrapper.cpp
+${QtGui_GEN_DIR}/qscrollevent_wrapper.cpp
+${QtGui_GEN_DIR}/qscrollprepareevent_wrapper.cpp
${QtGui_GEN_DIR}/qstatictext_wrapper.cpp
${QtGui_GEN_DIR}/qstylehints_wrapper.cpp
${QtGui_GEN_DIR}/qsurface_wrapper.cpp
diff --git a/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml b/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml
index 903260200..47bf62992 100644
--- a/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml
+++ b/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml
@@ -119,7 +119,7 @@
besides the fact they are accessible by ordinary event methods.
-->
- <rejection class="QAccessibleEvent" field-name="m_type"/>
+ <rejection class="^QAccessible.*Event$" field-name="^m_.*$"/>
<rejection class="QEnterEvent" field-name="l"/>
<rejection class="QEnterEvent" field-name="w"/>
@@ -132,6 +132,7 @@
<rejection class="QMouseEvent" field-name="g"/>
<rejection class="QMouseEvent" field-name="b"/>
<rejection class="QMouseEvent" field-name="mouseState"/>
+ <rejection class="QNativeGestureEvent" field-name="^m.*$"/>
<rejection class="QHoverEvent" field-name="p"/>
<rejection class="QHoverEvent" field-name="op"/>
@@ -222,6 +223,35 @@
</conversion-rule>
</primitive-type>
+ <value-type name="QAccessible">
+ <value-type name="State"/>
+ <enum-type name="Event"/>
+ <enum-type name="Role"/>
+ <enum-type name="Text"/>
+ <enum-type name="RelationFlag" flags="Relation"/>
+ <enum-type name="InterfaceType"/>
+ <enum-type name="TextBoundaryType"/>
+ </value-type>
+
+ <object-type name="QAccessibleEditableTextInterface"/>
+ <object-type name="QAccessibleInterface"/>
+ <object-type name="QAccessibleObject"/>
+ <object-type name="QAccessibleTableCellInterface"/>
+ <object-type name="QAccessibleTextInterface"/>
+ <object-type name="QAccessibleValueInterface"/>
+
+ <object-type name="QAccessibleEvent" copyable="false" polymorphic-id-expression="%1-&gt;type() == QAccessible::InvalidEvent"/>
+ <object-type name="QAccessibleStateChangeEvent" copyable="false" polymorphic-id-expression="%1-&gt;type() == QAccessible::StateChanged"/>
+ <object-type name="QAccessibleTableModelChangeEvent" copyable="false" polymorphic-id-expression="%1-&gt;type() == QAccessible::TableModelChanged">
+ <enum-type name="ModelChangeType"/>
+ </object-type>
+ <object-type name="QAccessibleTextCursorEvent" copyable="false" polymorphic-id-expression="%1-&gt;type() == QAccessible::TextCaretMoved"/>
+ <object-type name="QAccessibleTextInsertEvent" copyable="false" polymorphic-id-expression="%1-&gt;type() == QAccessible::TextInserted"/>
+ <object-type name="QAccessibleTextRemoveEvent" copyable="false" polymorphic-id-expression="%1-&gt;type() == QAccessible::TextRemoved"/>
+ <object-type name="QAccessibleTextSelectionEvent" copyable="false" polymorphic-id-expression="%1-&gt;type() == QAccessible::TextSelectionChanged"/>
+ <object-type name="QAccessibleTextUpdateEvent" copyable="false" polymorphic-id-expression="%1-&gt;type() == QAccessible::TextUpdated"/>
+ <object-type name="QAccessibleValueChangeEvent" copyable="false" polymorphic-id-expression="%1-&gt;type() == QAccessible::ValueChanged"/>
+
<value-type name="QTransform">
<enum-type name="TransformationType"/>
<add-function signature="__repr__" return-type="PyObject*">
@@ -383,6 +413,9 @@
<enum-type name="ColorGroup" />
<enum-type name="ColorRole" />
</value-type>
+ <object-type name="QInputMethod">
+ <enum-type name="Action" />
+ </object-type>
<value-type name="QKeySequence">
<enum-type name="SequenceFormat"/>
<enum-type name="SequenceMatch"/>
@@ -1782,8 +1815,10 @@
</value-type>
<!-- endif ndef QT_NO_INPUTMETHOD -->
</object-type>
+ <object-type name="QInputMethodQueryEvent" copyable="false" polymorphic-id-expression="%1-&gt;type() == QEvent::InputMethodQuery"/>
<object-type name="QMoveEvent" copyable = "false" polymorphic-id-expression="%1-&gt;type() == QEvent::Move" />
+ <object-type name="QNativeGestureEvent" copyable="false" polymorphic-id-expression="%1-&gt;type() == QEvent::NativeGesture"/>
<object-type name="QResizeEvent" copyable = "false" polymorphic-id-expression="%1-&gt;type() == QEvent::Resize"/>
<object-type name="QShortcutEvent" copyable = "false" polymorphic-id-expression="%1-&gt;type() == QEvent::Shortcut">
</object-type>
@@ -1813,7 +1848,10 @@
</object-type>
<object-type name="QMouseEvent" copyable= "false" polymorphic-id-expression="%1-&gt;type() == QEvent::MouseButtonDblClick || %1-&gt;type() == QEvent::MouseButtonPress || %1-&gt;type() == QEvent::MouseButtonRelease || %1-&gt;type() == QEvent::MouseMove"/>
<object-type name="QPaintEvent" copyable= "false" polymorphic-id-expression="%1-&gt;type() == QEvent::Paint"/>
- <object-type name="QAccessibleEvent" polymorphic-id-expression="%1-&gt;type() == QEvent::AccessibilityDescription || %1-&gt;type() == QEvent::AccessibilityHelp"/>
+ <object-type name="QScrollEvent" copyable="false" polymorphic-id-expression="%1-&gt;type() == QEvent::Scroll">
+ <enum-type name="ScrollState"/>
+ </object-type>
+ <object-type name="QScrollPrepareEvent" copyable="false" polymorphic-id-expression="%1-&gt;type() == QEvent::ScrollPrepare"/>
<object-type name="QTextFrame" >
<extra-includes>
@@ -3056,7 +3094,6 @@
_______ end of matrix block _______ -->
-
<value-type name="QQuaternion" since="4.6">
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
@@ -3251,22 +3288,19 @@
QGuiApplicationConstructor(%PYSELF, args, &amp;%0);
</inject-code>
</add-function>
+ <add-function signature="QGuiApplication()">
+ <inject-code>
+ PyObject *empty = PyTuple_New(2);
+ if (!PyTuple_SetItem(empty, 0, PyList_New(0))) {
+ QGuiApplicationConstructor(%PYSELF, empty, &amp;%0);
+ }
+ </inject-code>
+ </add-function>
<modify-function signature="exec()" rename="exec_" allow-thread="yes"/>
<inject-code class="native" file="glue/qguiapplication_init.cpp" position="beginning" />
</object-type>
- <value-type name="QAccessible">
- <value-type name="State"/>
- <enum-type name="Role"/>
- <enum-type name="Text"/>
- <enum-type name="RelationFlag"/>
- <enum-type name="InterfaceType"/>
- <enum-type name="TextBoundaryType"/>
- <enum-type name="Event"/>
- </value-type>
- <object-type name="QAccessibleInterface">
- </object-type>
<object-type name="QOpenGLBuffer" since="5.0">
<enum-type name="Access" />
<enum-type name="RangeAccessFlag" flags="RangeAccessFlags" />
@@ -3661,6 +3695,7 @@
<modify-function signature="borderColor(int*)const" remove="all"/>
<modify-function signature="borderColor(float*)const" remove="all"/>
</object-type>
+ <object-type name="QOpenGLTextureBlitter"/>
<object-type name="QOpenGLTimeMonitor" since="5.1"/>
<object-type name="QOpenGLTimerQuery" since="5.1"/>
<object-type name="QOpenGLWindow" since="5.4">
@@ -3691,6 +3726,7 @@
<enum-type name="YUVLayout"/>
</value-type>
<object-type name="QPdfWriter"/>
+ <value-type name="QPointingDeviceUniqueId"/>
<value-type name="QRawFont">
<enum-type name="AntialiasingType"/>
<enum-type name="LayoutFlag" flags="LayoutFlags"/>
diff --git a/sources/pyside2/PySide2/QtMultimedia/CMakeLists.txt b/sources/pyside2/PySide2/QtMultimedia/CMakeLists.txt
index 030426b05..e9caaa64b 100644
--- a/sources/pyside2/PySide2/QtMultimedia/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtMultimedia/CMakeLists.txt
@@ -27,7 +27,10 @@ ${QtMultimedia_GEN_DIR}/qcameracapturedestinationcontrol_wrapper.cpp
${QtMultimedia_GEN_DIR}/qcameracontrol_wrapper.cpp
${QtMultimedia_GEN_DIR}/qcameraexposurecontrol_wrapper.cpp
# Private destructor: ${QtMultimedia_GEN_DIR}/qcameraexposure_wrapper.cpp
+${QtMultimedia_GEN_DIR}/qcamerafeedbackcontrol_wrapper.cpp
# Private destructor: ${${QtMultimedia_GEN_DIR}/qcamerafocus_wrapper.cpp
+# needs enums from QCameraFocus ${QtMultimedia_GEN_DIR}/qcameraflashcontrol_wrapper.cpp
+# needs enums from QCameraFocus ${QtMultimedia_GEN_DIR}/qcamerafocuscontrol_wrapper.cpp
${QtMultimedia_GEN_DIR}/qcamerafocuszone_wrapper.cpp
${QtMultimedia_GEN_DIR}/qcamera_frameraterange_wrapper.cpp
${QtMultimedia_GEN_DIR}/qcameraimagecapturecontrol_wrapper.cpp
@@ -60,7 +63,19 @@ ${QtMultimedia_GEN_DIR}/qmediaplaylist_wrapper.cpp
${QtMultimedia_GEN_DIR}/qmediarecordercontrol_wrapper.cpp
${QtMultimedia_GEN_DIR}/qmediarecorder_wrapper.cpp
${QtMultimedia_GEN_DIR}/qmediaresource_wrapper.cpp
+${QtMultimedia_GEN_DIR}/qmediaservice_wrapper.cpp
+${QtMultimedia_GEN_DIR}/qmediaservicecamerainfointerface_wrapper.cpp
+${QtMultimedia_GEN_DIR}/qmediaservicedefaultdeviceinterface_wrapper.cpp
+${QtMultimedia_GEN_DIR}/qmediaservicefeaturesinterface_wrapper.cpp
+${QtMultimedia_GEN_DIR}/qmediaserviceproviderhint_wrapper.cpp
+${QtMultimedia_GEN_DIR}/qmediaservicesupporteddevicesinterface_wrapper.cpp
+${QtMultimedia_GEN_DIR}/qmediaservicesupportedformatsinterface_wrapper.cpp
+${QtMultimedia_GEN_DIR}/qmediastreamscontrol_wrapper.cpp
+${QtMultimedia_GEN_DIR}/qmediatimeinterval_wrapper.cpp
${QtMultimedia_GEN_DIR}/qmediatimerange_wrapper.cpp
+${QtMultimedia_GEN_DIR}/qmediavideoprobecontrol_wrapper.cpp
+${QtMultimedia_GEN_DIR}/qmetadatareadercontrol_wrapper.cpp
+${QtMultimedia_GEN_DIR}/qmetadatawritercontrol_wrapper.cpp
${QtMultimedia_GEN_DIR}/qmultimedia_wrapper.cpp
${QtMultimedia_GEN_DIR}/qradiodatacontrol_wrapper.cpp
${QtMultimedia_GEN_DIR}/qradiodata_wrapper.cpp
diff --git a/sources/pyside2/PySide2/QtMultimedia/typesystem_multimedia_common.xml b/sources/pyside2/PySide2/QtMultimedia/typesystem_multimedia_common.xml
index fb353c7a1..5486fb157 100644
--- a/sources/pyside2/PySide2/QtMultimedia/typesystem_multimedia_common.xml
+++ b/sources/pyside2/PySide2/QtMultimedia/typesystem_multimedia_common.xml
@@ -217,6 +217,9 @@
<enum-type name="ExposureParameter"/>
<modify-function signature="supportedParameterRange(QCameraExposureControl::ExposureParameter,bool*)const" remove="all"/>
</object-type>
+ <object-type name="QCameraFeedbackControl">
+ <enum-type name="EventType"/>
+ </object-type>
<value-type name="QCameraFocusZone">
<enum-type name="FocusZoneStatus"/>
</value-type>
@@ -225,6 +228,8 @@
<enum-type name="FocusMode" flags="FocusModes"/>
<enum-type name="FocusPointMode"/>
</object-type>
+ <object-type name="QCameraFlashControl"/> needs enums from QCameraFocus
+ <object-type name="QCameraFocusControl"/>
-->
<value-type name="QCameraInfo"/>
<object-type name="QCameraInfoControl"/>
@@ -313,7 +318,25 @@
</object-type>
<object-type name="QMediaRecorderControl"/>
<value-type name="QMediaResource"/>
+ <object-type name="QMediaService"/>
+ <interface-type name="QMediaServiceCameraInfoInterface"/>
+ <interface-type name="QMediaServiceDefaultDeviceInterface"/>
+ <interface-type name="QMediaServiceFeaturesInterface"/>
+ <value-type name="QMediaServiceProviderHint">
+ <enum-type name="Type"/>
+ <enum-type name="Feature" flags="Features"/>
+ </value-type>
+ <interface-type name="QMediaServiceSupportedDevicesInterface"/>
+ <interface-type name="QMediaServiceSupportedFormatsInterface"/>
+ <object-type name="QMediaStreamsControl">
+ <enum-type name="StreamType"/>
+ </object-type>
+ <value-type name="QMediaTimeInterval"/>
<value-type name="QMediaTimeRange"/>
+ <object-type name="QMediaVideoProbeControl"/>
+
+ <object-type name="QMetaDataReaderControl"/>
+ <object-type name="QMetaDataWriterControl"/>
<namespace-type name="QMultimedia">
<enum-type name="SupportEstimate"/>
diff --git a/sources/pyside2/PySide2/QtWidgets/CMakeLists.txt b/sources/pyside2/PySide2/QtWidgets/CMakeLists.txt
index 27dff2912..dee79744f 100644
--- a/sources/pyside2/PySide2/QtWidgets/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtWidgets/CMakeLists.txt
@@ -8,6 +8,7 @@ check_qt_class(QtWidgets QGtkStyle QtWidgets_OPTIONAL_SRC QtWid
check_qt_class(QtWidgets QMacStyle QtWidgets_OPTIONAL_SRC QtWidgets_DROPPED_ENTRIES)
set(QtWidgets_SRC
+${QtWidgets_GEN_DIR}/qaccessiblewidget_wrapper.cpp
${QtWidgets_GEN_DIR}/qabstractbutton_wrapper.cpp
${QtWidgets_GEN_DIR}/qabstractgraphicsshapeitem_wrapper.cpp
${QtWidgets_GEN_DIR}/qabstractitemdelegate_wrapper.cpp
@@ -122,11 +123,14 @@ ${QtWidgets_GEN_DIR}/qplaintextdocumentlayout_wrapper.cpp
${QtWidgets_GEN_DIR}/qplaintextedit_wrapper.cpp
${QtWidgets_GEN_DIR}/qprogressbar_wrapper.cpp
${QtWidgets_GEN_DIR}/qprogressdialog_wrapper.cpp
+${QtWidgets_GEN_DIR}/qproxystyle_wrapper.cpp
${QtWidgets_GEN_DIR}/qpushbutton_wrapper.cpp
${QtWidgets_GEN_DIR}/qradiobutton_wrapper.cpp
${QtWidgets_GEN_DIR}/qrubberband_wrapper.cpp
${QtWidgets_GEN_DIR}/qscrollarea_wrapper.cpp
${QtWidgets_GEN_DIR}/qscrollbar_wrapper.cpp
+${QtWidgets_GEN_DIR}/qscroller_wrapper.cpp
+${QtWidgets_GEN_DIR}/qscrollerproperties_wrapper.cpp
${QtWidgets_GEN_DIR}/qshortcut_wrapper.cpp
${QtWidgets_GEN_DIR}/qsizegrip_wrapper.cpp
${QtWidgets_GEN_DIR}/qsizepolicy_wrapper.cpp
diff --git a/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml b/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml
index feb3882ff..b4a6c2453 100644
--- a/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml
+++ b/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml
@@ -190,6 +190,7 @@
<enum-type name="ViewItemPosition"/>
</value-type>
+ <object-type name="QAccessibleWidget"/>
<value-type name="QColormap">
<enum-type name="Mode"/>
</value-type>
@@ -996,6 +997,13 @@
<object-type name="QProgressBar">
<enum-type name="Direction"/>
</object-type>
+ <object-type name="QProxyStyle">
+ <modify-function signature="QProxyStyle(QStyle*)">
+ <modify-argument index="1">
+ <define-ownership owner="c++"/>
+ </modify-argument>
+ </modify-function>
+ </object-type>
<object-type name="QPushButton" />
<object-type name="QScrollArea">
<modify-function signature="setWidget(QWidget*)">
@@ -3193,6 +3201,14 @@
QApplicationConstructor(%PYSELF, args, &amp;%0);
</inject-code>
</add-function>
+ <add-function signature="QApplication()">
+ <inject-code>
+ PyObject *empty = PyTuple_New(2);
+ if (!PyTuple_SetItem(empty, 0, PyList_New(0))) {
+ QApplicationConstructor(%PYSELF, empty, &amp;%0);
+ }
+ </inject-code>
+ </add-function>
<modify-function signature="exec()" rename="exec_" allow-thread="yes"/>
<inject-code class="native" file="glue/qapplication_init.cpp" position="beginning" />
</object-type>
@@ -3665,6 +3681,17 @@
<value-type name="QTileRules" since="4.6"/>
+ <object-type name="QScroller">
+ <enum-type name="State"/>
+ <enum-type name="ScrollerGestureType"/>
+ <enum-type name="Input"/>
+ </object-type>
+ <value-type name="QScrollerProperties">
+ <enum-type name="OvershootPolicy"/>
+ <enum-type name="FrameRates"/>
+ <enum-type name="ScrollMetric"/>
+ </value-type>
+
<object-type name="QSizeGrip"/>
<object-type name="QSystemTrayIcon">
diff --git a/sources/pyside2/doc/_templates/layout.html b/sources/pyside2/doc/_templates/layout.html
index 561bed8ee..6ab1276a3 100644
--- a/sources/pyside2/doc/_templates/layout.html
+++ b/sources/pyside2/doc/_templates/layout.html
@@ -8,7 +8,7 @@
<div id="container">
<div class="header">
<div class="header_container">
- <div class="logo"><a href="http://www.pyside.org"><img alt="PySide" src="{{ pathto('_static/pysidelogo.png', 1) }}" width="199" height="102" /></a></div>
+ <div class="logo"><a href="http://www.pyside.org"><img alt="PySide" src="{{ pathto('_static/pysidelogo.png', 1) }}"/></a></div>
<div class="related">
<ul>
{%- block rootrellink %}
diff --git a/sources/pyside2/doc/_themes/pysidedocs/static/pysidelogo.png b/sources/pyside2/doc/_themes/pysidedocs/static/pysidelogo.png
index 076c1057c..882a004dd 100644
--- a/sources/pyside2/doc/_themes/pysidedocs/static/pysidelogo.png
+++ b/sources/pyside2/doc/_themes/pysidedocs/static/pysidelogo.png
Binary files differ
diff --git a/sources/pyside2/doc/additionaldocs.lst b/sources/pyside2/doc/additionaldocs.lst
index ff03d3656..037cb60f7 100644
--- a/sources/pyside2/doc/additionaldocs.lst
+++ b/sources/pyside2/doc/additionaldocs.lst
@@ -50,7 +50,9 @@
# fi
# fi
# done
+# A line enclosed in [] denotes a (relative) target directory
+[overviews]
animation-overview.webxml
animation.webxml
application-windows.webxml
diff --git a/sources/pyside2/doc/conf.py.in b/sources/pyside2/doc/conf.py.in
index 10c0af5f3..e5fc80fb7 100644
--- a/sources/pyside2/doc/conf.py.in
+++ b/sources/pyside2/doc/conf.py.in
@@ -23,7 +23,10 @@ sys.path.append('@pyside_BINARY_DIR@')
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
-extensions = ['sphinx.ext.todo', 'sphinx.ext.graphviz', 'inheritance_diagram', 'pysideinclude']
+#extensions = ['sphinx.ext.todo', 'sphinx.ext.graphviz', 'inheritance_diagram', 'pysideinclude']
+extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.ifconfig',
+'sphinx.ext.coverage', 'sphinx.ext.intersphinx', 'sphinx.ext.todo',
+'sphinx.ext.graphviz', 'inheritance_diagram', 'pysideinclude']
rst_epilog = """
.. |project| replace:: Qt for Python
@@ -161,3 +164,7 @@ html_show_sourcelink = False
# Output file base name for HTML help builder.
#htmlhelp_basename = 'PySideDoc'
+
+# Link to the shiboken2 sphinx project to enable linking
+# between the two projects.
+intersphinx_mapping = {'shiboken2': ('@CMAKE_BINARY_DIR@/../shiboken2/doc/html','@CMAKE_BINARY_DIR@/../shiboken2/doc/html/objects.inv')}
diff --git a/sources/pyside2/doc/contents.rst b/sources/pyside2/doc/contents.rst
index f6e2f6abd..d31305889 100644
--- a/sources/pyside2/doc/contents.rst
+++ b/sources/pyside2/doc/contents.rst
@@ -6,24 +6,10 @@
gettingstarted.rst
modules.rst
- licenses.rst
-
-Tutorials
-=========
-
-.. toctree::
- :maxdepth: 2
-
tutorials/index.rst
-
-Other stuff
-===========
-
-.. toctree::
- :maxdepth: 1
-
pysideapi2.rst
pysideversion.rst
+ licenses.rst
Module Index
============
diff --git a/sources/pyside2/doc/index.rst b/sources/pyside2/doc/index.rst
index 90c95ade9..26bfe998f 100644
--- a/sources/pyside2/doc/index.rst
+++ b/sources/pyside2/doc/index.rst
@@ -96,7 +96,9 @@ Qt Modules
Provides access to sensor hardware via QML and Python interfaces and a motion gesture recognition API for devices.
-
-provides access to sensor hardware via QML and C++ interfaces. The Qt Sensors API also provides a motion gesture recognition API for devices.
+|project| also comes with the
+:doc:`Shiboken2 <shiboken2:contents>` generator that outputs C++ code
+for CPython extensions.
.. toctree::
:maxdepth: 2
diff --git a/sources/pyside2/tests/QtCore/CMakeLists.txt b/sources/pyside2/tests/QtCore/CMakeLists.txt
index 3a08cb45b..dc7aa3ddd 100644
--- a/sources/pyside2/tests/QtCore/CMakeLists.txt
+++ b/sources/pyside2/tests/QtCore/CMakeLists.txt
@@ -53,6 +53,7 @@ PYSIDE_TEST(qbytearray_test.py)
PYSIDE_TEST(qcollator_test.py)
PYSIDE_TEST(qcommandlineparser_test.py)
PYSIDE_TEST(qcoreapplication_instance_test.py)
+PYSIDE_TEST(qcoreapplication_test.py)
PYSIDE_TEST(qdatastream_test.py)
PYSIDE_TEST(qdatetime_test.py)
PYSIDE_TEST(qdate_test.py)
@@ -66,6 +67,8 @@ PYSIDE_TEST(qflags_test.py)
PYSIDE_TEST(qinstallmsghandler_test.py)
PYSIDE_TEST(qlinef_test.py)
PYSIDE_TEST(qlocale_test.py)
+PYSIDE_TEST(qlockfile_test.py)
+PYSIDE_TEST(qmessageauthenticationcode_test.py)
PYSIDE_TEST(qmetaobject_test.py)
PYSIDE_TEST(qmimedatabase_test.py)
PYSIDE_TEST(qmodelindex_internalpointer_test.py)
@@ -81,6 +84,7 @@ PYSIDE_TEST(qobject_protected_methods_test.py)
PYSIDE_TEST(qobject_test.py)
PYSIDE_TEST(qobject_timer_event_test.py)
PYSIDE_TEST(qobject_tr_as_instance_test.py)
+PYSIDE_TEST(qoperatingsystemversion_test.py)
PYSIDE_TEST(qpoint_test.py)
PYSIDE_TEST(qprocess_test.py)
PYSIDE_TEST(qproperty_decorator.py)
@@ -90,6 +94,7 @@ PYSIDE_TEST(qregularexpression_test.py)
PYSIDE_TEST(qresource_test.py)
PYSIDE_TEST(qsize_test.py)
PYSIDE_TEST(qslot_object_test.py)
+PYSIDE_TEST(qsocketnotifier_test.py)
PYSIDE_TEST(qsrand_test.py)
PYSIDE_TEST(qstandardpaths_test.py)
PYSIDE_TEST(qstatemachine_test.py)
diff --git a/sources/pyside2/tests/QtCore/blocking_signals_test.py b/sources/pyside2/tests/QtCore/blocking_signals_test.py
index 769820355..2f8b95b27 100644
--- a/sources/pyside2/tests/QtCore/blocking_signals_test.py
+++ b/sources/pyside2/tests/QtCore/blocking_signals_test.py
@@ -32,7 +32,7 @@ import unittest
import os
from tempfile import mkstemp
-from PySide2.QtCore import QObject, SIGNAL, QFile
+from PySide2.QtCore import QObject, SIGNAL, QFile, QSignalBlocker
class TestSignalsBlockedBasic(unittest.TestCase):
'''Basic test case for signalsBlocked'''
@@ -46,6 +46,15 @@ class TestSignalsBlockedBasic(unittest.TestCase):
self.assertTrue(not obj.blockSignals(True))
self.assertTrue(obj.signalsBlocked())
self.assertTrue(obj.blockSignals(False))
+ blocker = QSignalBlocker(obj)
+ self.assertTrue(obj.signalsBlocked())
+ blocker.unblock()
+ self.assertTrue(not obj.signalsBlocked())
+ blocker.reblock()
+ self.assertTrue(obj.signalsBlocked())
+ del blocker
+ self.assertTrue(not obj.signalsBlocked())
+
class TestSignalsBlocked(unittest.TestCase):
'''Test case to check if the signals are really blocked'''
diff --git a/sources/pyside2/tests/QtCore/qabstractitemmodel_test.py b/sources/pyside2/tests/QtCore/qabstractitemmodel_test.py
index 34c15665e..70b610c34 100644
--- a/sources/pyside2/tests/QtCore/qabstractitemmodel_test.py
+++ b/sources/pyside2/tests/QtCore/qabstractitemmodel_test.py
@@ -54,6 +54,15 @@ class TestQModelIndexInternalPointer(unittest.TestCase):
idx = QPersistentModelIndex()
m.span(idx)
+ def testQIdentityProxyModel(self):
+ sourceModel = QStringListModel(['item1', 'item2'])
+ sourceIndex = sourceModel.index(0, 0)
+ sourceData = str(sourceModel.data(sourceIndex, Qt.DisplayRole))
+ proxyModel = QIdentityProxyModel()
+ proxyModel.setSourceModel(sourceModel)
+ proxyIndex = proxyModel.mapFromSource(sourceIndex)
+ proxyData = str(proxyModel.data(proxyIndex, Qt.DisplayRole))
+ self.assertEqual(sourceData, proxyData)
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside2/tests/QtCore/qcoreapplication_test.py b/sources/pyside2/tests/QtCore/qcoreapplication_test.py
new file mode 100644
index 000000000..15a905846
--- /dev/null
+++ b/sources/pyside2/tests/QtCore/qcoreapplication_test.py
@@ -0,0 +1,40 @@
+#############################################################################
+##
+## Copyright (C) 2018 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of Qt for Python.
+##
+## $QT_BEGIN_LICENSE:GPL-EXCEPT$
+## 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 General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU
+## General Public License version 3 as published by the Free Software
+## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+## 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-3.0.html.
+##
+## $QT_END_LICENSE$
+##
+#############################################################################
+
+import unittest
+
+from PySide2.QtCore import QCoreApplication
+
+class TestQCoreApplication(unittest.TestCase):
+ def testNoArguments(self):
+ app = QCoreApplication()
+ self.assertIsInstance(app, QCoreApplication)
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/sources/pyside2/tests/QtCore/qlockfile_test.py b/sources/pyside2/tests/QtCore/qlockfile_test.py
new file mode 100644
index 000000000..e943af2b7
--- /dev/null
+++ b/sources/pyside2/tests/QtCore/qlockfile_test.py
@@ -0,0 +1,55 @@
+#!/usr/bin/python
+
+#############################################################################
+##
+## Copyright (C) 2018 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of Qt for Python.
+##
+## $QT_BEGIN_LICENSE:GPL-EXCEPT$
+## 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 General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU
+## General Public License version 3 as published by the Free Software
+## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+## 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-3.0.html.
+##
+## $QT_END_LICENSE$
+##
+#############################################################################
+
+'''Test cases for QLockFile'''
+
+import os, unittest
+
+from PySide2.QtCore import QDir, QLockFile, QCoreApplication
+
+class TestQMessageAuthenticationCode (unittest.TestCase):
+
+ def setUp(self):
+ pid = QCoreApplication.applicationPid()
+ self._fileName = "{}/pqlockfiletest{}.tmp".format(QDir.tempPath(), pid)
+
+ def tearDown(self):
+ if (os.path.exists(self._fileName)):
+ os.remove(self._fileName)
+
+ def test(self):
+ # Merely exercise the API, no locking against another processes.
+ lockFile = QLockFile(self._fileName)
+ self.assertTrue(lockFile.lock())
+ self.assertTrue(lockFile.isLocked())
+ lockFile.unlock()
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/sources/pyside2/tests/QtCore/qmessageauthenticationcode_test.py b/sources/pyside2/tests/QtCore/qmessageauthenticationcode_test.py
new file mode 100644
index 000000000..392e6f052
--- /dev/null
+++ b/sources/pyside2/tests/QtCore/qmessageauthenticationcode_test.py
@@ -0,0 +1,45 @@
+#!/usr/bin/python
+
+#############################################################################
+##
+## Copyright (C) 2018 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of Qt for Python.
+##
+## $QT_BEGIN_LICENSE:GPL-EXCEPT$
+## 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 General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU
+## General Public License version 3 as published by the Free Software
+## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+## 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-3.0.html.
+##
+## $QT_END_LICENSE$
+##
+#############################################################################
+
+'''Test cases for QMessageAuthenticationCode'''
+
+import unittest
+
+from PySide2.QtCore import QCryptographicHash, QMessageAuthenticationCode
+
+class TestQMessageAuthenticationCode (unittest.TestCase):
+ def test(self):
+ code = QMessageAuthenticationCode(QCryptographicHash.Sha1, 'bla')
+ result = code.result()
+ self.assertTrue(result.size() > 0)
+ print(result.toHex())
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/sources/pyside2/tests/QtCore/qoperatingsystemversion_test.py b/sources/pyside2/tests/QtCore/qoperatingsystemversion_test.py
new file mode 100644
index 000000000..82c571d18
--- /dev/null
+++ b/sources/pyside2/tests/QtCore/qoperatingsystemversion_test.py
@@ -0,0 +1,40 @@
+#############################################################################
+##
+## Copyright (C) 2018 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of Qt for Python.
+##
+## $QT_BEGIN_LICENSE:GPL-EXCEPT$
+## 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 General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU
+## General Public License version 3 as published by the Free Software
+## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+## 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-3.0.html.
+##
+## $QT_END_LICENSE$
+##
+#############################################################################
+
+import unittest
+from PySide2.QtCore import QOperatingSystemVersion
+
+class TestQOperatingSystemVersion(unittest.TestCase):
+ def test(self):
+ ov = QOperatingSystemVersion.current()
+ name = "{} v{}.{}.{}".format(ov.name(), ov.majorVersion(),
+ ov.minorVersion(), ov.microVersion())
+ print(name)
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/sources/pyside2/tests/QtCore/qsocketnotifier_test.py b/sources/pyside2/tests/QtCore/qsocketnotifier_test.py
new file mode 100644
index 000000000..0a9b78af3
--- /dev/null
+++ b/sources/pyside2/tests/QtCore/qsocketnotifier_test.py
@@ -0,0 +1,59 @@
+#!/usr/bin/python
+
+#############################################################################
+##
+## Copyright (C) 2018 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of Qt for Python.
+##
+## $QT_BEGIN_LICENSE:GPL-EXCEPT$
+## 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 General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU
+## General Public License version 3 as published by the Free Software
+## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+## 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-3.0.html.
+##
+## $QT_END_LICENSE$
+##
+#############################################################################
+
+'''Unit tests for QUuid'''
+
+import unittest
+
+from PySide2.QtWidgets import QApplication
+from PySide2.QtCore import QSocketNotifier
+import socket
+import sys
+import os
+
+class QSocketNotifierTest(unittest.TestCase):
+ def testClass(self):
+ app = QApplication([])
+ # socketpair is not available on Windows
+ if os.name != "nt":
+ w_sock, r_sock = socket.socketpair(socket.AF_UNIX, socket.SOCK_STREAM)
+
+ self.assertIsInstance(r_sock.fileno(), int)
+
+ notifier = QSocketNotifier(r_sock.fileno(), QSocketNotifier.Read)
+
+ self.assertIsNotNone(notifier)
+
+ w_sock.close()
+ r_sock.close()
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/sources/pyside2/tests/QtGui/CMakeLists.txt b/sources/pyside2/tests/QtGui/CMakeLists.txt
index b487a2401..31747659e 100644
--- a/sources/pyside2/tests/QtGui/CMakeLists.txt
+++ b/sources/pyside2/tests/QtGui/CMakeLists.txt
@@ -23,6 +23,7 @@ PYSIDE_TEST(qcursor_test.py)
PYSIDE_TEST(qdatastream_gui_operators_test.py)
PYSIDE_TEST(qdesktopservices_test.py)
PYSIDE_TEST(qfontmetrics_test.py)
+PYSIDE_TEST(qguiapplication_test.py)
PYSIDE_TEST(qicon_test.py)
PYSIDE_TEST(qitemselection_test.py)
PYSIDE_TEST(qmatrix_test.py)
diff --git a/sources/pyside2/tests/QtGui/qguiapplication_test.py b/sources/pyside2/tests/QtGui/qguiapplication_test.py
new file mode 100644
index 000000000..d1a044655
--- /dev/null
+++ b/sources/pyside2/tests/QtGui/qguiapplication_test.py
@@ -0,0 +1,40 @@
+#############################################################################
+##
+## Copyright (C) 2018 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of Qt for Python.
+##
+## $QT_BEGIN_LICENSE:GPL-EXCEPT$
+## 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 General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU
+## General Public License version 3 as published by the Free Software
+## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+## 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-3.0.html.
+##
+## $QT_END_LICENSE$
+##
+#############################################################################
+
+import unittest
+
+from PySide2.QtGui import QGuiApplication
+
+class TestQGuiApplication(unittest.TestCase):
+ def testNoArguments(self):
+ app = QGuiApplication()
+ self.assertIsInstance(app, QGuiApplication)
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/sources/pyside2/tests/QtWidgets/CMakeLists.txt b/sources/pyside2/tests/QtWidgets/CMakeLists.txt
index b350133f9..4bc17ebee 100644
--- a/sources/pyside2/tests/QtWidgets/CMakeLists.txt
+++ b/sources/pyside2/tests/QtWidgets/CMakeLists.txt
@@ -84,6 +84,7 @@ PYSIDE_TEST(qabstracttextdocumentlayout_test.py)
PYSIDE_TEST(qaction_test.py)
PYSIDE_TEST(qapp_issue_585.py)
PYSIDE_TEST(qapp_test.py)
+PYSIDE_TEST(qapplication_test.py)
PYSIDE_TEST(qapplication_exit_segfault_test.py)
PYSIDE_TEST(qapplication_singleton_test.py)
PYSIDE_TEST(qbrush_test.py)
diff --git a/sources/pyside2/tests/QtWidgets/qapplication_test.py b/sources/pyside2/tests/QtWidgets/qapplication_test.py
new file mode 100644
index 000000000..b29aba6ac
--- /dev/null
+++ b/sources/pyside2/tests/QtWidgets/qapplication_test.py
@@ -0,0 +1,40 @@
+#############################################################################
+##
+## Copyright (C) 2018 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the test suite of Qt for Python.
+##
+## $QT_BEGIN_LICENSE:GPL-EXCEPT$
+## 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 General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU
+## General Public License version 3 as published by the Free Software
+## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+## 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-3.0.html.
+##
+## $QT_END_LICENSE$
+##
+#############################################################################
+
+import unittest
+
+from PySide2.QtWidgets import QApplication
+
+class TestQApplication(unittest.TestCase):
+ def testNoArguments(self):
+ app = QApplication()
+ self.assertIsInstance(app, QApplication)
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/sources/pyside2/tests/QtWidgets/qstyle_test.py b/sources/pyside2/tests/QtWidgets/qstyle_test.py
index 38b457a82..eb2a73d29 100644
--- a/sources/pyside2/tests/QtWidgets/qstyle_test.py
+++ b/sources/pyside2/tests/QtWidgets/qstyle_test.py
@@ -29,7 +29,20 @@
import unittest
from helper import UsesQApplication
-from PySide2.QtWidgets import QWidget, QLabel, QFontComboBox, QStyleFactory
+from PySide2.QtGui import QWindow
+from PySide2.QtWidgets import (QApplication, QFontComboBox, QLabel, QProxyStyle,
+ QStyleFactory, QWidget)
+
+class ProxyStyle(QProxyStyle):
+
+ def __init__(self, style):
+ QProxyStyle.__init__(self, style)
+ self.polished = 0
+
+ def polish(self, widget):
+ self.polished = self.polished + 1
+ super(ProxyStyle, self).polish(widget)
+
class SetStyleTest(UsesQApplication):
'''Tests setting the same QStyle for all objects in a UI hierarchy.'''
@@ -54,6 +67,17 @@ class SetStyleTest(UsesQApplication):
style = QStyleFactory.create(QStyleFactory.keys()[0])
setStyleHelper(container, style)
+ def testSetProxyStyle(self):
+ label = QLabel("QtWidgets/ProxyStyle test")
+ baseStyle = QStyleFactory.create(QApplication.instance().style().objectName())
+ self.assertTrue(baseStyle)
+ proxyStyle = ProxyStyle(baseStyle)
+ label.setStyle(proxyStyle)
+ label.show()
+ while not label.windowHandle().isExposed():
+ QApplication.instance().processEvents()
+ self.assertTrue(proxyStyle.polished > 0)
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside2/tests/registry/exists_darwin_5_9_4_ci.py b/sources/pyside2/tests/registry/exists_darwin_5_9_4_ci.py
index 95f3fe237..63a74ff07 100644
--- a/sources/pyside2/tests/registry/exists_darwin_5_9_4_ci.py
+++ b/sources/pyside2/tests/registry/exists_darwin_5_9_4_ci.py
@@ -14556,7 +14556,7 @@ if "PySide2.QtMultimedia" in sys.modules:
"QMediaResource.videoCodec": (),
# class PySide2.QtMultimedia.QMediaTimeRange:
- "QMediaTimeRange.__init__": [(), ('PySide2.QtMultimedia.QMediaTimeRange',), ('int', 'int')],
+ "QMediaTimeRange.__init__": [(), ('PySide2.QtMultimedia.QMediaTimeInterval',), ('PySide2.QtMultimedia.QMediaTimeRange',), ('int', 'int')],
"QMediaTimeRange.__copy__": (),
"QMediaTimeRange.addInterval": ('int', 'int'),
"QMediaTimeRange.addTimeRange": ('PySide2.QtMultimedia.QMediaTimeRange',),
diff --git a/sources/pyside2/tests/registry/exists_linux_5_9_4_ci.py b/sources/pyside2/tests/registry/exists_linux_5_9_4_ci.py
index 79e826258..c552e21f0 100644
--- a/sources/pyside2/tests/registry/exists_linux_5_9_4_ci.py
+++ b/sources/pyside2/tests/registry/exists_linux_5_9_4_ci.py
@@ -14349,7 +14349,7 @@ if "PySide2.QtMultimedia" in sys.modules:
"QMediaResource.videoCodec": (),
# class PySide2.QtMultimedia.QMediaTimeRange:
- "QMediaTimeRange.__init__": [(), ('PySide2.QtMultimedia.QMediaTimeRange',), ('int', 'int')],
+ "QMediaTimeRange.__init__": [(), ('PySide2.QtMultimedia.QMediaTimeInterval',), ('PySide2.QtMultimedia.QMediaTimeRange',), ('int', 'int')],
"QMediaTimeRange.__copy__": (),
"QMediaTimeRange.addInterval": ('int', 'int'),
"QMediaTimeRange.addTimeRange": ('PySide2.QtMultimedia.QMediaTimeRange',),
diff --git a/sources/pyside2/tests/registry/exists_win32_5_9_4_ci.py b/sources/pyside2/tests/registry/exists_win32_5_9_4_ci.py
index 20c30e1a3..01e572e21 100644
--- a/sources/pyside2/tests/registry/exists_win32_5_9_4_ci.py
+++ b/sources/pyside2/tests/registry/exists_win32_5_9_4_ci.py
@@ -14657,7 +14657,7 @@ if "PySide2.QtMultimedia" in sys.modules:
"QMediaResource.videoCodec": (),
# class PySide2.QtMultimedia.QMediaTimeRange:
- "QMediaTimeRange.__init__": [(), ('PySide2.QtMultimedia.QMediaTimeRange',), ('int', 'int')],
+ "QMediaTimeRange.__init__": [(), ('PySide2.QtMultimedia.QMediaTimeInterval',), ('PySide2.QtMultimedia.QMediaTimeRange',), ('int', 'int')],
"QMediaTimeRange.__copy__": (),
"QMediaTimeRange.addInterval": ('int', 'int'),
"QMediaTimeRange.addTimeRange": ('PySide2.QtMultimedia.QMediaTimeRange',),
diff --git a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
index 8e1732be9..23feeafad 100644
--- a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
+++ b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
@@ -1878,6 +1878,12 @@ static inline QString msgUnmatchedParameterType(const ArgumentModelItem &arg, in
return result;
}
+static inline QString msgUnmatchedReturnType(const FunctionModelItem &functionItem)
+{
+ return QLatin1String("unmatched return type '")
+ + functionItem->type().toString() + QLatin1Char('\'');
+}
+
static inline QString msgVoidParameterType(const ArgumentModelItem &arg, int n)
{
QString result;
@@ -1888,6 +1894,22 @@ static inline QString msgVoidParameterType(const ArgumentModelItem &arg, int n)
return result;
}
+static QString msgSkippingFunction(const FunctionModelItem &functionItem,
+ const QString &signature, const QString &why)
+{
+ QString result;
+ QTextStream str(&result);
+ str << "skipping ";
+ if (functionItem->isAbstract())
+ str << "abstract ";
+ str << "function '" << signature << "', " << why;
+ if (functionItem->isAbstract()) {
+ str << "\nThis will lead to compilation errors due to not "
+ "being able to instantiate the wrapper.";
+ }
+ return result;
+}
+
static inline AbstractMetaFunction::FunctionType functionTypeFromCodeModel(CodeModel::FunctionType ft)
{
AbstractMetaFunction::FunctionType result = AbstractMetaFunction::NormalFunction;
@@ -2048,13 +2070,11 @@ AbstractMetaFunction *AbstractMetaBuilderPrivate::traverseFunction(FunctionModel
bool ok;
AbstractMetaType *type = translateType(returnType, &ok);
-
if (!ok) {
Q_ASSERT(type == 0);
- qCWarning(lcShiboken).noquote().nospace()
- << QStringLiteral("skipping function '%1', unmatched return type '%2'")
- .arg(originalQualifiedSignatureWithReturn,
- functionItem->type().toString());
+ const QString reason = msgUnmatchedReturnType(functionItem);
+ qCWarning(lcShiboken, "%s",
+ qPrintable(msgSkippingFunction(functionItem, originalQualifiedSignatureWithReturn, reason)));
m_rejectedFunctions.insert(originalQualifiedSignatureWithReturn, AbstractMetaBuilder::UnmatchedReturnType);
delete metaFunction;
return nullptr;
@@ -2104,9 +2124,8 @@ AbstractMetaFunction *AbstractMetaBuilderPrivate::traverseFunction(FunctionModel
}
Q_ASSERT(metaType == 0);
const QString reason = msgUnmatchedParameterType(arg, i);
- qCWarning(lcShiboken).noquote().nospace()
- << QStringLiteral("skipping function '%1', %2")
- .arg(originalQualifiedSignatureWithReturn, reason);
+ qCWarning(lcShiboken, "%s",
+ qPrintable(msgSkippingFunction(functionItem, originalQualifiedSignatureWithReturn, reason)));
const QString rejectedFunctionSignature = originalQualifiedSignatureWithReturn
+ QLatin1String(": ") + reason;
m_rejectedFunctions.insert(rejectedFunctionSignature, AbstractMetaBuilder::UnmatchedArgumentType);
@@ -2116,9 +2135,8 @@ AbstractMetaFunction *AbstractMetaBuilderPrivate::traverseFunction(FunctionModel
if (metaType == Q_NULLPTR) {
const QString reason = msgVoidParameterType(arg, i);
- qCWarning(lcShiboken).noquote().nospace()
- << QString::fromLatin1("skipping function '%1': %2")
- .arg(originalQualifiedSignatureWithReturn, reason);
+ qCWarning(lcShiboken, "%s",
+ qPrintable(msgSkippingFunction(functionItem, originalQualifiedSignatureWithReturn, reason)));
const QString rejectedFunctionSignature = originalQualifiedSignatureWithReturn
+ QLatin1String(": ") + reason;
m_rejectedFunctions.insert(rejectedFunctionSignature, AbstractMetaBuilder::UnmatchedArgumentType);
diff --git a/sources/shiboken2/ApiExtractor/abstractmetalang.cpp b/sources/shiboken2/ApiExtractor/abstractmetalang.cpp
index ba33f78d9..5be7050bf 100644
--- a/sources/shiboken2/ApiExtractor/abstractmetalang.cpp
+++ b/sources/shiboken2/ApiExtractor/abstractmetalang.cpp
@@ -189,6 +189,11 @@ AbstractMetaTypeCList AbstractMetaType::nestedArrayTypes() const
return result;
}
+bool AbstractMetaType::isConstRef() const
+{
+ return isConstant() && m_referenceType == LValueReference && indirections() == 0;
+}
+
QString AbstractMetaType::cppSignature() const
{
if (m_cachedCppSignature.isEmpty())
@@ -201,10 +206,8 @@ AbstractMetaType::TypeUsagePattern AbstractMetaType::determineUsagePattern() con
if (m_typeEntry->isTemplateArgument() || m_referenceType == RValueReference)
return InvalidPattern;
- if (m_typeEntry->isPrimitive() && (!actualIndirections()
- || (isConstant() && m_referenceType == LValueReference && !indirections()))) {
+ if (m_typeEntry->isPrimitive() && (actualIndirections() == 0 || isConstRef()))
return PrimitivePattern;
- }
if (m_typeEntry->isVoid())
return NativePointerPattern;
@@ -212,7 +215,7 @@ AbstractMetaType::TypeUsagePattern AbstractMetaType::determineUsagePattern() con
if (m_typeEntry->isVarargs())
return VarargsPattern;
- if (m_typeEntry->isEnum() && actualIndirections() == 0)
+ if (m_typeEntry->isEnum() && (actualIndirections() == 0 || isConstRef()))
return EnumPattern;
if (m_typeEntry->isObject()) {
@@ -228,8 +231,7 @@ AbstractMetaType::TypeUsagePattern AbstractMetaType::determineUsagePattern() con
if (m_typeEntry->isSmartPointer() && indirections() == 0)
return SmartPointerPattern;
- if (m_typeEntry->isFlags() && indirections() == 0
- && (isConstant() == (m_referenceType == LValueReference)))
+ if (m_typeEntry->isFlags() && (actualIndirections() == 0 || isConstRef()))
return FlagsPattern;
if (m_typeEntry->isArray())
@@ -1754,7 +1756,7 @@ void AbstractMetaClass::addDefaultConstructor()
f->setArguments(AbstractMetaArgumentList());
f->setDeclaringClass(this);
- f->setAttributes(AbstractMetaAttributes::Public | AbstractMetaAttributes::FinalInTargetLang);
+ f->setAttributes(Public | FinalInTargetLang | AddedMethod);
f->setImplementingClass(this);
f->setOriginalAttributes(f->attributes());
@@ -1782,7 +1784,7 @@ void AbstractMetaClass::addDefaultCopyConstructor(bool isPrivate)
arg->setName(name());
f->addArgument(arg);
- AbstractMetaAttributes::Attributes attr = AbstractMetaAttributes::FinalInTargetLang;
+ AbstractMetaAttributes::Attributes attr = FinalInTargetLang | AddedMethod;
if (isPrivate)
attr |= AbstractMetaAttributes::Private;
else
@@ -2154,8 +2156,11 @@ void AbstractMetaClass::fixFunctions()
funcsToAdd << sf;
}
- for (AbstractMetaFunction *f : qAsConst(funcsToAdd))
- funcs << f->copy();
+ for (AbstractMetaFunction *f : qAsConst(funcsToAdd)) {
+ AbstractMetaFunction *copy = f->copy();
+ (*copy) += AddedMethod;
+ funcs.append(copy);
+ }
if (superClass)
superClass = superClass->baseClass();
diff --git a/sources/shiboken2/ApiExtractor/abstractmetalang.h b/sources/shiboken2/ApiExtractor/abstractmetalang.h
index c31c5a386..d1a0fbf88 100644
--- a/sources/shiboken2/ApiExtractor/abstractmetalang.h
+++ b/sources/shiboken2/ApiExtractor/abstractmetalang.h
@@ -137,7 +137,9 @@ public:
FinalCppClass = 0x00100000,
VirtualCppMethod = 0x00200000,
OverriddenCppMethod = 0x00400000,
- FinalCppMethod = 0x00800000
+ FinalCppMethod = 0x00800000,
+ // Add by meta builder (implicit constructors, inherited methods, etc)
+ AddedMethod = 0x01000000
};
Q_DECLARE_FLAGS(Attributes, Attribute)
Q_FLAG(Attribute)
@@ -434,6 +436,8 @@ public:
m_constant = constant;
}
+ bool isConstRef() const;
+
ReferenceType referenceType() const { return m_referenceType; }
void setReferenceType(ReferenceType ref) { m_referenceType = ref; }
diff --git a/sources/shiboken2/ApiExtractor/docparser.cpp b/sources/shiboken2/ApiExtractor/docparser.cpp
index 0cbae33eb..9305332ba 100644
--- a/sources/shiboken2/ApiExtractor/docparser.cpp
+++ b/sources/shiboken2/ApiExtractor/docparser.cpp
@@ -82,6 +82,7 @@ bool DocParser::skipForQuery(const AbstractMetaFunction *func)
{
// Skip private functions and copies created by AbstractMetaClass::fixFunctions()
if (!func || func->isPrivate()
+ || (func->attributes() & AbstractMetaAttributes::AddedMethod) != 0
|| func->isModifiedRemoved()
|| func->declaringClass() != func->ownerClass()
|| func->isCastOperator()) {
@@ -124,9 +125,9 @@ QString DocParser::msgCannotFindDocumentation(const QString &fileName,
const AbstractMetaFunction *function,
const QString &query)
{
- return msgCannotFindDocumentation(fileName, "function",
- metaClass->name() + QLatin1String("::") + function->name() + QLatin1String("()"),
- query);
+ const QString name = metaClass->name() + QLatin1String("::")
+ + function->minimalSignature();
+ return msgCannotFindDocumentation(fileName, "function", name, query);
}
QString DocParser::msgCannotFindDocumentation(const QString &fileName,
diff --git a/sources/shiboken2/ApiExtractor/qtdocparser.cpp b/sources/shiboken2/ApiExtractor/qtdocparser.cpp
index 8917f801e..b0058d6ea 100644
--- a/sources/shiboken2/ApiExtractor/qtdocparser.cpp
+++ b/sources/shiboken2/ApiExtractor/qtdocparser.cpp
@@ -35,6 +35,8 @@
#include <QtCore/QDir>
#include <QtCore/QFile>
#include <QtCore/QTextStream>
+#include <QtCore/QXmlStreamAttributes>
+#include <QtCore/QXmlStreamReader>
#include <QUrl>
Documentation QtDocParser::retrieveModuleDocumentation()
@@ -48,9 +50,6 @@ static void formatFunctionArgTypeQuery(QTextStream &str, const AbstractMetaArgum
if (metaType->isConstant())
str << "const " ;
switch (metaType->typeUsagePattern()) {
- case AbstractMetaType::PrimitivePattern:
- str << metaType->name();
- break;
case AbstractMetaType::FlagsPattern: {
// Modify qualified name "QFlags<Qt::AlignmentFlag>" with name "Alignment"
// to "Qt::Alignment" as seen by qdoc.
@@ -92,6 +91,119 @@ static void formatFunctionArgTypeQuery(QTextStream &str, const AbstractMetaArgum
str << ' ' << QByteArray(metaType->indirections(), '*');
}
+enum FunctionMatchFlags
+{
+ MatchArgumentCount = 0x1,
+ MatchArgumentType = 0x2,
+ DescriptionOnly = 0x4
+};
+
+static QString functionXQuery(const QString &classQuery,
+ const AbstractMetaFunction *func,
+ unsigned matchFlags = MatchArgumentCount | MatchArgumentType
+ | DescriptionOnly)
+{
+ QString result;
+ QTextStream str(&result);
+ const AbstractMetaArgumentList &arguments = func->arguments();
+ str << classQuery << "/function[@name=\"" << func->originalName()
+ << "\" and @const=\"" << (func->isConstant() ? "true" : "false") << '"';
+ if (matchFlags & MatchArgumentCount)
+ str << " and count(parameter)=" << arguments.size();
+ str << ']';
+ if (!arguments.isEmpty() && (matchFlags & MatchArgumentType)) {
+ for (int i = 0, size = arguments.size(); i < size; ++i) {
+ str << "/parameter[" << (i + 1) << "][@type=\"";
+ // Fixme: Use arguments.at(i)->type()->originalTypeDescription()
+ // instead to get unresolved typedefs?
+ formatFunctionArgTypeQuery(str, arguments.at(i));
+ str << "\"]/..";
+ }
+ }
+ if (matchFlags & DescriptionOnly)
+ str << "/description";
+ return result;
+}
+
+static QStringList signaturesFromWebXml(QString w)
+{
+ QStringList result;
+ if (w.isEmpty())
+ return result;
+ w.prepend(QLatin1String("<root>")); // Fake root element
+ w.append(QLatin1String("</root>"));
+ QXmlStreamReader reader(w);
+ while (!reader.atEnd()) {
+ if (reader.readNext() == QXmlStreamReader::StartElement
+ && reader.name() == QLatin1String("function")) {
+ result.append(reader.attributes().value(QStringLiteral("signature")).toString());
+ }
+ }
+ return result;
+}
+
+static QString msgArgumentCountMatch(const AbstractMetaFunction *func,
+ const QStringList &matches)
+{
+ QString result;
+ QTextStream str(&result);
+ str << "\n Note: Querying for the argument count=="
+ << func->arguments().size() << " only yields " << matches.size()
+ << " matches";
+ if (!matches.isEmpty())
+ str << ": \"" << matches.join(QLatin1String("\", \"")) << '"';
+ return result;
+}
+
+QString QtDocParser::queryFunctionDocumentation(const QString &sourceFileName,
+ const AbstractMetaClass* metaClass,
+ const QString &classQuery,
+ const AbstractMetaFunction *func,
+ const DocModificationList &signedModifs,
+ QXmlQuery &xquery,
+ QString *errorMessage)
+{
+ DocModificationList funcModifs;
+ for (const DocModification &funcModif : signedModifs) {
+ if (funcModif.signature() == func->minimalSignature())
+ funcModifs.append(funcModif);
+ }
+
+ // Properties
+ if (func->isPropertyReader() || func->isPropertyWriter() || func->isPropertyResetter()) {
+ const QString propertyQuery = classQuery + QLatin1String("/property[@name=\"")
+ + func->propertySpec()->name() + QLatin1String("\"]/description");
+ const QString properyDocumentation = getDocumentation(xquery, propertyQuery, funcModifs);
+ if (properyDocumentation.isEmpty())
+ *errorMessage = msgCannotFindDocumentation(sourceFileName, metaClass, func, propertyQuery);
+ return properyDocumentation;
+ }
+
+ // Query with full match of argument types
+ const QString fullQuery = functionXQuery(classQuery, func);
+ const QString result = getDocumentation(xquery, fullQuery, funcModifs);
+ if (!result.isEmpty())
+ return result;
+ *errorMessage = msgCannotFindDocumentation(sourceFileName, metaClass, func, fullQuery);
+ if (func->arguments().isEmpty()) // No arguments, can't be helped
+ return result;
+ // Test whether some mismatch in argument types occurred by checking for
+ // the argument count only. Include the outer <function> element.
+ QString countOnlyQuery = functionXQuery(classQuery, func, MatchArgumentCount);
+ QStringList signatures =
+ signaturesFromWebXml(getDocumentation(xquery, countOnlyQuery, funcModifs));
+ if (signatures.size() == 1) {
+ // One match was found. Repeat the query restricted to the <description>
+ // element and use the result with a warning.
+ countOnlyQuery = functionXQuery(classQuery, func, MatchArgumentCount | DescriptionOnly);
+ errorMessage->append(QLatin1String("\n Falling back to \"") + signatures.constFirst()
+ + QLatin1String("\" obtained by matching the argument count only."));
+ return getDocumentation(xquery, countOnlyQuery, funcModifs);
+ }
+ *errorMessage += msgArgumentCountMatch(func, signatures);
+ return result;
+}
+
void QtDocParser::fillDocumentation(AbstractMetaClass* metaClass)
{
if (!metaClass)
@@ -144,40 +256,16 @@ void QtDocParser::fillDocumentation(AbstractMetaClass* metaClass)
qCWarning(lcShiboken(), "%s", qPrintable(msgCannotFindDocumentation(sourceFileName, "class", className, query)));
metaClass->setDocumentation(doc);
-
//Functions Documentation
+ QString errorMessage;
const AbstractMetaFunctionList &funcs = DocParser::documentableFunctions(metaClass);
for (AbstractMetaFunction *func : funcs) {
- query.clear();
- QTextStream str(&query);
- str << classQuery;
- // properties
- if (func->isPropertyReader() || func->isPropertyWriter() || func->isPropertyResetter()) {
- str << "/property[@name=\"" << func->propertySpec()->name() << "\"]";
- } else { // normal methods
- str << "/function[@name=\"" << func->originalName() << "\" and count(parameter)="
- << func->arguments().count() << " and @const=\""
- << (func->isConstant() ? "true" : "false") << "\"]";
-
- const AbstractMetaArgumentList &arguments = func->arguments();
- for (int i = 0, size = arguments.size(); i < size; ++i) {
- str << "/parameter[" << (i + 1) << "][@type=\"";
- formatFunctionArgTypeQuery(str, arguments.at(i));
- str << "\"]/..";
- }
- }
- str << "/description";
- DocModificationList funcModifs;
- for (const DocModification &funcModif : qAsConst(signedModifs)) {
- if (funcModif.signature() == func->minimalSignature())
- funcModifs.append(funcModif);
- }
- doc.setValue(getDocumentation(xquery, query, funcModifs));
- if (doc.isEmpty()) {
- qCWarning(lcShiboken(), "%s",
- qPrintable(msgCannotFindDocumentation(sourceFileName, metaClass, func, query)));
- }
- func->setDocumentation(doc);
+ const QString documentation =
+ queryFunctionDocumentation(sourceFileName, metaClass, classQuery,
+ func, signedModifs, xquery, &errorMessage);
+ if (!errorMessage.isEmpty())
+ qCWarning(lcShiboken(), "%s", qPrintable(errorMessage));
+ func->setDocumentation(Documentation(documentation));
}
#if 0
// Fields
@@ -206,18 +294,28 @@ void QtDocParser::fillDocumentation(AbstractMetaClass* metaClass)
}
}
+static QString qmlReferenceLink(const QFileInfo &qmlModuleFi)
+{
+ QString result;
+ QTextStream(&result) << "<para>The module also provides <link"
+ << " type=\"page\""
+ << " page=\"http://doc.qt.io/qt-5/" << qmlModuleFi.baseName() << ".html\""
+ << ">QML types</link>.</para>";
+ return result;
+}
+
Documentation QtDocParser::retrieveModuleDocumentation(const QString& name)
{
// TODO: This method of acquiring the module name supposes that the target language uses
// dots as module separators in package names. Improve this.
QString moduleName = name;
moduleName.remove(0, name.lastIndexOf(QLatin1Char('.')) + 1);
- QString sourceFile = documentationDataDirectory() + QLatin1Char('/')
- + moduleName.toLower() + QLatin1String(".xml");
+ const QString prefix = documentationDataDirectory() + QLatin1Char('/')
+ + moduleName.toLower();
+ QString sourceFile = prefix + QLatin1String(".xml");
if (!QFile::exists(sourceFile))
- sourceFile = documentationDataDirectory() + QLatin1Char('/')
- + moduleName.toLower() + QLatin1String("-module.webxml");
+ sourceFile = prefix + QLatin1String("-module.webxml");
if (!QFile::exists(sourceFile)) {
qCWarning(lcShiboken).noquote().nospace()
<< "Can't find qdoc file for module " << name << ", tried: "
@@ -231,8 +329,22 @@ Documentation QtDocParser::retrieveModuleDocumentation(const QString& name)
// Module documentation
QString query = QLatin1String("/WebXML/document/module[@name=\"")
+ moduleName + QLatin1String("\"]/description");
- const Documentation doc = getDocumentation(xquery, query, DocModificationList());
- if (doc.isEmpty())
+ Documentation doc = getDocumentation(xquery, query, DocModificationList());
+ if (doc.isEmpty()) {
qCWarning(lcShiboken(), "%s", qPrintable(msgCannotFindDocumentation(sourceFile, "module", name, query)));
+ return doc;
+ }
+
+ // If a QML module info file exists, insert a link to the Qt docs.
+ const QFileInfo qmlModuleFi(prefix + QLatin1String("-qmlmodule.webxml"));
+ if (qmlModuleFi.isFile()) {
+ QString docString = doc.value();
+ const int pos = docString.lastIndexOf(QLatin1String("</description>"));
+ if (pos != -1) {
+ docString.insert(pos, qmlReferenceLink(qmlModuleFi));
+ doc.setValue(docString);
+ }
+ }
+
return doc;
}
diff --git a/sources/shiboken2/ApiExtractor/qtdocparser.h b/sources/shiboken2/ApiExtractor/qtdocparser.h
index 3ea0122b4..b5f0e51d8 100644
--- a/sources/shiboken2/ApiExtractor/qtdocparser.h
+++ b/sources/shiboken2/ApiExtractor/qtdocparser.h
@@ -38,6 +38,15 @@ public:
void fillDocumentation(AbstractMetaClass* metaClass) override;
Documentation retrieveModuleDocumentation() override;
Documentation retrieveModuleDocumentation(const QString& name) override;
+
+private:
+ QString queryFunctionDocumentation(const QString &sourceFileName,
+ const AbstractMetaClass* metaClass,
+ const QString &classQuery,
+ const AbstractMetaFunction *func,
+ const DocModificationList &signedModifs,
+ QXmlQuery &xquery,
+ QString *errorMessage);
};
#endif // QTDOCPARSER_H
diff --git a/sources/shiboken2/CMakeLists.txt b/sources/shiboken2/CMakeLists.txt
index 3efc6fefe..0a2920e4f 100644
--- a/sources/shiboken2/CMakeLists.txt
+++ b/sources/shiboken2/CMakeLists.txt
@@ -19,8 +19,8 @@ if (USE_PYTHON_VERSION)
find_package(PythonInterp ${USE_PYTHON_VERSION} REQUIRED)
find_package(PythonLibs ${USE_PYTHON_VERSION} REQUIRED)
else()
- find_package(PythonInterp 2.6)
- find_package(PythonLibs 2.6)
+ find_package(PythonInterp 2.7)
+ find_package(PythonLibs 2.7)
endif()
macro(get_python_arch)
diff --git a/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp b/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp
index 7206d7ca8..489d498f9 100644
--- a/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp
+++ b/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp
@@ -464,8 +464,10 @@ QString QtXmlToSphinx::transform(const QString& doc)
while (!reader.atEnd()) {
QXmlStreamReader::TokenType token = reader.readNext();
if (reader.hasError()) {
- const QString message = QLatin1String("XML Error: ") + reader.errorString()
- + QLatin1Char('\n') + doc;
+ QString message;
+ QTextStream(&message) << "XML Error "
+ << reader.errorString() << " at " << reader.lineNumber()
+ << ':' << reader.columnNumber() << '\n' << doc;
m_output << INDENT << message;
qCWarning(lcShiboken).noquote().nospace() << message;
break;
@@ -2194,44 +2196,61 @@ void QtDocGenerator::writeAdditionalDocumentation()
qPrintable(FileOut::msgCannotOpenForReading(additionalDocumentationFile)));
return;
}
- const QByteArray contents = additionalDocumentationFile.readAll();
- const QStringList lines = QFile::decodeName(contents).split(QLatin1Char('\n'));
- QFileInfoList additionalDocFiles;
- additionalDocFiles.reserve(lines.size());
- for (const QString &lineIn : lines) {
- const QString line = lineIn.trimmed();
- if (!line.isEmpty() && !line.startsWith(QLatin1Char('#'))) {
+
+ QDir outDir(outputDirectory());
+ const QString rstSuffix = fileNameSuffix();
+
+ QString errorMessage;
+ int successCount = 0;
+ int count = 0;
+
+ QString targetDir = outDir.absolutePath();
+
+ while (!additionalDocumentationFile.atEnd()) {
+ const QByteArray lineBA = additionalDocumentationFile.readLine().trimmed();
+ if (lineBA.isEmpty() || lineBA.startsWith('#'))
+ continue;
+ const QString line = QFile::decodeName(lineBA);
+ // Parse "[directory]" specification
+ if (line.size() > 2 && line.startsWith(QLatin1Char('[')) && line.endsWith(QLatin1Char(']'))) {
+ const QString dir = line.mid(1, line.size() - 2);
+ if (dir.isEmpty() || dir == QLatin1String(".")) {
+ targetDir = outDir.absolutePath();
+ } else {
+ if (!outDir.exists(dir) && !outDir.mkdir(dir)) {
+ qCWarning(lcShiboken, "Cannot create directory %s under %s",
+ qPrintable(dir),
+ qPrintable(QDir::toNativeSeparators(outputDirectory())));
+ break;
+ }
+ targetDir = outDir.absoluteFilePath(dir);
+ }
+ } else {
+ // Normal file entry
QFileInfo fi(m_docDataDir + QLatin1Char('/') + line);
if (fi.isFile()) {
- additionalDocFiles.append(fi);
+ const QString rstFileName = fi.baseName() + rstSuffix;
+ const QString rstFile = targetDir + QLatin1Char('/') + rstFileName;
+ if (QtXmlToSphinx::convertToRst(this, fi.absoluteFilePath(),
+ rstFile, QString(), &errorMessage)) {
+ ++successCount;
+ qCDebug(lcShiboken).nospace().noquote() << __FUNCTION__
+ << " converted " << fi.fileName()
+ << ' ' << rstFileName;
+ } else {
+ qCWarning(lcShiboken, "%s", qPrintable(errorMessage));
+ }
} else {
qCWarning(lcShiboken, "%s",
qPrintable(msgNonExistentAdditionalDocFile(m_docDataDir, line)));
}
+ ++count;
}
}
additionalDocumentationFile.close();
- const QString rstPrefix = outputDirectory() + QLatin1Char('/');
- const QString rstSuffix = fileNameSuffix();
-
- QString errorMessage;
- int successCount = 0;
- for (const QFileInfo &additionalDocFile : additionalDocFiles) {
- const QString rstFileName = additionalDocFile.baseName() + rstSuffix;
- const QString rstFile = rstPrefix + rstFileName;
- if (QtXmlToSphinx::convertToRst(this, additionalDocFile.absoluteFilePath(),
- rstFile, QString(), &errorMessage)) {
- ++successCount;
- qCDebug(lcShiboken).nospace().noquote() << __FUNCTION__
- << " converted " << additionalDocFile.fileName()
- << ' ' << rstFileName;
- } else {
- qCWarning(lcShiboken, "%s", qPrintable(errorMessage));
- }
- }
qCInfo(lcShiboken, "Created %d/%d additional documentation files.",
- successCount, additionalDocFiles.size());
+ successCount, count);
}
bool QtDocGenerator::doSetup(const QMap<QString, QString>& args)
diff --git a/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp b/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp
index b2734418c..6165ef009 100644
--- a/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp
+++ b/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp
@@ -1996,6 +1996,17 @@ static QString getConverterTypeSystemVariableArgument(const QString& code, int p
return arg;
}
typedef QPair<QString, QString> StringPair;
+
+static QString msgCannotFindType(const QString &type, const QString &variable,
+ const QString &why)
+{
+ QString result;
+ QTextStream(&result) << "Could not find type '"
+ << type << "' for use in '" << variable << "' conversion: " << why
+ << "\nMake sure to use the full C++ name, e.g. 'Namespace::Class'.";
+ return result;
+}
+
void ShibokenGenerator::replaceConverterTypeSystemVariable(TypeSystemConverterVariable converterVariable, QString& code)
{
QVector<StringPair> replacements;
@@ -2005,12 +2016,12 @@ void ShibokenGenerator::replaceConverterTypeSystemVariable(TypeSystemConverterVa
const QStringList list = match.capturedTexts();
QString conversionString = list.constFirst();
QString conversionTypeName = list.constLast();
- const AbstractMetaType* conversionType = buildAbstractMetaTypeFromString(conversionTypeName);
+ QString message;
+ const AbstractMetaType *conversionType = buildAbstractMetaTypeFromString(conversionTypeName, &message);
if (!conversionType) {
- qFatal(qPrintable(QString::fromLatin1("Could not find type '%1' for use in '%2' conversion. "
- "Make sure to use the full C++ name, e.g. 'Namespace::Class'.")
- .arg(conversionTypeName).arg(m_typeSystemConvName[converterVariable])), NULL);
-
+ qFatal("%s", qPrintable(msgCannotFindType(conversionTypeName,
+ m_typeSystemConvName[converterVariable],
+ message)));
}
QString conversion;
QTextStream c(&conversion);
@@ -2312,7 +2323,8 @@ bool ShibokenGenerator::isCopyable(const AbstractMetaClass *metaClass)
return false;
}
-AbstractMetaType* ShibokenGenerator::buildAbstractMetaTypeFromString(QString typeSignature)
+AbstractMetaType *ShibokenGenerator::buildAbstractMetaTypeFromString(QString typeSignature,
+ QString *errorMessage)
{
typeSignature = typeSignature.trimmed();
if (typeSignature.startsWith(QLatin1String("::")))
@@ -2348,9 +2360,10 @@ AbstractMetaType* ShibokenGenerator::buildAbstractMetaTypeFromString(QString typ
typeString.remove(0, 2);
QString adjustedTypeName = typeString;
- QStringList instantiatedTypes;
+ AbstractMetaTypeList instantiations;
int lpos = typeString.indexOf(QLatin1Char('<'));
if (lpos > -1) {
+ QStringList instantiatedTypes;
int rpos = typeString.lastIndexOf(QLatin1Char('>'));
if ((lpos != -1) && (rpos != -1)) {
QString type = typeString.mid(lpos + 1, rpos - lpos - 1);
@@ -2369,25 +2382,57 @@ AbstractMetaType* ShibokenGenerator::buildAbstractMetaTypeFromString(QString typ
instantiatedTypes << type.mid(start).trimmed();
adjustedTypeName.truncate(lpos);
}
+ for (const QString &instantiatedType : qAsConst(instantiatedTypes)) {
+ AbstractMetaType *tmplArgType = buildAbstractMetaTypeFromString(instantiatedType);
+ if (!tmplArgType) {
+ if (errorMessage) {
+ QTextStream(errorMessage) << "Cannot find template type \""
+ << instantiatedType << "\" for \"" << typeSignature << "\".";
+ }
+ return nullptr;
+ }
+ instantiations.append(tmplArgType);
+ }
}
- TypeEntry* typeEntry = TypeDatabase::instance()->findType(adjustedTypeName);
+ TypeEntry *typeEntry = nullptr;
+ AbstractMetaType::TypeUsagePattern pattern = AbstractMetaType::InvalidPattern;
- AbstractMetaType* metaType = 0;
- if (typeEntry) {
- metaType = new AbstractMetaType();
- metaType->setTypeEntry(typeEntry);
- metaType->setIndirections(indirections);
- metaType->setReferenceType(refType);
- metaType->setConstant(isConst);
- metaType->setTypeUsagePattern(AbstractMetaType::ContainerPattern);
- for (const QString &instantiation : qAsConst(instantiatedTypes)) {
- AbstractMetaType* tmplArgType = buildAbstractMetaTypeFromString(instantiation);
- metaType->addInstantiation(tmplArgType);
+ if (instantiations.size() == 1
+ && instantiations.at(0)->typeUsagePattern() == AbstractMetaType::EnumPattern
+ && adjustedTypeName == QLatin1String("QFlags")) {
+ pattern = AbstractMetaType::FlagsPattern;
+ typeEntry = TypeDatabase::instance()->findType(typeSignature);
+ } else {
+ typeEntry = TypeDatabase::instance()->findType(adjustedTypeName);
+ }
+
+ if (!typeEntry) {
+ if (errorMessage) {
+ QTextStream(errorMessage) << "Cannot find type \"" << adjustedTypeName
+ << "\" for \"" << typeSignature << "\".";
}
+ return nullptr;
+ }
+
+ AbstractMetaType *metaType = new AbstractMetaType();
+ metaType->setTypeEntry(typeEntry);
+ metaType->setIndirections(indirections);
+ metaType->setReferenceType(refType);
+ metaType->setConstant(isConst);
+ metaType->setTypeUsagePattern(AbstractMetaType::ContainerPattern);
+ switch (pattern) {
+ case AbstractMetaType::FlagsPattern:
+ metaType->setTypeUsagePattern(pattern);
+ break;
+ default:
+ metaType->setInstantiations(instantiations);
+ metaType->setTypeUsagePattern(AbstractMetaType::ContainerPattern);
metaType->decideUsagePattern();
- m_metaTypeFromStringCache.insert(typeSignature, metaType);
+ break;
}
+
+ m_metaTypeFromStringCache.insert(typeSignature, metaType);
return metaType;
}
diff --git a/sources/shiboken2/generator/shiboken2/shibokengenerator.h b/sources/shiboken2/generator/shiboken2/shibokengenerator.h
index d44f4aa66..3271d741d 100644
--- a/sources/shiboken2/generator/shiboken2/shibokengenerator.h
+++ b/sources/shiboken2/generator/shiboken2/shibokengenerator.h
@@ -467,7 +467,8 @@ public:
* \param typeSignature The string describing the type to be built.
* \return A new AbstractMetaType object that must be deleted by the caller, or a NULL pointer in case of failure.
*/
- AbstractMetaType* buildAbstractMetaTypeFromString(QString typeSignature);
+ AbstractMetaType *buildAbstractMetaTypeFromString(QString typeSignature,
+ QString *errorMessage = nullptr);
/// Creates an AbstractMetaType object from a TypeEntry.
AbstractMetaType* buildAbstractMetaTypeFromTypeEntry(const TypeEntry* typeEntry);
diff --git a/sources/shiboken2/tests/libsample/objecttype.h b/sources/shiboken2/tests/libsample/objecttype.h
index 9d659faa4..bcb4f3332 100644
--- a/sources/shiboken2/tests/libsample/objecttype.h
+++ b/sources/shiboken2/tests/libsample/objecttype.h
@@ -53,6 +53,10 @@ struct Event
Event(EventType eventType) : m_eventType(eventType) {}
EventType eventType() { return m_eventType; }
+
+ void setEventType(EventType et) { m_eventType = et; }
+ void setEventTypeByConstRef(const EventType &et) { m_eventType = et; }
+
private:
EventType m_eventType;
};
diff --git a/sources/shiboken2/tests/samplebinding/enum_test.py b/sources/shiboken2/tests/samplebinding/enum_test.py
index 0a5a84c4a..7e1cac8c0 100644
--- a/sources/shiboken2/tests/samplebinding/enum_test.py
+++ b/sources/shiboken2/tests/samplebinding/enum_test.py
@@ -115,6 +115,14 @@ class EnumTest(unittest.TestCase):
sum = Event.EventTypeClass.Value1 + Event.EventTypeClass.Value2
self.assertEqual(sum, 1)
+ def testSetEnum(self):
+ event = Event(Event.ANY_EVENT)
+ self.assertEqual(event.eventType(), Event.ANY_EVENT)
+ event.setEventType(Event.BASIC_EVENT)
+ self.assertEqual(event.eventType(), Event.BASIC_EVENT)
+ event.setEventTypeByConstRef(Event.SOME_EVENT)
+ self.assertEqual(event.eventType(), Event.SOME_EVENT)
+
def testEnumTpPrintImplementation(self):
'''Without SbkEnum.tp_print 'print' returns the enum represented as an int.'''
tmpfile = createTempFile()