aboutsummaryrefslogtreecommitdiffstats
path: root/sources
diff options
context:
space:
mode:
Diffstat (limited to 'sources')
-rw-r--r--sources/cmake_helpers/helpers.cmake13
m---------sources/pyside2-tools0
-rw-r--r--sources/pyside2/CMakeLists.txt8
-rw-r--r--sources/pyside2/PySide2/CMakeLists.txt2
-rw-r--r--sources/pyside2/PySide2/QtCore/CMakeLists.txt48
-rw-r--r--sources/pyside2/PySide2/QtCore/typesystem_core_common.xml252
-rw-r--r--sources/pyside2/PySide2/QtGui/CMakeLists.txt62
-rw-r--r--sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml412
-rw-r--r--sources/pyside2/PySide2/QtNetwork/CMakeLists.txt7
-rw-r--r--sources/pyside2/PySide2/QtNetwork/typesystem_network.xml21
-rw-r--r--sources/pyside2/PySide2/QtOpenGL/CMakeLists.txt52
-rw-r--r--sources/pyside2/PySide2/QtOpenGL/typesystem_opengl.xml783
-rw-r--r--sources/pyside2/PySide2/QtOpenGLFunctions/CMakeLists.txt42
-rw-r--r--sources/pyside2/PySide2/QtOpenGLFunctions/QtOpenGLFunctions_global.post.h.in54
-rw-r--r--sources/pyside2/PySide2/QtOpenGLFunctions/typesystem_openglfunctions.xml4
-rw-r--r--sources/pyside2/PySide2/QtOpenGLWidgets/CMakeLists.txt34
-rw-r--r--sources/pyside2/PySide2/QtOpenGLWidgets/typesystem_openglwidgets.xml (renamed from sources/pyside2/PySide2/QtWebKit/typesystem_webkit.xml)15
-rw-r--r--sources/pyside2/PySide2/QtQml/pysideqmlregistertype.cpp236
-rw-r--r--sources/pyside2/PySide2/QtQml/pysideqmlregistertype.h25
-rw-r--r--sources/pyside2/PySide2/QtQml/typesystem_qml.xml51
-rw-r--r--sources/pyside2/PySide2/QtQuick/CMakeLists.txt11
-rw-r--r--sources/pyside2/PySide2/QtQuick/pysidequickregistertype.cpp147
-rw-r--r--sources/pyside2/PySide2/QtQuick/typesystem_quick.xml7
-rw-r--r--sources/pyside2/PySide2/QtSvg/CMakeLists.txt7
-rw-r--r--sources/pyside2/PySide2/QtSvg/typesystem_svg.xml17
-rw-r--r--sources/pyside2/PySide2/QtSvgWidgets/CMakeLists.txt39
-rw-r--r--sources/pyside2/PySide2/QtSvgWidgets/typesystem_svgwidgets.xml60
-rw-r--r--sources/pyside2/PySide2/QtTest/QtTest_global.pre.h.in2
-rw-r--r--sources/pyside2/PySide2/QtTest/typesystem_test.xml10
-rw-r--r--sources/pyside2/PySide2/QtUiTools/glue/plugins.h32
-rw-r--r--sources/pyside2/PySide2/QtUiTools/typesystem_uitools.xml25
-rw-r--r--sources/pyside2/PySide2/QtWebKit/CMakeLists.txt34
-rw-r--r--sources/pyside2/PySide2/QtWebKitWidgets/CMakeLists.txt65
-rw-r--r--sources/pyside2/PySide2/QtWebKitWidgets/typesystem_webkitwidgets.xml211
-rw-r--r--sources/pyside2/PySide2/QtWidgets/CMakeLists.txt9
-rw-r--r--sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml159
-rw-r--r--sources/pyside2/PySide2/__init__.py.in3
-rw-r--r--sources/pyside2/PySide2/global.h.in13
-rw-r--r--sources/pyside2/PySide2/glue/qtcore.cpp82
-rw-r--r--sources/pyside2/PySide2/glue/qtgui.cpp2
-rw-r--r--sources/pyside2/PySide2/glue/qtqml.cpp20
-rw-r--r--sources/pyside2/PySide2/glue/qtuitools.cpp11
-rw-r--r--sources/pyside2/PySide2/pysideqtesttouch.h122
-rw-r--r--sources/pyside2/PySide2/templates/core_common.xml4
-rw-r--r--sources/pyside2/cmake/Macros/PySideModules.cmake2
-rw-r--r--sources/pyside2/doc/CMakeLists.txt49
-rw-r--r--sources/pyside2/doc/_themes/pysidedocs_qthelp/domainindex.html57
-rw-r--r--sources/pyside2/doc/_themes/pysidedocs_qthelp/static/fakebar.pngbin0 -> 101 bytes
-rw-r--r--sources/pyside2/doc/_themes/pysidedocs_qthelp/static/logo_python.jpgbin0 -> 2660 bytes
-rw-r--r--sources/pyside2/doc/_themes/pysidedocs_qthelp/static/logo_qt.pngbin0 -> 1936 bytes
-rw-r--r--sources/pyside2/doc/_themes/pysidedocs_qthelp/static/minus.pngbin0 -> 199 bytes
-rw-r--r--sources/pyside2/doc/_themes/pysidedocs_qthelp/static/plus.pngbin0 -> 199 bytes
-rw-r--r--sources/pyside2/doc/_themes/pysidedocs_qthelp/static/pyside.css1943
-rw-r--r--sources/pyside2/doc/_themes/pysidedocs_qthelp/static/pysidelogo.pngbin0 -> 4936 bytes
-rw-r--r--sources/pyside2/doc/_themes/pysidedocs_qthelp/static/relbar_bg.pngbin0 -> 130 bytes
-rw-r--r--sources/pyside2/doc/_themes/pysidedocs_qthelp/theme.conf7
-rw-r--r--sources/pyside2/doc/codesnippets/examples/mainwindows/application/mainwindow.h3
-rw-r--r--sources/pyside2/doc/codesnippets/webkitsnippets/qtwebkit_qwebinspector_snippet.cpp60
-rw-r--r--sources/pyside2/doc/codesnippets/webkitsnippets/qtwebkit_qwebview_snippet.cpp80
-rw-r--r--sources/pyside2/doc/codesnippets/webkitsnippets/simple/main.cpp63
-rw-r--r--sources/pyside2/doc/codesnippets/webkitsnippets/webelement/main.cpp114
-rw-r--r--sources/pyside2/doc/codesnippets/webkitsnippets/webpage/main.cpp83
-rw-r--r--sources/pyside2/doc/conf.py.in11
-rw-r--r--sources/pyside2/doc/deployment-briefcase.rst199
-rw-r--r--sources/pyside2/doc/deployment.rst13
-rw-r--r--sources/pyside2/doc/extras/QtCore.Property.rst48
-rw-r--r--sources/pyside2/doc/extras/QtCore.QEnum.rst92
-rw-r--r--sources/pyside2/doc/extras/QtQml.qmlRegisterSingletonType.rst44
-rw-r--r--sources/pyside2/doc/extras/QtQml.qmlRegisterType.rst41
-rw-r--r--sources/pyside2/doc/extras/QtQml.qmlRegisterUncreatableType.rst36
-rw-r--r--sources/pyside2/doc/extras/QtUiTools.loadUiType.rst36
-rw-r--r--sources/pyside2/doc/extras/QtUiTools.rst2
-rw-r--r--sources/pyside2/doc/extras/QtWebKit.rst94
-rw-r--r--sources/pyside2/doc/gettingstarted.rst30
-rw-r--r--sources/pyside2/doc/index.rst99
-rw-r--r--sources/pyside2/doc/tutorials/basictutorial/style.qss23
-rw-r--r--sources/pyside2/doc/tutorials/basictutorial/uifiles.rst2
-rw-r--r--sources/pyside2/doc/tutorials/basictutorial/widgetstyling-no.pngbin0 -> 26444 bytes
-rw-r--r--sources/pyside2/doc/tutorials/basictutorial/widgetstyling-simple-no.pngbin0 -> 3834 bytes
-rw-r--r--sources/pyside2/doc/tutorials/basictutorial/widgetstyling-simple-yes.pngbin0 -> 4743 bytes
-rw-r--r--sources/pyside2/doc/tutorials/basictutorial/widgetstyling-yes.pngbin0 -> 32311 bytes
-rw-r--r--sources/pyside2/doc/tutorials/basictutorial/widgetstyling.py95
-rw-r--r--sources/pyside2/doc/tutorials/basictutorial/widgetstyling.rst169
-rw-r--r--sources/pyside2/doc/tutorials/datavisualize/datavisualize3/main_window.py4
-rw-r--r--sources/pyside2/doc/tutorials/datavisualize/datavisualize4/main_window.py4
-rw-r--r--sources/pyside2/doc/tutorials/datavisualize/datavisualize5/main_window.py4
-rw-r--r--sources/pyside2/doc/tutorials/datavisualize/datavisualize6/main_window.py4
-rw-r--r--sources/pyside2/doc/tutorials/expenses/expenses.rst12
-rw-r--r--sources/pyside2/doc/tutorials/expenses/main.py4
-rw-r--r--sources/pyside2/doc/tutorials/expenses/main_snake_case.py209
-rw-r--r--sources/pyside2/doc/tutorials/expenses/steps/02-expenses.py3
-rw-r--r--sources/pyside2/doc/tutorials/expenses/steps/03-expenses.py3
-rw-r--r--sources/pyside2/doc/tutorials/expenses/steps/04-expenses.py3
-rw-r--r--sources/pyside2/doc/tutorials/expenses/steps/05-expenses.py3
-rw-r--r--sources/pyside2/doc/tutorials/expenses/steps/06-expenses.py3
-rw-r--r--sources/pyside2/doc/tutorials/expenses/steps/07-expenses.py3
-rw-r--r--sources/pyside2/doc/tutorials/expenses/steps/08-expenses.py3
-rw-r--r--sources/pyside2/doc/tutorials/expenses/steps/09-expenses.py4
-rw-r--r--sources/pyside2/doc/tutorials/expenses/steps/10-expenses.py4
-rw-r--r--sources/pyside2/doc/tutorials/index.rst1
-rw-r--r--sources/pyside2/doc/tutorials/portingguide/chapter3/bookwindow.py3
-rw-r--r--sources/pyside2/libpyside/CMakeLists.txt4
-rw-r--r--sources/pyside2/libpyside/dynamicqmetaobject.cpp66
-rw-r--r--sources/pyside2/libpyside/dynamicqmetaobject.h5
-rw-r--r--sources/pyside2/libpyside/feature_select.cpp496
-rw-r--r--sources/pyside2/libpyside/feature_select.h55
-rw-r--r--sources/pyside2/libpyside/pyside.cpp6
-rw-r--r--sources/pyside2/libpyside/pyside.h11
-rw-r--r--sources/pyside2/libpyside/pysideproperty.cpp5
-rw-r--r--sources/pyside2/libpyside/pysideqenum.cpp258
-rw-r--r--sources/pyside2/libpyside/pysideqenum.h57
-rw-r--r--sources/pyside2/libpyside/pysideqflags.cpp14
-rw-r--r--sources/pyside2/libpyside/pysidesignal.cpp19
-rw-r--r--sources/pyside2/libpyside/signalmanager.cpp2
-rw-r--r--sources/pyside2/plugins/CMakeLists.txt26
-rw-r--r--sources/pyside2/plugins/customwidget.cpp66
-rw-r--r--sources/pyside2/plugins/customwidget.h44
-rw-r--r--sources/pyside2/plugins/customwidgets.cpp34
-rw-r--r--sources/pyside2/plugins/customwidgets.h22
-rw-r--r--sources/pyside2/tests/QtCore/CMakeLists.txt5
-rw-r--r--sources/pyside2/tests/QtCore/bug_1313.py (renamed from sources/pyside2/tests/QtOpenGL/qglwidget_test.py)53
-rw-r--r--sources/pyside2/tests/QtCore/multiple_feature_test.py127
-rw-r--r--sources/pyside2/tests/QtCore/qbytearray_test.py8
-rw-r--r--sources/pyside2/tests/QtCore/qenum_test.py119
-rw-r--r--sources/pyside2/tests/QtCore/qobject_parent_test.py5
-rw-r--r--sources/pyside2/tests/QtCore/qregexp_test.py55
-rw-r--r--sources/pyside2/tests/QtCore/qtext_codec_test.py54
-rw-r--r--sources/pyside2/tests/QtCore/qtextstream_test.py11
-rw-r--r--sources/pyside2/tests/QtCore/qurlquery_test.py2
-rw-r--r--sources/pyside2/tests/QtCore/snake_case_feature_test.py86
-rw-r--r--sources/pyside2/tests/QtGui/CMakeLists.txt3
-rw-r--r--sources/pyside2/tests/QtGui/deepcopy_test.py7
-rw-r--r--sources/pyside2/tests/QtGui/qfontmetrics_test.py2
-rw-r--r--sources/pyside2/tests/QtGui/qmatrix_test.py106
-rw-r--r--sources/pyside2/tests/QtGui/qtextdocument_functions.py3
-rw-r--r--sources/pyside2/tests/QtGui/repr_test.py7
-rw-r--r--sources/pyside2/tests/QtNetwork/bug_446.py2
-rw-r--r--sources/pyside2/tests/QtOpenGL/CMakeLists.txt4
-rw-r--r--sources/pyside2/tests/QtOpenGL/qglbuffer_test.py78
-rw-r--r--sources/pyside2/tests/QtOpenGL/qopenglbuffer_test.py (renamed from sources/pyside2/tests/QtGui/qopenglbuffer_test.py)0
-rw-r--r--sources/pyside2/tests/QtOpenGL/qopenglwindow_test.py (renamed from sources/pyside2/tests/QtGui/qopenglwindow_test.py)4
-rw-r--r--sources/pyside2/tests/QtOpenGLWidgets/CMakeLists.txt (renamed from sources/pyside2/tests/QtWebKitWidgets/CMakeLists.txt)0
-rw-r--r--sources/pyside2/tests/QtPrintSupport/returnquadruplesofnumbers_test.py6
-rw-r--r--sources/pyside2/tests/QtQml/registersingletontype.py (renamed from sources/pyside2/tests/QtWebKit/bug_694.py)74
-rw-r--r--sources/pyside2/tests/QtQml/registersingletontype.qml36
-rw-r--r--sources/pyside2/tests/QtQml/registertype.py36
-rw-r--r--sources/pyside2/tests/QtQml/registeruncreatable.qml43
-rw-r--r--sources/pyside2/tests/QtQml/signal_arguments.py1
-rw-r--r--sources/pyside2/tests/QtQml/signal_arguments.qml4
-rw-r--r--sources/pyside2/tests/QtSvg/CMakeLists.txt1
-rw-r--r--sources/pyside2/tests/QtSvg/qsvgrenderer_test.py10
-rw-r--r--sources/pyside2/tests/QtSvgWidgets/CMakeLists.txt1
-rw-r--r--sources/pyside2/tests/QtSvgWidgets/qsvgwidget_test.py (renamed from sources/pyside2/tests/QtSvg/qsvgwidget_test.py)12
-rw-r--r--sources/pyside2/tests/QtUiTools/bug_392.py17
-rw-r--r--sources/pyside2/tests/QtUiTools/bug_426.py11
-rw-r--r--sources/pyside2/tests/QtWebKit/CMakeLists.txt11
-rw-r--r--sources/pyside2/tests/QtWebKit/bug_448.py52
-rw-r--r--sources/pyside2/tests/QtWebKit/bug_803.py53
-rw-r--r--sources/pyside2/tests/QtWebKit/bug_899.py71
-rw-r--r--sources/pyside2/tests/QtWebKit/bug_959.py133
-rw-r--r--sources/pyside2/tests/QtWebKit/fox.html7
-rw-r--r--sources/pyside2/tests/QtWebKit/qml_plugin_test.py92
-rw-r--r--sources/pyside2/tests/QtWebKit/qmlplugin/dummy.pys1
-rw-r--r--sources/pyside2/tests/QtWebKit/qmlplugin/index.html5
-rw-r--r--sources/pyside2/tests/QtWebKit/qvariantlist_property_test.py78
-rw-r--r--sources/pyside2/tests/QtWebKit/shouldInterruptjavascript_test.py63
-rw-r--r--sources/pyside2/tests/QtWebKit/webframe_test.py67
-rw-r--r--sources/pyside2/tests/QtWebKit/webpage_test.py95
-rw-r--r--sources/pyside2/tests/QtWebKit/webview_test.py101
-rw-r--r--sources/pyside2/tests/QtWidgets/CMakeLists.txt2
-rw-r--r--sources/pyside2/tests/QtWidgets/add_action_test.py3
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_363.py59
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_632.py54
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_711.py3
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_860.py2
-rw-r--r--sources/pyside2/tests/QtWidgets/qaction_test.py3
-rw-r--r--sources/pyside2/tests/QtWidgets/qshortcut_test.py22
-rw-r--r--sources/pyside2/tests/QtWidgets/qstring_qkeysequence_test.py4
-rw-r--r--sources/pyside2/tests/QtWidgets/qtoolbar_test.py3
-rw-r--r--sources/pyside2/tests/QtXml/qdomdocument_test.py2
-rw-r--r--sources/pyside2/tests/pysidetest/CMakeLists.txt17
-rw-r--r--sources/pyside2/tests/pysidetest/new_inherited_functions_test.py6
-rwxr-xr-xsources/pyside2/tests/tools/list-class-hierarchy.py1
-rw-r--r--sources/pyside2/tests/util/module_wrapper/PySide/QtWebKit.py2
-rw-r--r--sources/shiboken2/ApiExtractor/CMakeLists.txt1
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp178
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetabuilder.h4
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetabuilder_p.h8
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetalang.cpp59
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetalang.h19
-rw-r--r--sources/shiboken2/ApiExtractor/apiextractor.cpp23
-rw-r--r--sources/shiboken2/ApiExtractor/apiextractor.h7
-rw-r--r--sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp183
-rw-r--r--sources/shiboken2/ApiExtractor/clangparser/clangdebugutils.cpp12
-rw-r--r--sources/shiboken2/ApiExtractor/clangparser/clangdebugutils.h3
-rw-r--r--sources/shiboken2/ApiExtractor/clangparser/clangparser.cpp90
-rw-r--r--sources/shiboken2/ApiExtractor/clangparser/clangparser.h15
-rw-r--r--sources/shiboken2/ApiExtractor/clangparser/clangutils.cpp18
-rw-r--r--sources/shiboken2/ApiExtractor/clangparser/clangutils.h12
-rw-r--r--sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp3
-rw-r--r--sources/shiboken2/ApiExtractor/fileout.cpp6
-rw-r--r--sources/shiboken2/ApiExtractor/messages.cpp98
-rw-r--r--sources/shiboken2/ApiExtractor/messages.h30
-rw-r--r--sources/shiboken2/ApiExtractor/parser/codemodel.cpp61
-rw-r--r--sources/shiboken2/ApiExtractor/parser/codemodel.h10
-rw-r--r--sources/shiboken2/ApiExtractor/reporthandler.cpp18
-rw-r--r--sources/shiboken2/ApiExtractor/sourcelocation.cpp100
-rw-r--r--sources/shiboken2/ApiExtractor/sourcelocation.h67
-rw-r--r--sources/shiboken2/ApiExtractor/tests/testabstractmetaclass.cpp30
-rw-r--r--sources/shiboken2/ApiExtractor/tests/testabstractmetaclass.h1
-rw-r--r--sources/shiboken2/ApiExtractor/tests/testaddfunction.cpp2
-rw-r--r--sources/shiboken2/ApiExtractor/tests/testdroptypeentries.cpp10
-rw-r--r--sources/shiboken2/ApiExtractor/tests/testmodifyfunction.cpp6
-rw-r--r--sources/shiboken2/ApiExtractor/tests/testnestedtypes.cpp4
-rw-r--r--sources/shiboken2/ApiExtractor/tests/testreverseoperators.cpp18
-rw-r--r--sources/shiboken2/ApiExtractor/typedatabase.cpp20
-rw-r--r--sources/shiboken2/ApiExtractor/typedatabase.h3
-rw-r--r--sources/shiboken2/ApiExtractor/typesystem.cpp94
-rw-r--r--sources/shiboken2/ApiExtractor/typesystem.h15
-rw-r--r--sources/shiboken2/ApiExtractor/typesystem_enums.h19
-rw-r--r--sources/shiboken2/ApiExtractor/typesystemparser.cpp115
-rw-r--r--sources/shiboken2/ApiExtractor/typesystemparser.h4
-rw-r--r--sources/shiboken2/CMakeLists.txt16
-rw-r--r--sources/shiboken2/data/shiboken_helpers.cmake6
-rw-r--r--sources/shiboken2/doc/CMakeLists.txt42
-rw-r--r--sources/shiboken2/doc/_themes/pysidedocs_qthelp/domainindex.html57
-rw-r--r--sources/shiboken2/doc/_themes/pysidedocs_qthelp/static/fakebar.pngbin0 -> 101 bytes
-rw-r--r--sources/shiboken2/doc/_themes/pysidedocs_qthelp/static/logo_python.jpgbin0 -> 2660 bytes
-rw-r--r--sources/shiboken2/doc/_themes/pysidedocs_qthelp/static/logo_qt.pngbin0 -> 1936 bytes
-rw-r--r--sources/shiboken2/doc/_themes/pysidedocs_qthelp/static/minus.pngbin0 -> 199 bytes
-rw-r--r--sources/shiboken2/doc/_themes/pysidedocs_qthelp/static/plus.pngbin0 -> 199 bytes
-rw-r--r--sources/shiboken2/doc/_themes/pysidedocs_qthelp/static/pyside.css1943
-rw-r--r--sources/shiboken2/doc/_themes/pysidedocs_qthelp/static/pysidelogo.pngbin0 -> 4936 bytes
-rw-r--r--sources/shiboken2/doc/_themes/pysidedocs_qthelp/static/relbar_bg.pngbin0 -> 130 bytes
-rw-r--r--sources/shiboken2/doc/_themes/pysidedocs_qthelp/theme.conf7
-rw-r--r--sources/shiboken2/doc/conf.py.in8
-rw-r--r--sources/shiboken2/doc/index.rst10
-rw-r--r--sources/shiboken2/doc/shibokengenerator.rst6
-rw-r--r--sources/shiboken2/doc/typesystem_codeinjection.rst133
-rw-r--r--sources/shiboken2/generator/generator.cpp37
-rw-r--r--sources/shiboken2/generator/main.cpp237
-rw-r--r--sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp6
-rw-r--r--sources/shiboken2/generator/shiboken2/cppgenerator.cpp397
-rw-r--r--sources/shiboken2/generator/shiboken2/cppgenerator.h8
-rw-r--r--sources/shiboken2/generator/shiboken2/shibokengenerator.cpp14
-rw-r--r--sources/shiboken2/generator/shiboken2/shibokengenerator.h2
-rw-r--r--sources/shiboken2/libshiboken/CMakeLists.txt2
-rw-r--r--sources/shiboken2/libshiboken/basewrapper.cpp97
-rw-r--r--sources/shiboken2/libshiboken/basewrapper.h8
-rw-r--r--sources/shiboken2/libshiboken/bindingmanager.cpp25
-rw-r--r--sources/shiboken2/libshiboken/bindingmanager.h2
-rw-r--r--sources/shiboken2/libshiboken/gilstate.cpp7
-rw-r--r--sources/shiboken2/libshiboken/gilstate.h1
-rw-r--r--sources/shiboken2/libshiboken/pep384impl.cpp72
-rw-r--r--sources/shiboken2/libshiboken/pep384impl.h21
-rw-r--r--sources/shiboken2/libshiboken/sbkenum.cpp29
-rw-r--r--sources/shiboken2/libshiboken/sbkpython.h1
-rw-r--r--sources/shiboken2/libshiboken/sbkstaticstrings.cpp8
-rw-r--r--sources/shiboken2/libshiboken/sbkstaticstrings.h8
-rw-r--r--sources/shiboken2/libshiboken/sbkstring.cpp65
-rw-r--r--sources/shiboken2/libshiboken/sbkstring.h1
-rw-r--r--sources/shiboken2/libshiboken/shiboken.h1
-rw-r--r--sources/shiboken2/libshiboken/signature.cpp15
-rw-r--r--sources/shiboken2/libshiboken/signature.h1
-rw-r--r--sources/shiboken2/shibokenmodule/CMakeLists.txt2
-rw-r--r--sources/shiboken2/shibokenmodule/files.dir/shibokensupport/__feature__.py114
-rw-r--r--sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/loader.py16
-rw-r--r--sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/mapping.py11
-rw-r--r--sources/shiboken2/shibokenmodule/files.dir/shibokensupport/signature/parser.py24
-rw-r--r--sources/shiboken2/tests/CMakeLists.txt34
-rw-r--r--sources/shiboken2/tests/dumpcodemodel/main.cpp78
-rw-r--r--sources/shiboken2/tests/libsample/CMakeLists.txt1
-rw-r--r--sources/shiboken2/tests/libsample/objecttype.cpp6
-rw-r--r--sources/shiboken2/tests/libsample/objecttype.h2
-rw-r--r--sources/shiboken2/tests/libsample/objecttypeholder.cpp10
-rw-r--r--sources/shiboken2/tests/libsample/objecttypeholder.h5
-rw-r--r--sources/shiboken2/tests/libsample/oddbool.cpp48
-rw-r--r--sources/shiboken2/tests/libsample/oddbool.h27
-rw-r--r--sources/shiboken2/tests/libsample/pen.cpp4
-rw-r--r--sources/shiboken2/tests/libsample/pen.h5
-rw-r--r--sources/shiboken2/tests/libsample/virtualmethods.cpp6
-rw-r--r--sources/shiboken2/tests/libsample/virtualmethods.h2
-rw-r--r--sources/shiboken2/tests/samplebinding/CMakeLists.txt1
-rw-r--r--sources/shiboken2/tests/samplebinding/oddbool_test.py8
-rw-r--r--sources/shiboken2/tests/samplebinding/pen_test.py2
-rw-r--r--sources/shiboken2/tests/samplebinding/typesystem_sample.xml40
-rw-r--r--sources/shiboken2/tests/shiboken_paths.py22
-rw-r--r--sources/shiboken2/tests/test_generator/CMakeLists.txt12
288 files changed, 10127 insertions, 5189 deletions
diff --git a/sources/cmake_helpers/helpers.cmake b/sources/cmake_helpers/helpers.cmake
index fed96b5c..2ca9e822 100644
--- a/sources/cmake_helpers/helpers.cmake
+++ b/sources/cmake_helpers/helpers.cmake
@@ -26,11 +26,11 @@ macro(collect_optional_modules)
# Collect all optional modules.
set(ALL_OPTIONAL_MODULES
Xml
- XmlPatterns
Help Multimedia
MultimediaWidgets
OpenGL
OpenGLFunctions
+ OpenGLWidgets
Positioning
Location
Qml
@@ -39,13 +39,12 @@ set(ALL_OPTIONAL_MODULES
QuickWidgets
RemoteObjects
Scxml
- Script
- ScriptTools
Sensors
SerialPort
TextToSpeech
Charts
Svg
+ SvgWidgets
DataVisualization)
find_package(Qt${QT_MAJOR_VERSION}UiTools)
if(Qt${QT_MAJOR_VERSION}UiTools_FOUND)
@@ -56,9 +55,6 @@ endif()
if(WIN32)
list(APPEND ALL_OPTIONAL_MODULES AxContainer)
endif()
-# 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 WebEngine WebEngineWidgets WebSockets)
if (Qt${QT_MAJOR_VERSION}Core_VERSION VERSION_GREATER 5.9.3) # Depending on fixes in Qt3D
list(APPEND ALL_OPTIONAL_MODULES 3DCore 3DRender 3DInput 3DLogic 3DAnimation 3DExtras)
@@ -173,14 +169,13 @@ macro(COLLECT_MODULE_IF_FOUND shortname)
# record the shortnames for the tests
list(APPEND all_module_shortnames ${shortname})
# Build Qt 5 compatibility variables
- if(${QT_MAJOR_VERSION} GREATER_EQUAL 6)
+ if(${QT_MAJOR_VERSION} GREATER_EQUAL 6 AND NOT "${shortname}" STREQUAL "OpenGLFunctions")
get_target_property(Qt6${shortname}_INCLUDE_DIRS Qt6::${shortname}
INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(Qt6${shortname}_PRIVATE_INCLUDE_DIRS
Qt6::${shortname}Private
INTERFACE_INCLUDE_DIRECTORIES)
- get_target_property(Qt6${shortname}_LIBRARIES Qt6::${shortname}
- INTERFACE_LINK_LIBRARIES)
+ set(Qt6${shortname}_LIBRARIES Qt::${shortname})
endif()
else()
if("${module_state}" STREQUAL "optional")
diff --git a/sources/pyside2-tools b/sources/pyside2-tools
-Subproject 1e8ec62d53f2c7ad579292b2948ebf3aaded420
+Subproject a8448837204faee0b457d1e2d4cbf574a281111
diff --git a/sources/pyside2/CMakeLists.txt b/sources/pyside2/CMakeLists.txt
index bab97f41..b695056f 100644
--- a/sources/pyside2/CMakeLists.txt
+++ b/sources/pyside2/CMakeLists.txt
@@ -6,7 +6,7 @@ cmake_policy(VERSION 3.1)
# Don't ignore targets that do not exist, inside add_dependencies calls.
cmake_policy(SET CMP0046 NEW)
-set (QT_MAJOR_VERSION 5)
+set (QT_MAJOR_VERSION 6)
project(pysidebindings)
@@ -83,8 +83,7 @@ find_package(Qt${QT_MAJOR_VERSION} 5.12 REQUIRED COMPONENTS Core)
add_definitions(${Qt${QT_MAJOR_VERSION}Core_DEFINITIONS})
find_file(GL_H "gl.h" PATH_SUFFIXES "GL")
-message("result:" "${GL_H}")
-include(FindQt5Extra)
+message(STATUS "GL Headers path:" "${GL_H}")
set(XVFB_EXEC "")
option(USE_XVFB "Uses xvfb-run with the unit tests to avoid QtGui tests popping windows on the screen." FALSE)
@@ -253,8 +252,7 @@ endif()
add_subdirectory(libpyside)
find_package(Qt${QT_MAJOR_VERSION}Designer)
-if(${QT_MAJOR_VERSION} LESS 6 AND Qt${QT_MAJOR_VERSION}UiTools_FOUND
- AND Qt${QT_MAJOR_VERSION}Designer_FOUND)
+if(Qt${QT_MAJOR_VERSION}UiTools_FOUND AND Qt${QT_MAJOR_VERSION}Designer_FOUND)
add_subdirectory(plugins)
endif()
diff --git a/sources/pyside2/PySide2/CMakeLists.txt b/sources/pyside2/PySide2/CMakeLists.txt
index 120bc8e5..0ded09f5 100644
--- a/sources/pyside2/PySide2/CMakeLists.txt
+++ b/sources/pyside2/PySide2/CMakeLists.txt
@@ -100,8 +100,6 @@ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/templates/opengl_common.xml
DESTINATION share/PySide2${pyside_SUFFIX}/typesystems)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/templates/openglfunctions_common.xml
DESTINATION share/PySide2${pyside_SUFFIX}/typesystems)
-install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/templates/webkitwidgets_common.xml
- DESTINATION share/PySide2${pyside_SUFFIX}/typesystems)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/templates/xml_common.xml
DESTINATION share/PySide2${pyside_SUFFIX}/typesystems)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/pyside2_global.h
diff --git a/sources/pyside2/PySide2/QtCore/CMakeLists.txt b/sources/pyside2/PySide2/QtCore/CMakeLists.txt
index e0e22062..3820d439 100644
--- a/sources/pyside2/PySide2/QtCore/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtCore/CMakeLists.txt
@@ -26,22 +26,26 @@ ${QtCore_GEN_DIR}/qbasicmutex_wrapper.cpp
${QtCore_GEN_DIR}/qbasictimer_wrapper.cpp
${QtCore_GEN_DIR}/qbitarray_wrapper.cpp
${QtCore_GEN_DIR}/qbuffer_wrapper.cpp
+${QtCore_GEN_DIR}/qbytearray_frombase64result_wrapper.cpp
${QtCore_GEN_DIR}/qbytearray_wrapper.cpp
${QtCore_GEN_DIR}/qbytearraymatcher_wrapper.cpp
-${QtCore_GEN_DIR}/qchildevent_wrapper.cpp
+${QtCore_GEN_DIR}/qcalendar_wrapper.cpp
+${QtCore_GEN_DIR}/qcalendar_yearmonthday_wrapper.cpp
${QtCore_GEN_DIR}/qcborarray_wrapper.cpp
${QtCore_GEN_DIR}/qcborerror_wrapper.cpp
${QtCore_GEN_DIR}/qcbormap_wrapper.cpp
${QtCore_GEN_DIR}/qcborparsererror_wrapper.cpp
${QtCore_GEN_DIR}/qcborstreamreader_wrapper.cpp
-${QtCore_GEN_DIR}/qcborstringresultstring_wrapper.cpp
-${QtCore_GEN_DIR}/qcborstringresultbytearray_wrapper.cpp
${QtCore_GEN_DIR}/qcborstreamwriter_wrapper.cpp
+${QtCore_GEN_DIR}/qcborstringresultbytearray_wrapper.cpp
+${QtCore_GEN_DIR}/qcborstringresultstring_wrapper.cpp
${QtCore_GEN_DIR}/qcborvalue_wrapper.cpp
+${QtCore_GEN_DIR}/qchildevent_wrapper.cpp
${QtCore_GEN_DIR}/qcollator_wrapper.cpp
${QtCore_GEN_DIR}/qcollatorsortkey_wrapper.cpp
${QtCore_GEN_DIR}/qcommandlineoption_wrapper.cpp
${QtCore_GEN_DIR}/qcommandlineparser_wrapper.cpp
+${QtCore_GEN_DIR}/qconcatenatetablesproxymodel_wrapper.cpp
${QtCore_GEN_DIR}/qcoreapplication_wrapper.cpp
${QtCore_GEN_DIR}/qcryptographichash_wrapper.cpp
${QtCore_GEN_DIR}/qdatastream_wrapper.cpp
@@ -58,9 +62,9 @@ ${QtCore_GEN_DIR}/qeventloop_wrapper.cpp
${QtCore_GEN_DIR}/qeventtransition_wrapper.cpp
${QtCore_GEN_DIR}/qfactoryinterface_wrapper.cpp
${QtCore_GEN_DIR}/qfile_wrapper.cpp
-${QtCore_GEN_DIR}/qfileselector_wrapper.cpp
${QtCore_GEN_DIR}/qfiledevice_wrapper.cpp
${QtCore_GEN_DIR}/qfileinfo_wrapper.cpp
+${QtCore_GEN_DIR}/qfileselector_wrapper.cpp
${QtCore_GEN_DIR}/qfilesystemwatcher_wrapper.cpp
${QtCore_GEN_DIR}/qfinalstate_wrapper.cpp
${QtCore_GEN_DIR}/qgenericargument_wrapper.cpp
@@ -68,13 +72,13 @@ ${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}/qitemselection_wrapper.cpp
+${QtCore_GEN_DIR}/qitemselectionmodel_wrapper.cpp
+${QtCore_GEN_DIR}/qitemselectionrange_wrapper.cpp
${QtCore_GEN_DIR}/qjsonarray_wrapper.cpp
${QtCore_GEN_DIR}/qjsondocument_wrapper.cpp
${QtCore_GEN_DIR}/qjsonparseerror_wrapper.cpp
${QtCore_GEN_DIR}/qjsonvalue_wrapper.cpp
-${QtCore_GEN_DIR}/qitemselection_wrapper.cpp
-${QtCore_GEN_DIR}/qitemselectionmodel_wrapper.cpp
-${QtCore_GEN_DIR}/qitemselectionrange_wrapper.cpp
${QtCore_GEN_DIR}/qlibraryinfo_wrapper.cpp
${QtCore_GEN_DIR}/qline_wrapper.cpp
${QtCore_GEN_DIR}/qlinef_wrapper.cpp
@@ -107,13 +111,13 @@ ${QtCore_GEN_DIR}/qpointf_wrapper.cpp
${QtCore_GEN_DIR}/qprocess_wrapper.cpp
${QtCore_GEN_DIR}/qprocessenvironment_wrapper.cpp
${QtCore_GEN_DIR}/qpropertyanimation_wrapper.cpp
-${QtCore_GEN_DIR}/qrandomgenerator_wrapper.cpp
${QtCore_GEN_DIR}/qrandomgenerator64_wrapper.cpp
+${QtCore_GEN_DIR}/qrandomgenerator_wrapper.cpp
${QtCore_GEN_DIR}/qreadlocker_wrapper.cpp
${QtCore_GEN_DIR}/qreadwritelock_wrapper.cpp
${QtCore_GEN_DIR}/qrect_wrapper.cpp
${QtCore_GEN_DIR}/qrectf_wrapper.cpp
-${QtCore_GEN_DIR}/qregexp_wrapper.cpp
+${QtCore_GEN_DIR}/qrecursivemutex_wrapper.cpp
${QtCore_GEN_DIR}/qregularexpression_wrapper.cpp
${QtCore_GEN_DIR}/qregularexpressionmatch_wrapper.cpp
${QtCore_GEN_DIR}/qregularexpressionmatchiterator_wrapper.cpp
@@ -129,10 +133,11 @@ ${QtCore_GEN_DIR}/qsignalmapper_wrapper.cpp
${QtCore_GEN_DIR}/qsignaltransition_wrapper.cpp
${QtCore_GEN_DIR}/qsize_wrapper.cpp
${QtCore_GEN_DIR}/qsizef_wrapper.cpp
+${QtCore_GEN_DIR}/qsocketdescriptor_wrapper.cpp
${QtCore_GEN_DIR}/qsocketnotifier_wrapper.cpp
${QtCore_GEN_DIR}/qsortfilterproxymodel_wrapper.cpp
-${QtCore_GEN_DIR}/qstate_wrapper.cpp
${QtCore_GEN_DIR}/qstandardpaths_wrapper.cpp
+${QtCore_GEN_DIR}/qstate_wrapper.cpp
${QtCore_GEN_DIR}/qstatemachine_signalevent_wrapper.cpp
${QtCore_GEN_DIR}/qstatemachine_wrappedevent_wrapper.cpp
${QtCore_GEN_DIR}/qstatemachine_wrapper.cpp
@@ -144,10 +149,6 @@ ${QtCore_GEN_DIR}/qt_wrapper.cpp
${QtCore_GEN_DIR}/qtemporarydir_wrapper.cpp
${QtCore_GEN_DIR}/qtemporaryfile_wrapper.cpp
${QtCore_GEN_DIR}/qtextboundaryfinder_wrapper.cpp
-${QtCore_GEN_DIR}/qtextcodec_converterstate_wrapper.cpp
-${QtCore_GEN_DIR}/qtextcodec_wrapper.cpp
-${QtCore_GEN_DIR}/qtextdecoder_wrapper.cpp
-${QtCore_GEN_DIR}/qtextencoder_wrapper.cpp
${QtCore_GEN_DIR}/qtextstream_wrapper.cpp
${QtCore_GEN_DIR}/qtextstreammanipulator_wrapper.cpp
${QtCore_GEN_DIR}/qthread_wrapper.cpp
@@ -156,9 +157,10 @@ ${QtCore_GEN_DIR}/qtime_wrapper.cpp
${QtCore_GEN_DIR}/qtimeline_wrapper.cpp
${QtCore_GEN_DIR}/qtimer_wrapper.cpp
${QtCore_GEN_DIR}/qtimerevent_wrapper.cpp
-${QtCore_GEN_DIR}/qtimezone_wrapper.cpp
${QtCore_GEN_DIR}/qtimezone_offsetdata_wrapper.cpp
+${QtCore_GEN_DIR}/qtimezone_wrapper.cpp
${QtCore_GEN_DIR}/qtranslator_wrapper.cpp
+${QtCore_GEN_DIR}/qtransposeproxymodel_wrapper.cpp
${QtCore_GEN_DIR}/qurl_wrapper.cpp
${QtCore_GEN_DIR}/qurlquery_wrapper.cpp
${QtCore_GEN_DIR}/quuid_wrapper.cpp
@@ -175,27 +177,11 @@ ${QtCore_GEN_DIR}/qxmlstreamnotationdeclaration_wrapper.cpp
${QtCore_GEN_DIR}/qxmlstreamreader_wrapper.cpp
${QtCore_GEN_DIR}/qxmlstreamwriter_wrapper.cpp
-
${SPECIFIC_OS_FILES}
# module is always needed
${QtCore_GEN_DIR}/qtcore_module_wrapper.cpp
)
-if (Qt${QT_MAJOR_VERSION}Core_VERSION VERSION_EQUAL 5.13.0
- OR Qt${QT_MAJOR_VERSION}Core_VERSION VERSION_GREATER 5.13.0)
- list(APPEND QtCore_SRC
- ${QtCore_GEN_DIR}/qconcatenatetablesproxymodel_wrapper.cpp
- ${QtCore_GEN_DIR}/qtransposeproxymodel_wrapper.cpp)
-endif()
-
-if (Qt${QT_MAJOR_VERSION}Core_VERSION VERSION_EQUAL 5.14.0
- OR Qt${QT_MAJOR_VERSION}Core_VERSION VERSION_GREATER 5.14.0)
- list(APPEND QtCore_SRC
- ${QtCore_GEN_DIR}/qcalendar_wrapper.cpp
- ${QtCore_GEN_DIR}/qcalendar_yearmonthday_wrapper.cpp
- ${QtCore_GEN_DIR}/qrecursivemutex_wrapper.cpp)
-endif()
-
set(QtCore_glue_sources
"${QtCore_SOURCE_DIR}/glue/qeasingcurve_glue.cpp"
"${QtCore_SOURCE_DIR}/glue/qeasingcurve_glue.h"
diff --git a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
index c27029f0..98267450 100644
--- a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
+++ b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
@@ -104,6 +104,16 @@
<rejection class="QMetaObject" function-name="changeGuard"/>
<rejection class="QMetaObject" function-name="removeGuard"/>
+ <rejection class="QAlgorithmsPrivate"/>
+ <rejection class="QJsonPrivate"/>
+ <rejection class="QTextStreamFunctions"/>
+ <rejection class="QtGlobalStatic"/>
+ <rejection class="QtMetaTypePrivate"/>
+ <rejection class="QtPrivate"/>
+ <rejection class="QtSharedPointer"/>
+ <rejection class="QtStringBuilder"/>
+ <rejection class="std"/>
+
<rejection class="QByteArray" field-name="MaxSize"/>
<rejection class="QChildEvent" field-name="c"/>
<rejection class="QTimerEvent" field-name="id"/>
@@ -160,7 +170,6 @@
<enum-type name="QtMsgType"/>
-
<enum-type name="QCborSimpleType" since="5.12"/>
<enum-type name="QCborKnownTags" since="5.12"/>
@@ -179,6 +188,8 @@
<primitive-type name="long long"/>
<primitive-type name="qlonglong" target-lang-api-name="PyLong"/>
<primitive-type name="qulonglong" target-lang-api-name="PyLong"/>
+ <primitive-type name="qsizetype" target-lang-api-name="PyLong"/>
+ <primitive-type name="size_t" target-lang-api-name="PyLong"/>
<primitive-type name="short"/>
<primitive-type name="signed short"/>
<primitive-type name="signed short int"/>
@@ -344,7 +355,7 @@
<include file-name="qcborstream.h" location="global"/>
<value-type name="StringResult" generate="no"/>
<!-- 64bit (qsizetype = long long) -->
- <modify-function signature="readStringChunk(char*,long long)" remove="all"/>
+ <modify-function signature="readStringChunk(char*,qsizetype)" remove="all"/>
<!-- 32bit (qsizetype = int) -->
<modify-function signature="readStringChunk(char*,int)" remove="all"/>
</object-type>
@@ -395,6 +406,7 @@
</conversion-rule>
</container-type>
+ <!-- FIXME: Which one is it going to be? -->
<container-type name="QList" type="list">
<include file-name="QList" location="global"/>
<conversion-rule>
@@ -409,21 +421,6 @@
</conversion-rule>
</container-type>
- <container-type name="QVector" type="vector">
- <include file-name="QVector" location="global"/>
- <conversion-rule>
- <native-to-target>
- <insert-template name="cppvector_to_pylist_conversion"/>
- </native-to-target>
- <target-to-native>
- <add-conversion type="PySequence">
- <insert-template name="pyseq_to_cppvector_conversion"/>
- </add-conversion>
- </target-to-native>
- </conversion-rule>
-
- </container-type>
-
<container-type name="QStack" type="stack">
<include file-name="QStack" location="global"/>
<conversion-rule>
@@ -452,20 +449,6 @@
</conversion-rule>
</container-type>
- <container-type name="QLinkedList" type="linked-list">
- <include file-name="QLinkedList" location="global"/>
- <conversion-rule>
- <native-to-target>
- <insert-template name="cpplist_to_pylist_conversion"/>
- </native-to-target>
- <target-to-native>
- <add-conversion type="PySequence">
- <insert-template name="pyseq_to_cpplist_conversion"/>
- </add-conversion>
- </target-to-native>
- </conversion-rule>
- </container-type>
-
<container-type name="QHash" type="hash">
<include file-name="QHash" location="global"/>
<!-- Include to make enum flags work. -->
@@ -624,6 +607,7 @@
<enum-type name="PenCapStyle"/>
<enum-type name="PenJoinStyle"/>
<enum-type name="PenStyle"/>
+ <enum-type name="ReturnByValueConstant" since="6.0"/>
<enum-type name="ScreenOrientation" flags="ScreenOrientations" since="5.0"/>
<enum-type name="ScrollBarPolicy"/>
<enum-type name="ScrollPhase" since="5.2"/>
@@ -656,6 +640,13 @@
</namespace-type>
+ <add-function signature="QEnum(PyObject*)" return-type="PyObject*">
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qt-qenum"/>
+ </add-function>
+ <add-function signature="QFlag(PyObject*)" return-type="PyObject*">
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qt-qflag"/>
+ </add-function>
+
<add-function signature="qAbs(double)" return-type="double">
<inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qt-qabs"/>
</add-function>
@@ -810,7 +801,6 @@
<extra-includes>
<include file-name="datetime.h" location="global"/>
</extra-includes>
- <enum-type name="MonthNameType"/>
<add-function signature="__repr__" return-type="PyObject">
<inject-code class="target" position="beginning">
<insert-template name="repr_code">
@@ -831,7 +821,7 @@
<add-function signature="toPython()" return-type="PyObject">
<inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qdate-topython"/>
</add-function>
- <modify-function signature="getDate(int*,int*,int*)" >
+ <modify-function signature="getDate(int*,int*,int*)const" >
<modify-argument index="1">
<remove-argument/>
</modify-argument>
@@ -1293,8 +1283,6 @@
<rename to="format"/>
</modify-argument>
</modify-function>
- <!-- Qt5: ignore the new QStringRef versions, int arg is gone -->
- <modify-function signature="toUInt(QStringRef,bool*)const" remove="all"/>
<modify-function signature="toUInt(QString,bool*)const">
<modify-argument index="2">
<remove-argument />
@@ -1307,8 +1295,6 @@
<insert-template name="fix_args,bool*"/>
</inject-code>
</modify-function>
- <!-- Qt5: ignore the new QStringRef versions, int arg is gone -->
- <modify-function signature="toULongLong(QStringRef,bool*)const" remove="all"/>
<modify-function signature="toULongLong(QString,bool*)const">
<modify-argument index="2">
<remove-argument />
@@ -1321,8 +1307,6 @@
<insert-template name="fix_args,bool*"/>
</inject-code>
</modify-function>
- <!-- Qt5: ignore the new QStringRef versions -->
- <modify-function signature="toDouble(QStringRef,bool*)const" remove="all"/>
<modify-function signature="toDouble(QString,bool*)const">
<modify-argument index="2">
<remove-argument />
@@ -1335,8 +1319,6 @@
<insert-template name="fix_args,bool*"/>
</inject-code>
</modify-function>
- <!-- Qt5: ignore the new QStringRef versions -->
- <modify-function signature="toFloat(QStringRef,bool*)const" remove="all"/>
<modify-function signature="toFloat(QString,bool*)const">
<modify-argument index="2">
<remove-argument />
@@ -1349,8 +1331,6 @@
<insert-template name="fix_args,bool*"/>
</inject-code>
</modify-function>
- <!-- Qt5: ignore the new QStringRef versions, int arg is gone -->
- <modify-function signature="toInt(QStringRef,bool*)const" remove="all"/>
<modify-function signature="toInt(QString,bool*)const">
<modify-argument index="2">
<remove-argument />
@@ -1362,8 +1342,6 @@
<insert-template name="fix_args,bool*"/>
</inject-code>
</modify-function>
- <!-- Qt5: ignore the new QStringRef versions, int arg is gone -->
- <modify-function signature="toLongLong(QStringRef,bool*)const" remove="all"/>
<modify-function signature="toLongLong(QString,bool*)const">
<modify-argument index="2">
<remove-argument />
@@ -1375,8 +1353,6 @@
<insert-template name="fix_args,bool*"/>
</inject-code>
</modify-function>
- <!-- Qt5: ignore the new QStringRef versions, int arg is gone -->
- <modify-function signature="toShort(QStringRef,bool*)const" remove="all"/>
<modify-function signature="toShort(QString,bool*)const">
<modify-argument index="2">
<remove-argument />
@@ -1388,8 +1364,6 @@
<insert-template name="fix_args,bool*"/>
</inject-code>
</modify-function>
- <!-- Qt5: ignore the new QStringRef versions, int arg is gone -->
- <modify-function signature="toUShort(QStringRef,bool*)const" remove="all"/>
<modify-function signature="toUShort(QString,bool*)const">
<modify-argument index="2">
<remove-argument />
@@ -1460,13 +1434,20 @@
<enum-type name="IteratorFlag" flags="IteratorFlags"/>
</object-type>
<object-type name="QThread">
+ <inject-code file="../glue/qtcore.cpp" class="native" position="beginning" snippet="qthread_pthread_cleanup"/>
<enum-type name="Priority"/>
<modify-function signature="currentThreadId()" remove="all"/>
- <modify-function signature="run()" allow-thread="yes"/>
+ <modify-function signature="run()" allow-thread="yes">
+ <inject-code file="../glue/qtcore.cpp" class="native" position="beginning"
+ snippet="qthread_pthread_cleanup_install"/>
+ <inject-code file="../glue/qtcore.cpp" class="native" position="end"
+ snippet="qthread_pthread_cleanup_uninstall"/>
+ </modify-function>
<modify-function signature="exec()" rename="exec_" allow-thread="yes"/>
<modify-function signature="msleep(unsigned long)" allow-thread="yes"/>
<modify-function signature="sleep(unsigned long)" allow-thread="yes"/>
<modify-function signature="usleep(unsigned long)" allow-thread="yes"/>
+ <modify-function signature="wait(QDeadlineTimer)" allow-thread="yes"/>
<modify-function signature="wait(unsigned long)" allow-thread="yes"/>
<modify-function signature="yieldCurrentThread()" allow-thread="yes"/>
<modify-function signature="start(QThread::Priority)" allow-thread="yes">
@@ -1481,7 +1462,7 @@
<enum-type name="CheckIndexOption" flags="CheckIndexOptions" 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"/>
+ <modify-function signature="createIndex(int,int,const void*)const" remove="all"/>
<!-- This function is the same as createIndex(int, int, int)const -->
<modify-function signature="createIndex(int,int,quintptr)const">
<modify-argument index="3">
@@ -1532,6 +1513,10 @@
</object-type>
<value-type name="QItemSelection">
<include file-name="QList" location="global"/>
+ <!-- Expose operator==, != inherited from QList, which the parser does
+ not see due to the TMP expression of the return type. -->
+ <add-function signature="operator==(const QItemSelection&amp;)" return-type="bool"/>
+ <add-function signature="operator!=(const QItemSelection&amp;)" return-type="bool"/>
</value-type>
<object-type name="QItemSelectionModel">
@@ -1562,10 +1547,6 @@
<reference-count action="set"/>
</modify-argument>
</modify-function>
- <!--### Obsolete in 4.3-->
- <modify-function signature="clear()" remove="all"/>
- <modify-function signature="filterChanged()" remove="all"/>
- <!--### End of obsolete section -->
</object-type>
<object-type name="QIdentityProxyModel"/>
<object-type name="QTransposeProxyModel" since="5.13"/>
@@ -1699,7 +1680,7 @@
<inject-documentation format="target" mode="append">
Like the method *findChild*, the first parameter should be the child's type.
</inject-documentation>
- <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qobject-findchildren-1"/>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qobject-findchildren"/>
<modify-argument index="return">
<parent index="this" action="add"/>
</modify-argument>
@@ -1707,8 +1688,8 @@
<replace-default-expression with="QString()"/>
</modify-argument>
</add-function>
- <add-function signature="findChildren(PyTypeObject*,const QRegExp&amp;)" return-type="PySequence*" >
- <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qobject-findchildren-2"/>
+ <add-function signature="findChildren(PyTypeObject*,const QRegularExpression&amp;)" return-type="PySequence*" >
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qobject-findchildren"/>
<modify-argument index="return">
<parent index="this" action="add"/>
</modify-argument>
@@ -1789,64 +1770,8 @@
</inject-code>
</add-function>
</value-type>
- <value-type name="QRegExp">
- <enum-type name="CaretMode"/>
- <enum-type name="PatternSyntax"/>
- <extra-includes>
- <include file-name="QStringList" location="global"/>
- </extra-includes>
- <add-function signature="__repr__" return-type="PyObject*">
- <inject-code class="target" position="beginning">
- <insert-template name="repr_code">
- <replace from="%REPR_FORMAT" to="'%s', %i, %i"/>
- <replace from="%REPR_ARGS" to="qPrintable(%CPPSELF.pattern()), (int)%CPPSELF.caseSensitivity(), (int)%CPPSELF.patternSyntax()"/>
- </insert-template>
- </inject-code>
- </add-function>
-
- <add-function signature="__reduce__" return-type="PyObject*">
- <inject-code class="target" position="beginning">
- <insert-template name="reduce_code">
- <replace from="%REDUCE_FORMAT" to="sii"/>
- <replace from="%REDUCE_ARGS" to="qPrintable(%CPPSELF.pattern()), (int)%CPPSELF.caseSensitivity(), (int)%CPPSELF.patternSyntax()"/>
- </insert-template>
- </inject-code>
- </add-function>
- <add-function signature="replace(QString,QString)" return-type="QString">
- <modify-argument index="1">
- <rename to="sourceString"/>
- </modify-argument>
- <modify-argument index="2">
- <rename to="after"/>
- </modify-argument>
- <inject-documentation format="target" mode="append">
- Replaces every occurrence of the regular expression in *sourceString* with *after*.
- Returns a new Python string with the modified contents. For example:
-
- ::
-
- s = "Banana"
- re = QRegExp("a[mn]")
- s = re.replace(s, "ox")
- # s == "Boxoxa"
-
-
- For regular expressions containing capturing parentheses, occurrences of \1, \2, ..., in *after*
- are replaced with rx.cap(1), cap(2), ...
-
- ::
-
- t = "A &lt;i>bon mot&lt;/i>."
- re = QRegExp("&lt;i>([^&lt;]*)&lt;/i>")
- t = re.replace(t, "\\emph{\\1}")
- # t == "A \\emph{bon mot}."
-
- </inject-documentation>
- <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qregexp-replace"/>
- </add-function>
- </value-type>
-
<value-type name="QRegularExpression">
+ <enum-type name="WildcardConversionOption" flags="WildcardConversionOptions" since="6.0"/>
<enum-type name="MatchOption" flags="MatchOptions"/>
<enum-type name="MatchType"/>
<enum-type name="PatternOption" flags="PatternOptions"/>
@@ -1870,6 +1795,8 @@
</value-type>
<value-type name="QByteArray" hash-function="qHash">
<enum-type name="Base64Option" flags="Base64Options" since="5.2"/>
+ <enum-type name="Base64DecodingStatus" since="5.15"/>
+ <value-type name="FromBase64Result" since="5.15"/>
<conversion-rule>
<target-to-native>
<add-conversion type="Py_None" file="../glue/qtcore.cpp" snippet="conversion-pynone"/>
@@ -1886,56 +1813,35 @@
<!-- ### These overloads must be removed accept strings with \x00 in their contents -->
<modify-function signature="append(const char*,int)" remove="all"/>
<modify-function signature="append(const char*)" remove="all"/>
- <modify-function signature="append(QString)" remove="all"/>
- <modify-function signature="contains(const char*)const" remove="all"/>
- <modify-function signature="count(const char*)const" remove="all"/>
- <modify-function signature="endsWith(const char*)const" remove="all"/>
- <modify-function signature="indexOf(const char*,int)const" remove="all"/>
<modify-function signature="indexOf(char,int)const" remove="all"/>
- <modify-function signature="indexOf(QString,int)const" remove="all"/>
<modify-function signature="insert(int,const char*)" remove="all"/>
<modify-function signature="insert(int,char)" remove="all"/>
<modify-function signature="insert(int,const char*,int)" since="4.6" remove="all"/>
- <modify-function signature="insert(int,QString)" remove="all"/>
- <modify-function signature="lastIndexOf(const char*,int)const" remove="all"/>
- <modify-function signature="lastIndexOf(QString,int)const" remove="all"/>
<modify-function signature="lastIndexOf(char,int)const" remove="all"/>
<modify-function signature="prepend(const char*)" remove="all"/>
<modify-function signature="prepend(const char*,int)" since="4.6" remove="all"/>
<modify-function signature="replace(QByteArray,const char*)" remove="all"/>
<modify-function signature="replace(const char*,int,const char*,int)" remove="all"/>
- <modify-function signature="replace(QString,const char*)" remove="all"/>
<modify-function signature="replace(const char*,QByteArray)" remove="all"/>
<modify-function signature="replace(const char*,const char*)" remove="all"/>
<modify-function signature="replace(int,int,const char*)" remove="all"/>
<modify-function signature="replace(int,int,const char*,int)" since="4.6" remove="all"/>
<modify-function signature="replace(char,const char*)" remove="all"/>
- <modify-function signature="replace(char,QString)" remove="all"/>
- <modify-function signature="startsWith(const char*)const" remove="all"/>
- <modify-function signature="operator==(QString)const" remove="all"/>
<modify-function signature="operator==(const char*,QByteArray)" remove="all"/>
<modify-function signature="operator==(QByteArray,const char*)" remove="all"/>
- <modify-function signature="operator>(QString)const" remove="all"/>
<modify-function signature="operator>(const char*,QByteArray)" remove="all"/>
<modify-function signature="operator>(QByteArray,const char*)" remove="all"/>
- <modify-function signature="operator>=(QString)const" remove="all"/>
<modify-function signature="operator>=(const char*,QByteArray)" remove="all"/>
<modify-function signature="operator>=(QByteArray,const char*)" remove="all"/>
- <modify-function signature="operator&lt;(QString)const" remove="all"/>
<modify-function signature="operator&lt;(const char*,QByteArray)" remove="all"/>
- <modify-function signature="operator&lt;=(QString)const" remove="all"/>
<modify-function signature="operator&lt;=(const char*,QByteArray)" remove="all"/>
<modify-function signature="operator&lt;=(QByteArray,const char*)" remove="all"/>
- <modify-function signature="operator!=(QString)const" remove="all"/>
<modify-function signature="operator!=(const char*,QByteArray)" remove="all"/>
<modify-function signature="operator!=(QByteArray,const char*)" remove="all"/>
- <modify-function signature="operator+=(QString)" remove="all"/>
<modify-function signature="operator+=(const char*)" remove="all"/>
<modify-function signature="operator+(QByteArray,const char*)" remove="all"/>
<modify-function signature="operator+(const char*,QByteArray)" remove="all"/>
<modify-function signature="operator+(QByteArray,const char*)" remove="all"/>
- <modify-function signature="operator+(QString,QByteArray)" remove="all"/>
- <modify-function signature="operator+(QByteArray,QString)" remove="all"/>
<add-function signature="operator+(PyBytes,QByteArray)">
<inject-code file="../glue/qtcore.cpp" snippet="qbytearray-operatorplus-1"/>
</add-function>
@@ -2021,13 +1927,19 @@
<modify-function signature="operator>(const char*,QByteArray)" remove="all"/>
<modify-function signature="operator>=(const char*,QByteArray)" remove="all"/>
<modify-function signature="operator[](int)const" remove="all"/>
- <modify-function signature="operator[](uint)const" remove="all"/>
- <!-- Those types have the same representation in Python, an overload would be useless. -->
+ <!-- Those types have the same representation in Python, an overload
+ would be useless and cause overflow errors. -->
<modify-function signature="setNum(uint,int)" remove="all"/>
<modify-function signature="setNum(ushort,int)" remove="all"/>
<modify-function signature="setNum(float,char,int)" remove="all"/>
<modify-function signature="setNum(short,int)" remove="all"/>
+ <modify-function signature="setNum(long,int)" remove="all"/>
+ <modify-function signature="setNum(ulong,int)" remove="all"/>
<modify-function signature="setNum(qulonglong,int)" remove="all"/>
+ <modify-function signature="number(uint,int)" remove="all"/>
+ <modify-function signature="number(long,int)" remove="all"/>
+ <modify-function signature="number(ulong,int)" remove="all"/>
+ <modify-function signature="number(qulonglong,int)" remove="all"/>
<!--### -->
@@ -2164,7 +2076,7 @@
<!-- Qt5: had to move QAbstractEventDispatcher into os-specific files because of Windows -->
<object-type name="QAbstractNativeEventFilter">
<!-- see QWidget::nativeEvent(), QWindow::nativeEvent() -->
- <modify-function signature="nativeEventFilter(const QByteArray&amp;,void*,long*)">
+ <modify-function signature="nativeEventFilter(const QByteArray&amp;,void*,qintptr*)">
<modify-argument index="3">
<remove-argument/>
<conversion-rule class="native">
@@ -2278,7 +2190,7 @@
</object-type>
<object-type name="QCryptographicHash">
<enum-type name="Algorithm"/>
- <modify-function signature="addData(const char*,int)">
+ <modify-function signature="addData(const char*,qsizetype)">
<modify-argument index="2">
<remove-argument />
</modify-argument>
@@ -2290,6 +2202,9 @@
</value-type>
<object-type name="QLibraryInfo">
<enum-type name="LibraryLocation"/>
+ <modify-function signature="build()">
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="qlibraryinfo_build"/>
+ </modify-function>
</object-type>
<object-type name="QMutexLocker" copyable="no">
<!-- PYSIDE-1271: Creating locking capable objects inside sections that
@@ -2342,6 +2257,9 @@
</object-type>
<object-type name="QSemaphoreReleaser" since="5.10"/>
+ <value-type name="QSocketDescriptor" since="5.15">
+ <inject-code class="native" position="beginning" file="../glue/qtcore.cpp" snippet="qsocketdescriptor"/>
+ </value-type>
<object-type name="QSocketNotifier">
<enum-type name="Type"/>
<add-function signature="QSocketNotifier(PyObject*, QSocketNotifier::Type, QObject*)">
@@ -2368,38 +2286,6 @@
<include file-name="QUrl" location="global"/>
</extra-includes>
</object-type>
- <object-type name="QTextCodec">
- <enum-type name="ConversionFlag" flags="ConversionFlags"/>
-
- <object-type name="ConverterState">
- <include file-name="QTextCodec" location="global"/>
- <modify-function signature="ConverterState(QFlags&lt;QTextCodec::ConversionFlag&gt;)">
- <modify-argument index="1">
- <replace-default-expression with="QTextCodec::DefaultConversion"/>
- </modify-argument>
- </modify-function>
- </object-type>
-
- <modify-function signature="setCodecForLocale(QTextCodec*)">
- <modify-argument index="1">
- <parent index="this" action="add"/>
- </modify-argument>
- </modify-function>
- <!-- fromUnicode(QString) does the job -->
- <modify-function signature="fromUnicode(const QChar*,int,QTextCodec::ConverterState*)const" remove="all"/>
- <modify-function signature="convertFromUnicode(const QChar*,int,QTextCodec::ConverterState*)const" remove="all"/>
- <!-- this causes a warning that I cannot avoid. See suppressed warning at the end. -->
- </object-type>
- <object-type name="QTextDecoder">
- <!-- ### toUnicode(QByteArray) does the job -->
- <modify-function signature="toUnicode(const char*,int)" remove="all"/>
- <modify-function signature="toUnicode(QString*,const char*,int)" remove="all"/>
- <!-- ### -->
- </object-type>
- <object-type name="QTextEncoder">
- <!-- fromUnicode(QString) does the job -->
- <modify-function signature="fromUnicode(const QChar*,int)" remove="all"/>
- </object-type>
<object-type name="QTimeLine">
<enum-type name="CurveShape"/>
<enum-type name="Direction"/>
@@ -2417,7 +2303,9 @@
</modify-function>
</object-type>
<object-type name="QWaitCondition">
+ <modify-function signature="wait(QMutex*,QDeadlineTimer)" allow-thread="yes"/>
<modify-function signature="wait(QMutex*,unsigned long)" allow-thread="yes"/>
+ <modify-function signature="wait(QReadWriteLock*,QDeadlineTimer)" allow-thread="yes"/>
<modify-function signature="wait(QReadWriteLock*,unsigned long)" allow-thread="yes"/>
</object-type>
<object-type name="QFileSystemWatcher">
@@ -2453,7 +2341,6 @@
<modify-function signature="readAllStandardOutput()" allow-thread="yes"/>
<modify-function signature="readAllStandardError()" allow-thread="yes"/>
<modify-function signature="execute(QString,QStringList)" allow-thread="yes"/>
- <modify-function signature="execute(QString)" allow-thread="yes"/>
<modify-function signature="startDetached(QString,QStringList,QString,qint64*)">
<modify-argument index="4">
<remove-argument />
@@ -2468,10 +2355,6 @@
<add-function signature="pid()" return-type="long">
<inject-code file="../glue/qtcore.cpp" snippet="qprocess-pid"/>
</add-function>
- <!--### Obsolete in 4.3-->
- <modify-function signature="setReadChannelMode(QProcess::ProcessChannelMode)" remove="all"/>
- <modify-function signature="readChannelMode()const" remove="all"/>
- <!-- ### -->
</object-type>
<object-type name="QSignalMapper"/>
@@ -2550,12 +2433,6 @@
<!--### Obsolete in 4.3-->
<modify-function signature="setSystemIniPath(const QString&amp;)" remove="all"/>
<modify-function signature="setUserIniPath(const QString&amp;)" remove="all"/>
- <!--### Obsolete in 4.3-->
- <modify-function signature="iniCodec()const">
- <modify-argument index="return">
- <define-ownership class="target" owner="default"/>
- </modify-argument>
- </modify-function>
<!-- PYSIDE-1010:
We remove the original implementation of value() to include the optional parameter -->
<modify-function signature="value(const QString&amp;,const QVariant&amp;)const" remove="all"/>
@@ -2830,6 +2707,10 @@
<modify-function signature="toList()const" remove="all"/>
<modify-function signature="fromList(const QList&lt;QXmlStreamAttribute&gt; &amp;)" remove="all"/>
<modify-function signature="operator+=(QVector&lt;QXmlStreamAttribute&gt;)" remove="all"/>
+ <!-- Expose operator==, != inherited from QList, which the parser does
+ not see due to the TMP expression of the return type. -->
+ <add-function signature="operator==(const QXmlStreamAttributes&amp;)" return-type="bool"/>
+ <add-function signature="operator!=(const QXmlStreamAttributes&amp;)" return-type="bool"/>
</value-type>
<value-type name="QXmlStreamNamespaceDeclaration"/>
<value-type name="QXmlStreamNotationDeclaration"/>
@@ -2842,11 +2723,6 @@
<object-type name="QXmlStreamWriter">
<!-- Removed because it expect QString to be mutable -->
<modify-function signature="QXmlStreamWriter(QString*)" remove="all"/>
- <modify-function signature="codec()const">
- <modify-argument index="return">
- <define-ownership class="target" owner="default"/>
- </modify-argument>
- </modify-function>
</object-type>
<value-type name="QModelIndex" hash-function="qHash">
<modify-function signature="internalPointer()const">
diff --git a/sources/pyside2/PySide2/QtGui/CMakeLists.txt b/sources/pyside2/PySide2/QtGui/CMakeLists.txt
index e16f077c..21203834 100644
--- a/sources/pyside2/PySide2/QtGui/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtGui/CMakeLists.txt
@@ -1,17 +1,13 @@
project(QtGui)
-if (${QT_MAJOR_VERSION} GREATER_EQUAL 6)
- qt6_wrap_cpp(QPYTEXTOBJECT_MOC "${pyside2_SOURCE_DIR}/qpytextobject.h")
-else()
- qt5_wrap_cpp(QPYTEXTOBJECT_MOC "${pyside2_SOURCE_DIR}/qpytextobject.h")
-endif()
+qt_wrap_cpp(QPYTEXTOBJECT_MOC "${pyside2_SOURCE_DIR}/qpytextobject.h")
set(QtGui_DROPPED_ENTRIES)
-get_property(QtGui_enabled_features TARGET Qt${QT_MAJOR_VERSION}::Gui PROPERTY INTERFACE_QT_ENABLED_FEATURES)
+get_property(QtGui_enabled_features TARGET Qt${QT_MAJOR_VERSION}::Gui
+ PROPERTY QT_ENABLED_PUBLIC_FEATURES)
set(QtGui_SRC
-${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
@@ -30,13 +26,16 @@ ${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}/qaction_wrapper.cpp
${QtGui_GEN_DIR}/qactionevent_wrapper.cpp
+${QtGui_GEN_DIR}/qactiongroup_wrapper.cpp
${QtGui_GEN_DIR}/qbackingstore_wrapper.cpp
${QtGui_GEN_DIR}/qbitmap_wrapper.cpp
${QtGui_GEN_DIR}/qbrush_wrapper.cpp
${QtGui_GEN_DIR}/qclipboard_wrapper.cpp
${QtGui_GEN_DIR}/qcloseevent_wrapper.cpp
${QtGui_GEN_DIR}/qcolor_wrapper.cpp
+${QtGui_GEN_DIR}/qcolorspace_wrapper.cpp
${QtGui_GEN_DIR}/qconicalgradient_wrapper.cpp
${QtGui_GEN_DIR}/qcontextmenuevent_wrapper.cpp
${QtGui_GEN_DIR}/qcursor_wrapper.cpp
@@ -48,6 +47,7 @@ ${QtGui_GEN_DIR}/qdragleaveevent_wrapper.cpp
${QtGui_GEN_DIR}/qdragmoveevent_wrapper.cpp
${QtGui_GEN_DIR}/qdropevent_wrapper.cpp
${QtGui_GEN_DIR}/qenterevent_wrapper.cpp
+${QtGui_GEN_DIR}/qeventpoint_wrapper.cpp
${QtGui_GEN_DIR}/qexposeevent_wrapper.cpp
${QtGui_GEN_DIR}/qfileopenevent_wrapper.cpp
${QtGui_GEN_DIR}/qfocusevent_wrapper.cpp
@@ -69,6 +69,7 @@ ${QtGui_GEN_DIR}/qimage_wrapper.cpp
${QtGui_GEN_DIR}/qimageiohandler_wrapper.cpp
${QtGui_GEN_DIR}/qimagereader_wrapper.cpp
${QtGui_GEN_DIR}/qimagewriter_wrapper.cpp
+${QtGui_GEN_DIR}/qinputdevice_wrapper.cpp
${QtGui_GEN_DIR}/qinputevent_wrapper.cpp
${QtGui_GEN_DIR}/qinputmethod_wrapper.cpp
${QtGui_GEN_DIR}/qinputmethodevent_attribute_wrapper.cpp
@@ -78,7 +79,6 @@ ${QtGui_GEN_DIR}/qintvalidator_wrapper.cpp
${QtGui_GEN_DIR}/qkeyevent_wrapper.cpp
${QtGui_GEN_DIR}/qkeysequence_wrapper.cpp
${QtGui_GEN_DIR}/qlineargradient_wrapper.cpp
-${QtGui_GEN_DIR}/qmatrix_wrapper.cpp
${QtGui_GEN_DIR}/qmatrix2x2_wrapper.cpp
${QtGui_GEN_DIR}/qmatrix2x3_wrapper.cpp
${QtGui_GEN_DIR}/qmatrix2x4_wrapper.cpp
@@ -94,20 +94,8 @@ ${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
-${QtGui_GEN_DIR}/qopengldebugmessage_wrapper.cpp
${QtGui_GEN_DIR}/qopenglextrafunctions_wrapper.cpp
-${QtGui_GEN_DIR}/qopenglframebufferobjectformat_wrapper.cpp
${QtGui_GEN_DIR}/qopenglfunctions_wrapper.cpp
-# Compile error on Windows: ${QtGui_GEN_DIR}/qopenglpaintdevice_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}/qopenglversionprofile_wrapper.cpp
-${QtGui_GEN_DIR}/qopenglvertexarrayobject_wrapper.cpp
-${QtGui_GEN_DIR}/qopenglvertexarrayobject_binder_wrapper.cpp
-${QtGui_GEN_DIR}/qopenglwindow_wrapper.cpp
${QtGui_GEN_DIR}/qpagedpaintdevice_margins_wrapper.cpp
${QtGui_GEN_DIR}/qpagedpaintdevice_wrapper.cpp
${QtGui_GEN_DIR}/qpagelayout_wrapper.cpp
@@ -126,34 +114,33 @@ ${QtGui_GEN_DIR}/qpalette_wrapper.cpp
${QtGui_GEN_DIR}/qpdfwriter_wrapper.cpp
${QtGui_GEN_DIR}/qpen_wrapper.cpp
${QtGui_GEN_DIR}/qpicture_wrapper.cpp
-${QtGui_GEN_DIR}/qpictureio_wrapper.cpp
${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}/qpointerevent_wrapper.cpp
+${QtGui_GEN_DIR}/qpointingdevice_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
${QtGui_GEN_DIR}/qquaternion_wrapper.cpp
${QtGui_GEN_DIR}/qradialgradient_wrapper.cpp
-${QtGui_GEN_DIR}/qregexpvalidator_wrapper.cpp
+${QtGui_GEN_DIR}/qregularexpressionvalidator_wrapper.cpp
${QtGui_GEN_DIR}/qregion_wrapper.cpp
${QtGui_GEN_DIR}/qresizeevent_wrapper.cpp
${QtGui_GEN_DIR}/qsessionmanager_wrapper.cpp
${QtGui_GEN_DIR}/qshortcutevent_wrapper.cpp
${QtGui_GEN_DIR}/qshowevent_wrapper.cpp
+${QtGui_GEN_DIR}/qsinglepointevent_wrapper.cpp
${QtGui_GEN_DIR}/qstandarditem_wrapper.cpp
${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_state_wrapper.cpp
${QtGui_GEN_DIR}/qaccessibleinterface_wrapper.cpp
${QtGui_GEN_DIR}/qscreen_wrapper.cpp
-${QtGui_GEN_DIR}/qopenglshader_wrapper.cpp
-#${QtGui_GEN_DIR}/qopenglshaderprogram_wrapper.cpp
-${QtGui_GEN_DIR}/qopenglframebufferobject_wrapper.cpp
+${QtGui_GEN_DIR}/qshortcut_wrapper.cpp
${QtGui_GEN_DIR}/qrasterwindow_wrapper.cpp
${QtGui_GEN_DIR}/qrawfont_wrapper.cpp
${QtGui_GEN_DIR}/qscrollevent_wrapper.cpp
@@ -197,11 +184,12 @@ ${QtGui_GEN_DIR}/qtexttablecell_wrapper.cpp
${QtGui_GEN_DIR}/qtexttablecellformat_wrapper.cpp
${QtGui_GEN_DIR}/qtexttableformat_wrapper.cpp
${QtGui_GEN_DIR}/qtoolbarchangeevent_wrapper.cpp
-${QtGui_GEN_DIR}/qtouchdevice_wrapper.cpp
-${QtGui_GEN_DIR}/qtouchevent_touchpoint_wrapper.cpp
${QtGui_GEN_DIR}/qtouchevent_wrapper.cpp
${QtGui_GEN_DIR}/qtransform_wrapper.cpp
${QtGui_GEN_DIR}/qt_wrapper.cpp
+${QtGui_GEN_DIR}/qundocommand_wrapper.cpp
+${QtGui_GEN_DIR}/qundogroup_wrapper.cpp
+${QtGui_GEN_DIR}/qundostack_wrapper.cpp
${QtGui_GEN_DIR}/qvalidator_wrapper.cpp
${QtGui_GEN_DIR}/qvector2d_wrapper.cpp
${QtGui_GEN_DIR}/qvector3d_wrapper.cpp
@@ -214,24 +202,6 @@ ${QtGui_GEN_DIR}/qwindowstatechangeevent_wrapper.cpp
${QtGui_GEN_DIR}/qtgui_module_wrapper.cpp
)
-if (Qt${QT_MAJOR_VERSION}Gui_VERSION VERSION_EQUAL 5.14.0
- OR Qt${QT_MAJOR_VERSION}Gui_VERSION VERSION_GREATER 5.14.0)
- list(APPEND QtGui_SRC ${QtGui_GEN_DIR}/qcolorspace_wrapper.cpp)
-endif()
-
-# cf qtbase/src/gui/opengl/opengl.pri
-list(FIND QtGui_enabled_features "opengles2" _opengles2Index)
-# ### fixme: For cmake >= 3.3: if(opengles2 IN_LIST QtGui_enabled_features)
-if(_opengles2Index GREATER -1)
- list(APPEND QtGui_DROPPED_ENTRIES QOpenGLTimeMonitor QOpenGLTimerQuery)
- message(STATUS "Qt${QT_MAJOR_VERSION}Gui: Dropping Desktop OpenGL classes (GLES2)")
-else()
- list(APPEND QtGui_SRC
- ${QtGui_GEN_DIR}/qopengltimemonitor_wrapper.cpp
- ${QtGui_GEN_DIR}/qopengltimerquery_wrapper.cpp)
- message(STATUS "Qt${QT_MAJOR_VERSION}Gui: Adding Desktop OpenGL classes")
-endif()
-
configure_file("${QtGui_SOURCE_DIR}/typesystem_gui.xml.in"
"${QtGui_BINARY_DIR}/typesystem_gui.xml" @ONLY)
diff --git a/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml b/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml
index 13f8f3cb..8136fb3e 100644
--- a/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml
+++ b/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml
@@ -105,89 +105,16 @@
<rejection class="^QOpenGL.*$" argument-type="^(const )?QVector.D ?\*$"/>
<rejection class="^QOpenGL.*$" argument-type="^(const )?void ?\*\*$"/>
+ <rejection class="QDrawBorderPixmap"/>
+
<!--
Event classes have a lot of non-documented protected fields, those fields
are removed from PySide because they are Qt implementation details,
besides the fact they are accessible by ordinary event methods.
-->
- <rejection class="^QAccessible.*Event$" field-name="^m_.*$"/>
-
- <rejection class="QEnterEvent" field-name="l"/>
- <rejection class="QEnterEvent" field-name="w"/>
- <rejection class="QEnterEvent" field-name="s"/>
-
- <rejection class="QInputEvent" field-name="modState"/>
- <rejection class="QInputEvent" field-name="modState"/>
-
- <rejection class="QMouseEvent" field-name="p"/>
- <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"/>
-
- <rejection class="QWheelEvent" field-name="p"/>
- <rejection class="QWheelEvent" field-name="g"/>
- <rejection class="QWheelEvent" field-name="mouseState"/>
- <rejection class="QWheelEvent" field-name="o"/>
-
- <rejection class="QTabletEvent" field-name="mPos"/>
- <rejection class="QTabletEvent" field-name="mGPos"/>
- <rejection class="QTabletEvent" field-name="mHiResGlobalPos"/>
- <rejection class="QTabletEvent" field-name="mDev"/>
- <rejection class="QTabletEvent" field-name="mPointerType"/>
- <rejection class="QTabletEvent" field-name="mXT"/>
- <rejection class="QTabletEvent" field-name="mYT"/>
- <rejection class="QTabletEvent" field-name="mZ"/>
- <rejection class="QTabletEvent" field-name="mPress"/>
- <rejection class="QTabletEvent" field-name="mTangential"/>
- <rejection class="QTabletEvent" field-name="mRot"/>
- <rejection class="QTabletEvent" field-name="mUnique"/>
- <rejection class="QTabletEvent" field-name="mExtra"/>
-
- <rejection class="QKeyEvent" field-name="txt"/>
- <rejection class="QKeyEvent" field-name="k"/>
- <rejection class="QKeyEvent" field-name="c"/>
- <rejection class="QKeyEvent" field-name="auto"/>
-
- <rejection class="QPaintEvent" field-name="m_rect"/>
- <rejection class="QPaintEvent" field-name="m_region"/>
- <rejection class="QPaintEvent" field-name="m_erased"/>
-
- <rejection class="QMoveEvent" field-name="p"/>
- <rejection class="QMoveEvent" field-name="oldp"/>
-
- <rejection class="QResizeEvent" field-name="s"/>
- <rejection class="QResizeEvent" field-name="olds"/>
-
- <rejection class="QContextMenuEvent" field-name="p"/>
- <rejection class="QContextMenuEvent" field-name="gp"/>
- <rejection class="QContextMenuEvent" field-name="reas"/>
-
- <rejection class="QDropEvent" field-name="p"/>
- <rejection class="QDropEvent" field-name="mouseState"/>
- <rejection class="QDropEvent" field-name="modState"/>
- <rejection class="QDropEvent" field-name="act"/>
- <rejection class="QDropEvent" field-name="drop_action"/>
- <rejection class="QDropEvent" field-name="default_action"/>
- <rejection class="QDropEvent" field-name="mdata"/>
- <rejection class="QDropEvent" field-name="fmts"/>
-
- <rejection class="QDragMoveEvent" field-name="rect"/>
-
- <rejection class="QShortcutEvent" field-name="sequence"/>
- <rejection class="QShortcutEvent" field-name="ambig"/>
- <rejection class="QShortcutEvent" field-name="sid"/>
-
- <rejection class="QTouchEvent" field-name="_device"/>
- <rejection class="QTouchEvent" field-name="_widget"/>
- <rejection class="QTouchEvent" field-name="_window"/>
- <rejection class="QTouchEvent" field-name="_deviceType"/>
- <rejection class="QTouchEvent" field-name="_touchPointStates"/>
- <rejection class="QTouchEvent" field-name="_touchPoints"/>
+ <rejection class="^Q.*Event$" field-name="^m_.*$"/>
+ <rejection class="QEventPoint" field-name="^m_.*$"/>
<rejection class="QAbstractTextDocumentLayout::PaintContext" field-name="selections"/>
<rejection class="QBrush" function-name="cleanUp"/>
@@ -245,6 +172,40 @@
<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"/>
+ <object-type name="QAction">
+ <enum-type name="ActionEvent"/>
+ <enum-type name="MenuRole"/>
+ <enum-type name="Priority" since="4.6"/>
+ <modify-function signature="setMenu(QMenu*)">
+ <modify-argument index="1">
+ <parent index="this" action="add"/>
+ </modify-argument>
+ </modify-function>
+ <modify-function signature="triggered(bool)" allow-thread="yes"/>
+ </object-type>
+ <object-type name="QActionGroup">
+ <enum-type name="ExclusionPolicy" since="5.14"/>
+ <modify-function signature="addAction(QAction*)">
+ <modify-argument index="1">
+ <parent index="this" action="add"/>
+ </modify-argument>
+ </modify-function>
+ <modify-function signature="removeAction(QAction*)">
+ <modify-argument index="1">
+ <parent index="this" action="remove"/>
+ </modify-argument>
+ </modify-function>
+ </object-type>
+ <object-type name="QShortcut">
+ <add-function signature="QShortcut(QKeySequence&amp;,QObject*,PyCallable*,Qt::ShortcutContext)">
+ <modify-argument index="4">
+ <replace-default-expression with="Qt::WindowShortcut"/>
+ </modify-argument>
+ <inject-code class="target" position="beginning" file="../glue/qtwidgets.cpp" snippet="qshortcut-1"/>
+ <inject-code class="target" position="end" file="../glue/qtwidgets.cpp" snippet="qshortcut-2"/>
+ </add-function>
+ </object-type>
+
<value-type name="QTransform">
<enum-type name="TransformationType"/>
<add-function signature="__repr__" return-type="PyObject*">
@@ -403,10 +364,10 @@
<modify-function signature="operator QVariant()const" remove="all"/>
</value-type>
<value-type name="QPicture" >
- <modify-function signature="load(QIODevice*,const char*)" allow-thread="yes"/>
- <modify-function signature="load(const QString&amp;,const char*)" allow-thread="yes"/>
- <modify-function signature="save(QIODevice*,const char*)" allow-thread="yes"/>
- <modify-function signature="save(const QString&amp;,const char*)" allow-thread="yes"/>
+ <modify-function signature="load(QIODevice*)" allow-thread="yes"/>
+ <modify-function signature="load(const QString&amp;)" allow-thread="yes"/>
+ <modify-function signature="save(QIODevice*)" allow-thread="yes"/>
+ <modify-function signature="save(const QString&amp;)" allow-thread="yes"/>
<!-- See bug 759 -->
<modify-function signature="data()const">
<modify-argument index="return">
@@ -499,9 +460,12 @@
</value-type>
<value-type name="QPolygon">
<extra-includes>
- <include file-name="QMatrix" location="global"/>
<include file-name="QTransform" location="global"/>
</extra-includes>
+ <!-- Expose operator==, != inherited from QList, which the parser does
+ not see due to the TMP expression of the return type. -->
+ <add-function signature="operator==(const QPolygon&amp;)" return-type="bool"/>
+ <add-function signature="operator!=(const QPolygon&amp;)" return-type="bool"/>
<add-function signature="__reduce__" return-type="PyObject*">
<inject-code class="target" position="beginning" file="../glue/qtgui.cpp" snippet="qpolygon-reduce">
<insert-template name="reduce_code">
@@ -525,7 +489,6 @@
</value-type>
<value-type name="QPolygonF">
<extra-includes>
- <include file-name="QMatrix" location="global"/>
<include file-name="QTransform" location="global"/>
</extra-includes>
<!-- ### A QVector parameter, for no defined type, will generate wrong code. -->
@@ -653,70 +616,6 @@
</modify-function>
</value-type>
- <!-- Qt5: this _should_ be obsolete, but QImage is still using it... -->
- <value-type name="QMatrix">
- <extra-includes>
- <include file-name="QPainterPath" location="global"/>
- </extra-includes>
- <add-function signature="__repr__" return-type="PyObject*">
- <inject-code class="target" position="beginning">
- <insert-template name="repr_code">
- <replace from="%REPR_FORMAT" to="%f, %f, %f, %f, %f, %f"/>
- <replace from="%REPR_ARGS"
- to="%CPPSELF.m11(), %CPPSELF.m12(), %CPPSELF.m21(), %CPPSELF.m22(), %CPPSELF.dx(), %CPPSELF.dy()"/>
- </insert-template>
- </inject-code>
- </add-function>
-
- <add-function signature="__reduce__" return-type="PyObject*">
- <inject-code class="target" position="beginning">
- <insert-template name="reduce_code">
- <replace from="%REDUCE_FORMAT" to="dddddd"/>
- <replace from="%REDUCE_ARGS" to="%CPPSELF.m11(), %CPPSELF.m12(), %CPPSELF.m21(), %CPPSELF.m22(), %CPPSELF.dx(), %CPPSELF.dy()"/>
- </insert-template>
- </inject-code>
- </add-function>
- <modify-function signature="map(int,int,int*,int*)const">
- <modify-argument index="3">
- <remove-argument />
- </modify-argument>
- <modify-argument index="4">
- <remove-argument />
- </modify-argument>
- <inject-code>
- <insert-template name="qmatrix_map"/>
- </inject-code>
- </modify-function>
- <modify-function signature="map(qreal,qreal,qreal*,qreal*)const">
- <modify-argument index="3">
- <remove-argument />
- </modify-argument>
- <modify-argument index="4">
- <remove-argument />
- </modify-argument>
- <inject-code>
- <insert-template name="qmatrix_map"/>
- </inject-code>
- </modify-function>
- <modify-function signature="map(const QPoint&amp;)const">
- <modify-argument index="return">
- <replace-type modified-type="QPoint"/>
- </modify-argument>
- <inject-code file="../glue/qtgui.cpp" snippet="qmatrix-map-point" />
- </modify-function>
- <modify-function signature="inverted(bool*)const">
- <modify-argument index="1">
- <remove-argument/>
- </modify-argument>
- <modify-argument index="return">
- <replace-type modified-type="PyTuple"/>
- </modify-argument>
- <inject-code class="target" position="beginning">
- <insert-template name="fix_bool*"/>
- </inject-code>
- </modify-function>
- </value-type>
-
<value-type name="QConicalGradient" polymorphic-id-expression="%1-&gt;type() == QGradient::ConicalGradient"/>
<value-type name="QFontInfo"/>
<value-type name="QRadialGradient" polymorphic-id-expression="%1-&gt;type() == QGradient::RadialGradient"/>
@@ -754,7 +653,6 @@
<enum-type name="InvertMode"/>
<extra-includes>
<include file-name="QStringList" location="global"/>
- <include file-name="QMatrix" location="global"/>
</extra-includes>
<modify-function signature="load(const QString&amp;, const char*)" allow-thread="yes"/>
@@ -762,7 +660,7 @@
<modify-function signature="save(const QString&amp;,const char*,int)const" allow-thread="yes"/>
<modify-function signature="save(QIODevice*,const char*,int)const" allow-thread="yes"/>
- <modify-function signature="QImage(uchar*,int,int,int,QImage::Format,QImageCleanupFunction,void*)">
+ <modify-function signature="QImage(uchar*,int,int,qsizetype,QImage::Format,QImageCleanupFunction,void*)">
<modify-argument index="1">
<replace-type modified-type="PyBuffer"/>
</modify-argument>
@@ -799,7 +697,7 @@
</add-function>
<!-- The non-const versions are already used -->
- <modify-function signature="QImage(const uchar*,int,int,int,QImage::Format,QImageCleanupFunction,void*)" remove="all"/>
+ <modify-function signature="QImage(const uchar*,int,int,qsizetype,QImage::Format,QImageCleanupFunction,void*)" remove="all"/>
<modify-function signature="QImage(const uchar*,int,int,QImage::Format,QImageCleanupFunction,void*)" remove="all"/>
<!-- ### -->
@@ -907,7 +805,7 @@
<inject-code class="target" position="beginning" file="../glue/qtgui.cpp" snippet="qcolor"/>
</add-function>
<!-- get* methods. Inject code -->
- <modify-function signature="getCmyk(int*,int*,int*,int*,int*)">
+ <modify-function signature="getCmyk(int*,int*,int*,int*,int*)const">
<modify-argument index="0">
<replace-type modified-type="PyObject*"/>
</modify-argument>
@@ -934,7 +832,7 @@
</insert-template>
</inject-code>
</modify-function>
- <modify-function signature="getCmykF(qreal*,qreal*,qreal*,qreal*,qreal*)">
+ <modify-function signature="getCmykF(qreal*,qreal*,qreal*,qreal*,qreal*)const">
<modify-argument index="0">
<replace-type modified-type="PyObject*"/>
</modify-argument>
@@ -1118,7 +1016,7 @@
</inject-code>
</modify-function>
- <modify-function signature="width(QChar)const" rename="widthChar">
+ <modify-function signature="horizontalAdvance(QChar)const" rename="horizontalAdvanceChar">
<modify-argument index="1">
<replace-type modified-type="char"/>
</modify-argument>
@@ -1154,7 +1052,7 @@
</inject-code>
</modify-function>
- <modify-function signature="width(QChar)const" rename="widthChar">
+ <modify-function signature="horizontalAdvance(QChar)const" rename="horizontalAdvanceChar">
<modify-argument index="1">
<replace-type modified-type="char"/>
</modify-argument>
@@ -1256,23 +1154,17 @@
<object-type name="QIntValidator"/>
<object-type name="QPainterPathStroker" copyable="false"/>
- <object-type name="QPictureIO">
- <modify-function signature="setIODevice(QIODevice*)">
- <modify-argument index="1">
- <parent index="this" action="add"/>
- </modify-argument>
- </modify-function>
- <modify-function signature="read()" allow-thread="yes"/>
- <modify-function signature="write()" allow-thread="yes"/>
- </object-type>
<object-type name="QPixmapCache">
<value-type name="Key"/>
<add-function signature="find(QPixmapCache::Key&amp;)">
<inject-code file="../glue/qtgui.cpp" snippet="qpixmapcache-find"/>
</add-function>
+ <add-function signature="find(const QString&amp;)">
+ <inject-code file="../glue/qtgui.cpp" snippet="qpixmapcache-find"/>
+ </add-function>
</object-type>
- <object-type name="QRegExpValidator"/>
+ <object-type name="QRegularExpressionValidator"/>
<object-type name="QStandardItem">
<enum-type name="ItemType"/>
@@ -1415,6 +1307,9 @@
<enum-type name="Reason"/>
</object-type>
+ <value-type name="QEventPoint" since="6.0">
+ <enum-type name="State"/>
+ </value-type>
<object-type name="QDragEnterEvent" polymorphic-id-expression="%1-&gt;type() == QEvent::DragEnter"/>
<object-type name="QDragLeaveEvent" polymorphic-id-expression="%1-&gt;type() == QEvent::DragLeave"/>
<object-type name="QDragMoveEvent" polymorphic-id-expression="%1-&gt;type() == QEvent::DragMove"/>
@@ -1450,11 +1345,9 @@
<object-type name="QShortcutEvent" copyable = "false" polymorphic-id-expression="%1-&gt;type() == QEvent::Shortcut">
</object-type>
<object-type name="QShowEvent" copyable= "false" polymorphic-id-expression="%1-&gt;type() == QEvent::Show"/>
+ <object-type name="QSinglePointEvent" copyable="false" since="6.0"/>
<object-type name="QStatusTipEvent" copyable= "false" polymorphic-id-expression="%1-&gt;type() == QEvent::StatusTip"/>
- <object-type name="QTabletEvent" copyable= "false" polymorphic-id-expression="%1-&gt;type() == QEvent::TabletMove || %1-&gt;type() == QEvent::TabletPress || %1-&gt;type() == QEvent::TabletRelease">
- <enum-type name="PointerType"/>
- <enum-type name="TabletDevice"/>
- </object-type>
+ <object-type name="QTabletEvent" copyable= "false" polymorphic-id-expression="%1-&gt;type() == QEvent::TabletMove || %1-&gt;type() == QEvent::TabletPress || %1-&gt;type() == QEvent::TabletRelease"/>
<object-type name="QToolBarChangeEvent" polymorphic-id-expression="%1-&gt;type() == QEvent::ToolBarChange"/>
<object-type name="QWhatsThisClickedEvent" copyable="false" polymorphic-id-expression="%1-&gt;type() == QEvent::WhatsThisClicked"/>
<object-type name="QWheelEvent" copyable= "false" polymorphic-id-expression="%1-&gt;type() == QEvent::Wheel"/>
@@ -1473,6 +1366,7 @@
<object-type name="QScrollEvent" copyable="false" polymorphic-id-expression="%1-&gt;type() == QEvent::Scroll">
<enum-type name="ScrollState"/>
</object-type>
+ <object-type name="QPointerEvent" copyable= "false" since="6.0"/>
<object-type name="QScrollPrepareEvent" copyable="false" polymorphic-id-expression="%1-&gt;type() == QEvent::ScrollPrepare"/>
<object-type name="QTextFrame" >
@@ -1889,14 +1783,6 @@
<insert-template name="qpainter_drawlist"/>
</inject-code>
</add-function>
- <modify-function signature="drawRoundRect(int,int,int,int,int,int)">
- <modify-argument index="5">
- <rename to="xRound"/>
- </modify-argument>
- <modify-argument index="6">
- <rename to="yRound"/>
- </modify-argument>
- </modify-function>
<modify-function signature="drawTiledPixmap(const QRect&amp;,const QPixmap&amp;,const QPoint&amp;)">
<modify-argument index="3">
<rename to="pos"/>
@@ -1912,16 +1798,6 @@
<no-null-pointer/>
</modify-argument>
</modify-function>
- <modify-function signature="setRedirected(const QPaintDevice*,QPaintDevice*,const QPoint&amp;)">
- <modify-argument index="1">
- <no-null-pointer/>
- </modify-argument>
- </modify-function>
- <modify-function signature="restoreRedirected(const QPaintDevice*)">
- <modify-argument index="1">
- <no-null-pointer/>
- </modify-argument>
- </modify-function>
<modify-function signature="drawText(QRectF,int,QString,QRectF*)">
<modify-argument index="4">
<remove-argument/>
@@ -2255,6 +2131,7 @@
</value-type>
<value-type name="QMatrix4x4" since="4.6">
+ <enum-type name="Flag" flags="Flags" since="6.0"/>
<!-- Qt5: HAIRY TRICK ALERT ahead!
Qt5 partially replaced 'qreal' by float.
@@ -2372,15 +2249,11 @@
<modify-function signature="getEulerAngles(float*,float*,float*)const" since="5.5" remove="all"/>
</value-type>
- <object-type name="QTouchEvent" since="4.6">
- <value-type name="TouchPoint" since="4.6">
- <enum-type name="InfoFlag" flags="InfoFlags"/>
- </value-type>
- </object-type>
+ <object-type name="QTouchEvent" since="4.6"/>
- <object-type name="QTouchDevice">
- <enum-type name="CapabilityFlag" flags="Capabilities"/>
- <enum-type name="DeviceType"/>
+ <object-type name="QInputDevice">
+ <enum-type name="Capability" flags="Capabilities"/>
+ <enum-type name="DeviceType" flags="DeviceTypes"/>
</object-type>
<value-type name="QVector2D" since="4.6">
@@ -2524,7 +2397,7 @@
<enum-type name="Visibility"/>
<modify-function signature="raise()" rename="raise_"/>
<!-- see QWidget::nativeEvent(), QAbstractNativeEventFilter::nativeEventFilter() -->
- <modify-function signature="nativeEvent(const QByteArray &amp;,void*,long*)">
+ <modify-function signature="nativeEvent(const QByteArray &amp;,void*,qintptr*)">
<modify-argument index="3">
<remove-argument/>
<conversion-rule class="native">
@@ -2575,29 +2448,10 @@
</object-type>
- <object-type name="QOpenGLBuffer" since="5.0">
- <enum-type name="Access"/>
- <enum-type name="RangeAccessFlag" flags="RangeAccessFlags"/>
- <enum-type name="Type"/>
- <enum-type name="UsagePattern"/>
- </object-type>
<object-type name="QOpenGLContext">
<enum-type name="OpenGLModuleType"/>
</object-type>
<object-type name="QOpenGLContextGroup" since="5.0"/>
- <object-type name="QOpenGLDebugLogger" since="5.1">
- <enum-type name="LoggingMode"/>
- </object-type>
- <value-type name="QOpenGLDebugMessage" since="5.1">
- <enum-type name="Source" flags="Sources"/>
- <enum-type name="Type" flags="Types"/>
- <enum-type name="Severity" flags="Severities"/>
- </value-type>
- <object-type name="QOpenGLFramebufferObject" since="5.0">
- <enum-type name="Attachment"/>
- <enum-type name="FramebufferRestorePolicy" since="5.7"/>
- </object-type>
- <value-type name="QOpenGLFramebufferObjectFormat"/>
<!-- Compile error on Windows: QOpenGLPaintDevice::QOpenGLPaintDevice(const QOpenGLPaintDevice &)': attempting to reference a deleted function
<object-type name="QOpenGLPaintDevice" since="5.0"/>
-->
@@ -2884,7 +2738,6 @@
<modify-argument index="2"><array/></modify-argument>
</modify-function>
</object-type>
- <object-type name="QAbstractOpenGLFunctions" since="5.1"/>
<!-- Classes are result of a macro expansion in src/gui/opengl/qopenglversionfunctions.h
<object-type name="QOpenGLFunctions_1_0" since="5.1"/>
<object-type name="QOpenGLFunctions_1_1" since="5.1"/>
@@ -2914,98 +2767,6 @@
<object-type name="QOpenGLFunctions_4_5_Core" since="5.5"/>
<object-type name="QOpenGLFunctions_ES2" since="5.1"/>
-->
- <value-type name="QOpenGLPixelTransferOptions"/>
- <object-type name="QOpenGLShader" since="5.0">
- <enum-type name="ShaderTypeBit" flags="ShaderType"/>
- </object-type>
- <object-type name="QOpenGLShaderProgram" since="5.0">
- <modify-function signature="setAttributeArray(int,const float*,int,int)">
- <modify-argument index="2"><array/></modify-argument>
- </modify-function>
- <modify-function signature="setAttributeArray(const char*,const float*,int,int)">
- <modify-argument index="2"><array/></modify-argument>
- </modify-function>
- <modify-function signature="setAttributeArray(int,const float*,int,int)">
- <modify-argument index="2"><array/></modify-argument>
- </modify-function>
- <modify-function signature="setAttributeValue(int,const float*,int,int)">
- <modify-argument index="2"><array/></modify-argument>
- </modify-function>
- <modify-function signature="setAttributeValue(const char*,const float*,int,int)">
- <modify-argument index="2"><array/></modify-argument>
- </modify-function>
- <modify-function signature="setUniformValueArray(int,const float*,int,int)">
- <modify-argument index="2"><array/></modify-argument>
- </modify-function>
- <modify-function signature="setUniformValueArray(int,const int*,int)">
- <modify-argument index="2"><array/></modify-argument>
- </modify-function>
- <modify-function signature="setUniformValueArray(int,const unsigned int*,int)">
- <modify-argument index="2"><array/></modify-argument>
- </modify-function>
- <modify-function signature="setUniformValueArray(const char*,const float*,int,int)">
- <modify-argument index="2"><array/></modify-argument>
- </modify-function>
- <modify-function signature="setUniformValueArray(const char*,const int*,int)">
- <modify-argument index="2"><array/></modify-argument>
- </modify-function>
- <modify-function signature="setUniformValueArray(const char*,const unsigned int*,int)">
- <modify-argument index="2"><array/></modify-argument>
- </modify-function>
- <!-- Add explicit signatures for the setUniformValue functions -->
- <modify-function signature="^setUniformValue\(const char\*,(float|int|uint)\)$" remove="all"/>
- <!-- No need for a signature for GLuint, since Qt (internally) calls the same function: glUniform1i -->
- <add-function signature="setUniformValue1f(const char*, float)" return-type="void">
- <inject-code file="../glue/qtgui.cpp" snippet="qopenglshaderprogram_setuniformvalue_float"/>
- </add-function>
- <add-function signature="setUniformValue1i(const char*, int)" return-type="void">
- <inject-code file="../glue/qtgui.cpp" snippet="qopenglshaderprogram_setuniformvalue_int"/>
- </add-function>
- <add-function signature="setUniformValue1f(int, float)" return-type="void">
- <inject-code file="../glue/qtgui.cpp" snippet="qopenglshaderprogram_setuniformvalue_float"/>
- </add-function>
- <add-function signature="setUniformValue1i(int, int)" return-type="void">
- <inject-code file="../glue/qtgui.cpp" snippet="qopenglshaderprogram_setuniformvalue_int"/>
- </add-function>
- </object-type>
- <object-type name="QOpenGLTexture" since="5.2">
- <enum-type name="BindingTarget"/>
- <enum-type name="CoordinateDirection"/>
- <enum-type name="ComparisonFunction"/>
- <enum-type name="ComparisonMode"/>
- <enum-type name="CubeMapFace"/>
- <enum-type name="DepthStencilMode"/>
- <enum-type name="Feature" flags="Features"/>
- <enum-type name="Filter"/>
- <enum-type name="MipMapGeneration"/>
- <enum-type name="PixelFormat"/>
- <enum-type name="PixelType"/>
- <enum-type name="SwizzleComponent"/>
- <enum-type name="SwizzleValue"/>
- <enum-type name="Target"/>
- <enum-type name="TextureFormat"/>
- <enum-type name="TextureFormatClass"/>
- <enum-type name="TextureUnitReset"/>
- <enum-type name="WrapMode"/>
- <modify-function signature="borderColor(unsigned int*)const" remove="all"/>
- <modify-function signature="borderColor(int*)const" remove="all"/>
- <modify-function signature="borderColor(float*)const" remove="all"/>
- <!-- Work around link error introduced by qtbase/d15b02ff291e3124d9bb8ac3b06b704c292f52ab, can be removed once
- qtbase/1bfabe35d8178c93e66acef21c01e08980f9ed0d has landed -->
- <modify-function signature="setData(int,int,int,int,int,int,int,QOpenGLTexture::PixelFormat,QOpenGLTexture::PixelType,const void*,QOpenGLPixelTransferOptions*const)" remove="all"/>
- </object-type>
- <object-type name="QOpenGLTextureBlitter">
- <enum-type name="Origin"/>
- </object-type>
- <object-type name="QOpenGLTimeMonitor" since="5.1"/>
- <object-type name="QOpenGLTimerQuery" since="5.1"/>
- <object-type name="QOpenGLWindow" since="5.4">
- <enum-type name="UpdateBehavior"/>
- </object-type>
- <value-type name="QOpenGLVersionProfile" since="5.1"/>
- <object-type name="QOpenGLVertexArrayObject">
- <object-type name="Binder"/>
- </object-type>
<value-type name="QPageLayout">
<enum-type name="Mode"/>
<enum-type name="Orientation"/>
@@ -3027,6 +2788,9 @@
<enum-type name="YUVLayout"/>
</value-type>
<object-type name="QPdfWriter"/>
+ <object-type name="QPointingDevice" since="6.0">
+ <enum-type name="PointerType" flags="PointerTypes"/>
+ </object-type>
<value-type name="QPointingDeviceUniqueId"/>
<value-type name="QRawFont">
<enum-type name="AntialiasingType"/>
@@ -3048,4 +2812,38 @@
</object-type>
<object-type name="QStyleHints"/>
+ <object-type name="QUndoCommand">
+ <modify-function signature="mergeWith(const QUndoCommand*)">
+ <modify-argument index="1" invalidate-after-use="yes"/>
+ </modify-function>
+ </object-type>
+ <object-type name="QUndoGroup">
+ <modify-function signature="addStack(QUndoStack*)">
+ <modify-argument index="1">
+ <parent index="this" action="add"/>
+ </modify-argument>
+ </modify-function>
+ <modify-function signature="removeStack(QUndoStack*)">
+ <modify-argument index="1">
+ <parent index="this" action="add"/>
+ </modify-argument>
+ </modify-function>
+ </object-type>
+ <object-type name="QUndoStack">
+ <modify-function signature="createUndoAction(QObject*,const QString&amp;)const">
+ <modify-argument index="return">
+ <parent index="1" action="add"/>
+ </modify-argument>
+ </modify-function>
+ <modify-function signature="createRedoAction(QObject*,const QString&amp;)const">
+ <modify-argument index="return">
+ <parent index="1" action="add"/>
+ </modify-argument>
+ </modify-function>
+ <modify-function signature="push(QUndoCommand*)">
+ <modify-argument index="1">
+ <parent index="this" action="add"/>
+ </modify-argument>
+ </modify-function>
+ </object-type>
</typesystem>
diff --git a/sources/pyside2/PySide2/QtNetwork/CMakeLists.txt b/sources/pyside2/PySide2/QtNetwork/CMakeLists.txt
index 7a9dcc23..fca44d92 100644
--- a/sources/pyside2/PySide2/QtNetwork/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtNetwork/CMakeLists.txt
@@ -23,8 +23,6 @@ ${QtNetwork_GEN_DIR}/qlocalsocket_wrapper.cpp
${QtNetwork_GEN_DIR}/qnetworkaccessmanager_wrapper.cpp
${QtNetwork_GEN_DIR}/qnetworkaddressentry_wrapper.cpp
${QtNetwork_GEN_DIR}/qnetworkcachemetadata_wrapper.cpp
-${QtNetwork_GEN_DIR}/qnetworkconfiguration_wrapper.cpp
-${QtNetwork_GEN_DIR}/qnetworkconfigurationmanager_wrapper.cpp
${QtNetwork_GEN_DIR}/qnetworkcookie_wrapper.cpp
${QtNetwork_GEN_DIR}/qnetworkcookiejar_wrapper.cpp
${QtNetwork_GEN_DIR}/qnetworkdatagram_wrapper.cpp
@@ -35,7 +33,6 @@ ${QtNetwork_GEN_DIR}/qnetworkproxyfactory_wrapper.cpp
${QtNetwork_GEN_DIR}/qnetworkproxyquery_wrapper.cpp
${QtNetwork_GEN_DIR}/qnetworkreply_wrapper.cpp
${QtNetwork_GEN_DIR}/qnetworkrequest_wrapper.cpp
-${QtNetwork_GEN_DIR}/qnetworksession_wrapper.cpp
${QtNetwork_GEN_DIR}/qpassworddigestor_wrapper.cpp
${QtNetwork_GEN_DIR}/qssl_wrapper.cpp
${QtNetwork_GEN_DIR}/qsslcertificate_wrapper.cpp
@@ -48,9 +45,9 @@ ${QtNetwork_GEN_DIR}/qtnetwork_module_wrapper.cpp
)
get_property(QtNetwork_enabled_features TARGET Qt${QT_MAJOR_VERSION}::Network
- PROPERTY INTERFACE_QT_ENABLED_FEATURES)
+ PROPERTY QT_ENABLED_PUBLIC_FEATURES)
get_property(QtNetwork_disabled_features TARGET Qt${QT_MAJOR_VERSION}::Network
- PROPERTY INTERFACE_QT_DISABLED_FEATURES)
+ PROPERTY QT_DISABLED_PUBLIC_FEATURES)
# ### fixme: For cmake >= 3.3, use if( needle IN_LIST list)
list(FIND QtNetwork_enabled_features "ssl" _sslEnabledIndex)
diff --git a/sources/pyside2/PySide2/QtNetwork/typesystem_network.xml b/sources/pyside2/PySide2/QtNetwork/typesystem_network.xml
index 1e473b3a..f078b9bf 100644
--- a/sources/pyside2/PySide2/QtNetwork/typesystem_network.xml
+++ b/sources/pyside2/PySide2/QtNetwork/typesystem_network.xml
@@ -42,6 +42,8 @@
<typesystem package="PySide2.QtNetwork">
<load-typesystem name="QtCore/typesystem_core.xml" generate="no"/>
+ <rejection class="dtlsopenssl"/>
+
<enum-type name="QDtlsError" since="5.12"/>
<enum-type name="QOcspCertificateStatus" since="5.13"/>
<enum-type name="QOcspRevocationReason" since="5.13"/>
@@ -53,6 +55,8 @@
</namespace-type>
<namespace-type name="QSsl">
+ <enum-type name="AlertLevel" since="6.0"/>
+ <enum-type name="AlertType" since="6.0"/>
<enum-type name="AlternativeNameEntryType"/>
<enum-type name="EncodingFormat"/>
<enum-type name="KeyAlgorithm"/>
@@ -65,6 +69,7 @@
</namespace-type>
<rejection class="QIPv6Address" field-name="c"/>
+ <rejection class="dtlsopenssl"/>
<object-type name="QAbstractSocket">
<enum-type name="BindFlag" flags="BindMode"/>
@@ -171,7 +176,6 @@
<enum-type name="LocalSocketState"/>
</object-type>
<object-type name="QNetworkAccessManager">
- <enum-type name="NetworkAccessibility" since="4.7"/>
<enum-type name="Operation"/>
<modify-function signature="createRequest(QNetworkAccessManager::Operation,const QNetworkRequest&amp;,QIODevice*)">
<modify-argument index="3" invalidate-after-use="yes"/>
@@ -261,21 +265,6 @@
<enum-type name="TransferTimeoutConstant" since="5.15"/>
</value-type>
- <value-type name="QNetworkConfiguration" since="4.7">
- <enum-type name="BearerType"/>
- <enum-type name="Purpose" since="4.7"/>
- <enum-type name="StateFlag" flags="StateFlags" since="4.7"/>
- <enum-type name="Type" since="4.7"/>
- </value-type>
- <object-type name="QNetworkConfigurationManager" since="4.7">
- <enum-type name="Capability" flags="Capabilities" since="4.7"/>
- </object-type>
- <object-type name="QNetworkSession" since="4.7">
- <enum-type name="SessionError" since="4.7"/>
- <enum-type name="State" since="4.7"/>
- <enum-type name="UsagePolicy" flags="UsagePolicies"/>
- </object-type>
-
<object-type name="QAbstractNetworkCache"/>
<object-type name="QNetworkDiskCache"/>
<value-type name="QNetworkCacheMetaData"/>
diff --git a/sources/pyside2/PySide2/QtOpenGL/CMakeLists.txt b/sources/pyside2/PySide2/QtOpenGL/CMakeLists.txt
index 1d2c406f..7a52c693 100644
--- a/sources/pyside2/PySide2/QtOpenGL/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtOpenGL/CMakeLists.txt
@@ -1,42 +1,60 @@
project(QtOpenGL)
+set(QtOpenGL_DROPPED_ENTRIES)
+
set(QtOpenGL_SRC
-${QtOpenGL_GEN_DIR}/qgl_wrapper.cpp
-${QtOpenGL_GEN_DIR}/qglbuffer_wrapper.cpp
-${QtOpenGL_GEN_DIR}/qglcolormap_wrapper.cpp
-${QtOpenGL_GEN_DIR}/qglcontext_wrapper.cpp
-${QtOpenGL_GEN_DIR}/qglformat_wrapper.cpp
-${QtOpenGL_GEN_DIR}/qglframebufferobject_wrapper.cpp
-${QtOpenGL_GEN_DIR}/qglframebufferobjectformat_wrapper.cpp
-${QtOpenGL_GEN_DIR}/qglpixelbuffer_wrapper.cpp
-${QtOpenGL_GEN_DIR}/qglshader_wrapper.cpp
-${QtOpenGL_GEN_DIR}/qglshaderprogram_wrapper.cpp
-${QtOpenGL_GEN_DIR}/qglwidget_wrapper.cpp
+${QtOpenGL_GEN_DIR}/qabstractopenglfunctions_wrapper.cpp
+${QtOpenGL_GEN_DIR}/qopengldebuglogger_wrapper.cpp
+${QtOpenGL_GEN_DIR}/qopengldebugmessage_wrapper.cpp
+${QtOpenGL_GEN_DIR}/qopenglframebufferobjectformat_wrapper.cpp
+${QtOpenGL_GEN_DIR}/qopenglpixeltransferoptions_wrapper.cpp
+${QtOpenGL_GEN_DIR}/qopenglshaderprogram_wrapper.cpp
+${QtOpenGL_GEN_DIR}/qopengltexture_wrapper.cpp
+${QtOpenGL_GEN_DIR}/qopengltextureblitter_wrapper.cpp
+${QtOpenGL_GEN_DIR}/qopenglversionprofile_wrapper.cpp
+${QtOpenGL_GEN_DIR}/qopenglvertexarrayobject_wrapper.cpp
+${QtOpenGL_GEN_DIR}/qopenglvertexarrayobject_binder_wrapper.cpp
+${QtOpenGL_GEN_DIR}/qopenglwindow_wrapper.cpp
+${QtOpenGL_GEN_DIR}/qopenglbuffer_wrapper.cpp
+${QtOpenGL_GEN_DIR}/qopenglshader_wrapper.cpp
+${QtOpenGL_GEN_DIR}/qopenglframebufferobject_wrapper.cpp
# module is always needed
${QtOpenGL_GEN_DIR}/qtopengl_module_wrapper.cpp
)
+get_property(QtGui_enabled_features TARGET Qt${QT_MAJOR_VERSION}::Gui
+ PROPERTY QT_ENABLED_PUBLIC_FEATURES)
+
+cmake_policy(SET CMP0057 NEW)
+if("opengles2" IN_LIST QtGui_enabled_features)
+ list(APPEND QtOpenGL_DROPPED_ENTRIES QOpenGLTimeMonitor QOpenGLTimerQuery)
+ message(STATUS "Qt${QT_MAJOR_VERSION}Gui: Dropping Desktop OpenGL classes (GLES2)")
+else()
+ list(APPEND QtOpenGL_SRC
+ ${QtOpenGL_GEN_DIR}/qopengltimemonitor_wrapper.cpp
+ ${QtOpenGL_GEN_DIR}/qopengltimerquery_wrapper.cpp)
+ message(STATUS "Qt${QT_MAJOR_VERSION}OpenGL: Adding Desktop OpenGL classes")
+endif()
+
set(QtOpenGL_include_dirs ${QtOpenGL_SOURCE_DIR}
${Qt${QT_MAJOR_VERSION}Core_INCLUDE_DIRS}
${Qt${QT_MAJOR_VERSION}Gui_INCLUDE_DIRS}
- ${Qt${QT_MAJOR_VERSION}Widgets_INCLUDE_DIRS}
${Qt${QT_MAJOR_VERSION}OpenGL_INCLUDE_DIRS}
${libpyside_SOURCE_DIR}
- ${QtWidgets_GEN_DIR}
- ${QtGui_GEN_DIR}
${QtCore_GEN_DIR}
+ ${QtGui_GEN_DIR}
${QtOpenGL_GEN_DIR}
)
set(QtOpenGL_libraries pyside2
${Qt${QT_MAJOR_VERSION}Core_LIBRARIES}
${Qt${QT_MAJOR_VERSION}Gui_LIBRARIES}
- ${Qt${QT_MAJOR_VERSION}Widgets_LIBRARIES}
${Qt${QT_MAJOR_VERSION}OpenGL_LIBRARIES})
-set(QtOpenGL_deps QtWidgets)
+set(QtOpenGL_deps QtGui)
create_pyside_module(NAME QtOpenGL
INCLUDE_DIRS QtOpenGL_include_dirs
LIBRARIES QtOpenGL_libraries
DEPS QtOpenGL_deps
TYPESYSTEM_PATH QtOpenGL_SOURCE_DIR
- SOURCES QtOpenGL_SRC)
+ SOURCES QtOpenGL_SRC
+ DROPPED_ENTRIES QtOpenGL_DROPPED_ENTRIES)
diff --git a/sources/pyside2/PySide2/QtOpenGL/typesystem_opengl.xml b/sources/pyside2/PySide2/QtOpenGL/typesystem_opengl.xml
index 5e864ca4..c04929cc 100644
--- a/sources/pyside2/PySide2/QtOpenGL/typesystem_opengl.xml
+++ b/sources/pyside2/PySide2/QtOpenGL/typesystem_opengl.xml
@@ -2,7 +2,7 @@
<!--
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt for Python.
@@ -40,677 +40,134 @@
****************************************************************************/
-->
<typesystem package="PySide2.QtOpenGL">
- <load-typesystem name="QtWidgets/typesystem_widgets.xml" generate="no" />
+ <load-typesystem name="QtCore/typesystem_core.xml" generate="no" />
+ <load-typesystem name="QtGui/typesystem_gui.xml" generate="no" />
<load-typesystem name="templates/opengl_common.xml" generate="no" />
- <primitive-type name="GLbitfield"/>
- <primitive-type name="GLboolean"/>
- <primitive-type name="GLbyte"/>
- <primitive-type name="GLclampd"/>
- <primitive-type name="GLclampf"/>
- <primitive-type name="GLdouble"/>
- <primitive-type name="GLenum"/>
- <primitive-type name="GLfloat"/>
- <primitive-type name="GLint"/>
- <primitive-type name="GLshort"/>
- <primitive-type name="GLsizei"/>
- <primitive-type name="GLubyte"/>
- <primitive-type name="GLuint"/>
- <primitive-type name="GLushort"/>
-
- <rejection class="QGLColormap::QGLColormapData"/>
- <rejection class="QGLContext" field-name="currentCtx"/>
- <rejection class="^QGL.*$" argument-type="^(const )?GLboolean ?\*$"/>
- <rejection class="^QGL.*$" argument-type="^(const )?GLchar ?\*$"/>
- <rejection class="^QGL.*$" argument-type="^(const )?GLchar ?\*const"/>
- <rejection class="^QGL.*$" argument-type="^(const )?GLenum ?\*$"/>
- <rejection class="^QGL.*$" argument-type="^(const )?GLfloat ?\*$"/>
- <rejection class="^QGL.*$" argument-type="^(const )?GLfloat ?\[.*$"/>
- <rejection class="^QGL.*$" argument-type="^(const )?GLdouble ?\*$"/>
- <rejection class="^QGL.*$" argument-type="GLintptr"/>
- <rejection class="^QGL.*$" argument-type="^(const )?GLint64 ?\*$"/>
- <rejection class="^QGL.*$" argument-type="^(const )?GLsizei ?\*$"/>
-
- <namespace-type name="QGL">
- <enum-type name="FormatOption" flags="FormatOptions"/>
- <extra-includes>
- <include file-name="qgl.h" location="global"/>
- </extra-includes>
- </namespace-type>
-
- <value-type name="QGLColormap">
- <modify-function signature="setEntries(int,const unsigned int*,int)">
- <access modifier="private"/>
- </modify-function>
- </value-type>
-
- <value-type name="QGLFormat">
- <enum-type name="OpenGLContextProfile" since="4.7"/>
- <enum-type name="OpenGLVersionFlag" flags="OpenGLVersionFlags"/>
- </value-type>
-
- <rejection class="QGLContext" field-name="currentCtx"/>
- <object-type name="QGLContext">
- <enum-type name="BindOption" flags="BindOptions" since="4.6"/>
- <modify-function signature="chooseContext(const QGLContext*)">
- <modify-argument index="1" invalidate-after-use="yes"/>
- </modify-function>
- <modify-function signature="create(const QGLContext*)">
- <modify-argument index="1" invalidate-after-use="yes"/>
- </modify-function>
-
- <!-- ### Obsolete functions and ctors -->
- <modify-function signature="QGLContext(const QGLFormat&amp;,QPaintDevice*)" remove="all"/>
- <!-- ### -->
+ <rejection class="^QOpenGL.*$" argument-type="^(const )?GLboolean ?\*$"/>
+ <rejection class="^QOpenGL.*$" argument-type="^GLchar\*$"/>
+ <rejection class="^QOpenGL.*$" argument-type="^(const )?GLchar ?\*(const)?\*$"/>
+ <rejection class="^QOpenGL.*$" argument-type="^char\*$"/>
+ <rejection class="^QOpenGL.*$" argument-type="^(const )?char ?\*\*$"/>
+ <rejection class="^QOpenGL.*$" argument-type="GLintptr"/>
+ <rejection class="^QOpenGL.*$" argument-type="GLsizeiptr"/>
+ <rejection class="^QOpenGL.*$" argument-type="GLsync"/>
+ <rejection class="^QOpenGL.*$" argument-type="^GLubyte( const)?\*$"/>
+ <rejection class="^QOpenGL.*$" argument-type="^(const )?QMatrix.x. ?\*$"/>
+ <rejection class="^QOpenGL.*$" argument-type="qopengl_GLintptr"/>
+ <rejection class="^QOpenGL.*$" argument-type="qopengl_GLsizeiptr"/>
+ <rejection class="^QOpenGL.*$" argument-type="QOpenGLTextureHelper*"/>
+ <rejection class="^QOpenGL.*$" argument-type="^(const )?QVector.D ?\*$"/>
+ <rejection class="^QOpenGL.*$" argument-type="^(const )?void ?\*\*$"/>
+
+ <object-type name="QOpenGLBuffer" since="5.0">
+ <enum-type name="Access"/>
+ <enum-type name="RangeAccessFlag" flags="RangeAccessFlags"/>
+ <enum-type name="Type"/>
+ <enum-type name="UsagePattern"/>
+ </object-type>
+ <object-type name="QOpenGLDebugLogger" since="5.1">
+ <enum-type name="LoggingMode"/>
</object-type>
- <object-type name="QGLFramebufferObject">
+ <value-type name="QOpenGLDebugMessage" since="5.1">
+ <enum-type name="Source" flags="Sources"/>
+ <enum-type name="Type" flags="Types"/>
+ <enum-type name="Severity" flags="Severities"/>
+ </value-type>
+ <object-type name="QOpenGLFramebufferObject" since="5.0">
<enum-type name="Attachment"/>
+ <enum-type name="FramebufferRestorePolicy" since="5.7"/>
</object-type>
- <object-type name="QGLPixelBuffer">
- <extra-includes>
- <include file-name="QImage" location="global"/>
- </extra-includes>
+ <value-type name="QOpenGLFramebufferObjectFormat"/>
+ <object-type name="QAbstractOpenGLFunctions" since="5.1"/>
+ <value-type name="QOpenGLPixelTransferOptions"/>
+ <object-type name="QOpenGLShader" since="5.0">
+ <enum-type name="ShaderTypeBit" flags="ShaderType"/>
</object-type>
- <object-type name="QGLWidget">
- <extra-includes>
- <include file-name="QImage" location="global"/>
- <include file-name="QPixmap" location="global"/>
- </extra-includes>
- <modify-function signature="QGLWidget(QGLContext*,QWidget*,const QGLWidget*,QFlags&lt;Qt::WindowType&gt;)">
- <modify-argument index="1">
- <parent index="this" action="add"/>
- </modify-argument>
- <modify-argument index="this">
- <parent index="2" action="add"/>
- </modify-argument>
- </modify-function>
- <!-- ### Not part of Qt public API -->
- <modify-function signature="setContext(QGLContext*,const QGLContext*,bool)" remove="all"/>
- <!-- ### -->
- <!--- ### Obsolete functions -->
- <modify-function signature="setFormat(QGLFormat)" remove="all"/>
- <!-- ### -->
+ <object-type name="QOpenGLShaderProgram" since="5.0">
+ <modify-function signature="setAttributeArray(int,const float*,int,int)">
+ <modify-argument index="2"><array/></modify-argument>
+ </modify-function>
+ <modify-function signature="setAttributeArray(const char*,const float*,int,int)">
+ <modify-argument index="2"><array/></modify-argument>
+ </modify-function>
+ <modify-function signature="setAttributeArray(int,const float*,int,int)">
+ <modify-argument index="2"><array/></modify-argument>
+ </modify-function>
+ <modify-function signature="setAttributeValue(int,const float*,int,int)">
+ <modify-argument index="2"><array/></modify-argument>
+ </modify-function>
+ <modify-function signature="setAttributeValue(const char*,const float*,int,int)">
+ <modify-argument index="2"><array/></modify-argument>
+ </modify-function>
+ <modify-function signature="setUniformValueArray(int,const float*,int,int)">
+ <modify-argument index="2"><array/></modify-argument>
+ </modify-function>
+ <modify-function signature="setUniformValueArray(int,const int*,int)">
+ <modify-argument index="2"><array/></modify-argument>
+ </modify-function>
+ <modify-function signature="setUniformValueArray(int,const unsigned int*,int)">
+ <modify-argument index="2"><array/></modify-argument>
+ </modify-function>
+ <modify-function signature="setUniformValueArray(const char*,const float*,int,int)">
+ <modify-argument index="2"><array/></modify-argument>
+ </modify-function>
+ <modify-function signature="setUniformValueArray(const char*,const int*,int)">
+ <modify-argument index="2"><array/></modify-argument>
+ </modify-function>
+ <modify-function signature="setUniformValueArray(const char*,const unsigned int*,int)">
+ <modify-argument index="2"><array/></modify-argument>
+ </modify-function>
+ <!-- Add explicit signatures for the setUniformValue functions -->
+ <modify-function signature="^setUniformValue\(const char\*,(float|int|uint)\)$" remove="all"/>
+ <!-- No need for a signature for GLuint, since Qt (internally) calls the same function: glUniform1i -->
+ <add-function signature="setUniformValue1f(const char*, float)" return-type="void">
+ <inject-code file="../glue/qtgui.cpp" snippet="qopenglshaderprogram_setuniformvalue_float"/>
+ </add-function>
+ <add-function signature="setUniformValue1i(const char*, int)" return-type="void">
+ <inject-code file="../glue/qtgui.cpp" snippet="qopenglshaderprogram_setuniformvalue_int"/>
+ </add-function>
+ <add-function signature="setUniformValue1f(int, float)" return-type="void">
+ <inject-code file="../glue/qtgui.cpp" snippet="qopenglshaderprogram_setuniformvalue_float"/>
+ </add-function>
+ <add-function signature="setUniformValue1i(int, int)" return-type="void">
+ <inject-code file="../glue/qtgui.cpp" snippet="qopenglshaderprogram_setuniformvalue_int"/>
+ </add-function>
</object-type>
-
- <value-type name="QGLFramebufferObjectFormat" since="4.6"/>
- <object-type name="QGLShader" since="4.6">
- <enum-type name="ShaderTypeBit" flags="ShaderType"/>
+ <object-type name="QOpenGLTexture" since="5.2">
+ <enum-type name="BindingTarget"/>
+ <enum-type name="CoordinateDirection"/>
+ <enum-type name="ComparisonFunction"/>
+ <enum-type name="ComparisonMode"/>
+ <enum-type name="CubeMapFace"/>
+ <enum-type name="DepthStencilMode"/>
+ <enum-type name="Feature" flags="Features"/>
+ <enum-type name="Filter"/>
+ <enum-type name="MipMapGeneration"/>
+ <enum-type name="PixelFormat"/>
+ <enum-type name="PixelType"/>
+ <enum-type name="SwizzleComponent"/>
+ <enum-type name="SwizzleValue"/>
+ <enum-type name="Target"/>
+ <enum-type name="TextureFormat"/>
+ <enum-type name="TextureFormatClass"/>
+ <enum-type name="TextureUnitReset"/>
+ <enum-type name="WrapMode"/>
+ <modify-function signature="borderColor(unsigned int*)const" remove="all"/>
+ <modify-function signature="borderColor(int*)const" remove="all"/>
+ <modify-function signature="borderColor(float*)const" remove="all"/>
</object-type>
-
- <object-type name="QGLShaderProgram" since="4.6">
- <!-- setAttributeArray -->
- <modify-function signature="setAttributeArray(int,const QVector2D*,int)" rename="setAttributeArray2D">
- <modify-argument index="2" >
- <replace-type modified-type="PySequence"/>
- </modify-argument>
- <inject-code>
- <insert-template name="callArrayFunction">
- <replace from="$ARG0" to="%3"/>
- <replace from="$ARG1" to="%3"/>
- <replace from="$ATTR_TYPE" to="QVector2D"/>
- </insert-template>
- </inject-code>
- </modify-function>
-
- <modify-function signature="setAttributeArray(int,const QVector3D*,int)" rename="setAttributeArray3D">
- <modify-argument index="2" >
- <replace-type modified-type="PySequence"/>
- </modify-argument>
- <inject-code>
- <insert-template name="callArrayFunction">
- <replace from="$ARG0" to="%3"/>
- <replace from="$ARG1" to="%3"/>
- <replace from="$ATTR_TYPE" to="QVector3D"/>
- </insert-template>
- </inject-code>
- </modify-function>
-
- <modify-function signature="setAttributeArray(int,const QVector4D*,int)" rename="setAttributeArray4D">
- <modify-argument index="2" >
- <replace-type modified-type="PySequence"/>
- </modify-argument>
- <inject-code>
- <insert-template name="callArrayFunction">
- <replace from="$ARG0" to="%3"/>
- <replace from="$ARG1" to="%3"/>
- <replace from="$ATTR_TYPE" to="QVector4D"/>
- </insert-template>
- </inject-code>
- </modify-function>
-
- <modify-function signature="setAttributeArray(const char*,const QVector2D*,int)" rename="setAttributeArray2D">
- <modify-argument index="2" >
- <replace-type modified-type="PySequence"/>
- </modify-argument>
- <inject-code>
- <insert-template name="callArrayFunction">
- <replace from="$ARG0" to="%3"/>
- <replace from="$ARG1" to="%3"/>
- <replace from="$ATTR_TYPE" to="QVector2D"/>
- </insert-template>
- </inject-code>
- </modify-function>
-
- <modify-function signature="setAttributeArray(const char*,const QVector3D*,int)" rename="setAttributeArray3D">
- <modify-argument index="2" >
- <replace-type modified-type="PySequence"/>
- </modify-argument>
- <inject-code>
- <insert-template name="callArrayFunction">
- <replace from="$ARG0" to="%3"/>
- <replace from="$ARG1" to="%3"/>
- <replace from="$ATTR_TYPE" to="QVector3D"/>
- </insert-template>
- </inject-code>
- </modify-function>
-
- <modify-function signature="setAttributeArray(const char*,const QVector4D*,int)" rename="setAttributeArray4D">
- <modify-argument index="2" >
- <replace-type modified-type="PySequence"/>
- </modify-argument>
- <inject-code>
- <insert-template name="callArrayFunction">
- <replace from="$ARG0" to="%3"/>
- <replace from="$ARG1" to="%3"/>
- <replace from="$ATTR_TYPE" to="QVector4D"/>
- </insert-template>
- </inject-code>
- </modify-function>
-
- <!-- setUniformValueArray -->
- <modify-function signature="setUniformValueArray(int,const GLint*,int)" rename="setUniformValueArrayInt">
- <modify-argument index="2" >
- <replace-type modified-type="PySequence"/>
- <array/>
- </modify-argument>
- <modify-argument index="3">
- <remove-argument />
- </modify-argument>
- <inject-code>
- <insert-template name="callArrayFunction">
- <replace from="$ARG0" to="_size"/>
- <replace from="$ARG1" to="0"/>
- <replace from="$ATTR_TYPE" to="GLint"/>
- </insert-template>
- </inject-code>
- </modify-function>
-
- <modify-function signature="setUniformValueArray(int,const GLuint*,int)" rename="setUniformValueArrayUint">
- <modify-argument index="2" >
- <replace-type modified-type="PySequence"/>
- <array/>
- </modify-argument>
- <modify-argument index="3">
- <remove-argument />
- </modify-argument>
- <inject-code>
- <insert-template name="callArrayFunction">
- <replace from="$ARG0" to="_size"/>
- <replace from="$ARG1" to="0"/>
- <replace from="$ATTR_TYPE" to="GLuint"/>
- </insert-template>
- </inject-code>
- </modify-function>
-
- <modify-function signature="setUniformValueArray(int,const QVector2D*,int)" rename="setUniformValueArray2D">
- <modify-argument index="2" >
- <replace-type modified-type="PySequence"/>
- </modify-argument>
- <modify-argument index="3">
- <remove-argument />
- </modify-argument>
- <inject-code>
- <insert-template name="callArrayFunction">
- <replace from="$ARG0" to="_size"/>
- <replace from="$ARG1" to="0"/>
- <replace from="$ATTR_TYPE" to="QVector2D"/>
- </insert-template>
- </inject-code>
- </modify-function>
-
- <modify-function signature="setUniformValueArray(int,const QVector3D*,int)" rename="setUniformValueArray3D">
- <modify-argument index="2" >
- <replace-type modified-type="PySequence"/>
- </modify-argument>
- <modify-argument index="3">
- <remove-argument />
- </modify-argument>
- <inject-code>
- <insert-template name="callArrayFunction">
- <replace from="$ARG0" to="_size"/>
- <replace from="$ARG1" to="0"/>
- <replace from="$ATTR_TYPE" to="QVector3D"/>
- </insert-template>
- </inject-code>
- </modify-function>
-
- <modify-function signature="setUniformValueArray(int,const QVector4D*,int)" rename="setUniformValueArray4D">
- <modify-argument index="2" >
- <replace-type modified-type="PySequence"/>
- </modify-argument>
- <modify-argument index="3">
- <remove-argument />
- </modify-argument>
- <inject-code>
- <insert-template name="callArrayFunction">
- <replace from="$ARG0" to="_size"/>
- <replace from="$ARG1" to="0"/>
- <replace from="$ATTR_TYPE" to="QVector4D"/>
- </insert-template>
- </inject-code>
- </modify-function>
-
- <modify-function signature="setUniformValueArray(int,const QMatrix2x2*,int)" rename="setUniformValueArray2x2">
- <modify-argument index="2" >
- <replace-type modified-type="PySequence"/>
- </modify-argument>
- <modify-argument index="3">
- <remove-argument />
- </modify-argument>
- <inject-code>
- <insert-template name="callArrayFunction">
- <replace from="$ARG0" to="_size"/>
- <replace from="$ARG1" to="0"/>
- <replace from="$ATTR_TYPE" to="QMatrix2x2"/>
- </insert-template>
- </inject-code>
- </modify-function>
-
- <modify-function signature="setUniformValueArray(int,const QMatrix2x3*,int)" rename="setUniformValueArray2x3">
- <modify-argument index="2" >
- <replace-type modified-type="PySequence"/>
- </modify-argument>
- <modify-argument index="3">
- <remove-argument />
- </modify-argument>
- <inject-code>
- <insert-template name="callArrayFunction">
- <replace from="$ARG0" to="_size"/>
- <replace from="$ARG1" to="0"/>
- <replace from="$ATTR_TYPE" to="QMatrix2x3"/>
- </insert-template>
- </inject-code>
- </modify-function>
-
- <modify-function signature="setUniformValueArray(int,const QMatrix2x4*,int)" rename="setUniformValueArray2x4">
- <modify-argument index="2" >
- <replace-type modified-type="PySequence"/>
- </modify-argument>
- <modify-argument index="3">
- <remove-argument />
- </modify-argument>
- <inject-code>
- <insert-template name="callArrayFunction">
- <replace from="$ARG0" to="_size"/>
- <replace from="$ARG1" to="0"/>
- <replace from="$ATTR_TYPE" to="QMatrix2x4"/>
- </insert-template>
- </inject-code>
- </modify-function>
-
- <modify-function signature="setUniformValueArray(int,const QMatrix3x2*,int)" rename="setUniformValueArray3x2">
- <modify-argument index="2" >
- <replace-type modified-type="PySequence"/>
- </modify-argument>
- <modify-argument index="3">
- <remove-argument />
- </modify-argument>
- <inject-code>
- <insert-template name="callArrayFunction">
- <replace from="$ARG0" to="_size"/>
- <replace from="$ARG1" to="0"/>
- <replace from="$ATTR_TYPE" to="QMatrix3x2"/>
- </insert-template>
- </inject-code>
- </modify-function>
-
- <modify-function signature="setUniformValueArray(int,const QMatrix3x3*,int)" rename="setUniformValueArray3x3">
- <modify-argument index="2" >
- <replace-type modified-type="PySequence"/>
- </modify-argument>
- <modify-argument index="3">
- <remove-argument />
- </modify-argument>
- <inject-code>
- <insert-template name="callArrayFunction">
- <replace from="$ARG0" to="_size"/>
- <replace from="$ARG1" to="0"/>
- <replace from="$ATTR_TYPE" to="QMatrix3x3"/>
- </insert-template>
- </inject-code>
- </modify-function>
-
- <modify-function signature="setUniformValueArray(int,const QMatrix3x4*,int)" rename="setUniformValueArray3x4">
- <modify-argument index="2" >
- <replace-type modified-type="PySequence"/>
- </modify-argument>
- <modify-argument index="3">
- <remove-argument />
- </modify-argument>
- <inject-code>
- <insert-template name="callArrayFunction">
- <replace from="$ARG0" to="_size"/>
- <replace from="$ARG1" to="0"/>
- <replace from="$ATTR_TYPE" to="QMatrix3x4"/>
- </insert-template>
- </inject-code>
- </modify-function>
-
- <modify-function signature="setUniformValueArray(int,const QMatrix4x2*,int)" rename="setUniformValueArray4x2">
- <modify-argument index="2" >
- <replace-type modified-type="PySequence"/>
- </modify-argument>
- <modify-argument index="3">
- <remove-argument />
- </modify-argument>
- <inject-code>
- <insert-template name="callArrayFunction">
- <replace from="$ARG0" to="_size"/>
- <replace from="$ARG1" to="0"/>
- <replace from="$ATTR_TYPE" to="QMatrix4x2"/>
- </insert-template>
- </inject-code>
- </modify-function>
-
- <modify-function signature="setUniformValueArray(int,const QMatrix4x3*,int)" rename="setUniformValueArray4x3">
- <modify-argument index="2" >
- <replace-type modified-type="PySequence"/>
- </modify-argument>
- <modify-argument index="3">
- <remove-argument />
- </modify-argument>
- <inject-code>
- <insert-template name="callArrayFunction">
- <replace from="$ARG0" to="_size"/>
- <replace from="$ARG1" to="0"/>
- <replace from="$ATTR_TYPE" to="QMatrix4x3"/>
- </insert-template>
- </inject-code>
- </modify-function>
-
- <modify-function signature="setUniformValueArray(int,const QMatrix4x4*,int)" rename="setUniformValueArray4x4">
- <modify-argument index="2" >
- <replace-type modified-type="PySequence"/>
- </modify-argument>
- <modify-argument index="3">
- <remove-argument />
- </modify-argument>
- <inject-code>
- <insert-template name="callArrayFunction">
- <replace from="$ARG0" to="_size"/>
- <replace from="$ARG1" to="0"/>
- <replace from="$ATTR_TYPE" to="QMatrix4x4"/>
- </insert-template>
- </inject-code>
- </modify-function>
-
- <modify-function signature="setUniformValueArray(const char*,const GLint*,int)" rename="setUniformValueArrayInt">
- <modify-argument index="2" >
- <replace-type modified-type="PySequence"/>
- <array/>
- </modify-argument>
- <modify-argument index="3">
- <remove-argument />
- </modify-argument>
- <inject-code>
- <insert-template name="callArrayFunction">
- <replace from="$ARG0" to="_size"/>
- <replace from="$ARG1" to="0"/>
- <replace from="$ATTR_TYPE" to="GLint"/>
- </insert-template>
- </inject-code>
- </modify-function>
-
- <modify-function signature="setUniformValueArray(const char*,const GLuint*,int)" rename="setUniformValueArrayUint">
- <modify-argument index="2" >
- <replace-type modified-type="PySequence"/>
- <array/>
- </modify-argument>
- <modify-argument index="3">
- <remove-argument />
- </modify-argument>
- <inject-code>
- <insert-template name="callArrayFunction">
- <replace from="$ARG0" to="_size"/>
- <replace from="$ARG1" to="0"/>
- <replace from="$ATTR_TYPE" to="GLuint"/>
- </insert-template>
- </inject-code>
- </modify-function>
-
- <modify-function signature="setUniformValueArray(const char*,const QVector2D*,int)" rename="setUniformValueArray2D">
- <modify-argument index="2" >
- <replace-type modified-type="PySequence"/>
- </modify-argument>
- <modify-argument index="3">
- <remove-argument />
- </modify-argument>
- <inject-code>
- <insert-template name="callArrayFunction">
- <replace from="$ARG0" to="_size"/>
- <replace from="$ARG1" to="0"/>
- <replace from="$ATTR_TYPE" to="QVector2D"/>
- </insert-template>
- </inject-code>
- </modify-function>
-
- <modify-function signature="setUniformValueArray(const char*,const QVector3D*,int)" rename="setUniformValueArray3D">
- <modify-argument index="2" >
- <replace-type modified-type="PySequence"/>
- </modify-argument>
- <modify-argument index="3">
- <remove-argument />
- </modify-argument>
- <inject-code>
- <insert-template name="callArrayFunction">
- <replace from="$ARG0" to="_size"/>
- <replace from="$ARG1" to="0"/>
- <replace from="$ATTR_TYPE" to="QVector3D"/>
- </insert-template>
- </inject-code>
- </modify-function>
-
- <modify-function signature="setUniformValueArray(const char*,const QVector4D*,int)" rename="setUniformValueArray4D">
- <modify-argument index="2" >
- <replace-type modified-type="PySequence"/>
- </modify-argument>
- <modify-argument index="3">
- <remove-argument />
- </modify-argument>
- <inject-code>
- <insert-template name="callArrayFunction">
- <replace from="$ARG0" to="_size"/>
- <replace from="$ARG1" to="0"/>
- <replace from="$ATTR_TYPE" to="QVector4D"/>
- </insert-template>
- </inject-code>
- </modify-function>
-
- <modify-function signature="setUniformValueArray(const char*,const QMatrix2x2*,int)" rename="setUniformValueArray2x2">
- <modify-argument index="2" >
- <replace-type modified-type="PySequence"/>
- </modify-argument>
- <modify-argument index="3">
- <remove-argument />
- </modify-argument>
- <inject-code>
- <insert-template name="callArrayFunction">
- <replace from="$ARG0" to="_size"/>
- <replace from="$ARG1" to="0"/>
- <replace from="$ATTR_TYPE" to="QMatrix2x2"/>
- </insert-template>
- </inject-code>
- </modify-function>
-
- <modify-function signature="setUniformValueArray(const char*,const QMatrix2x3*,int)" rename="setUniformValueArray2x3">
- <modify-argument index="2" >
- <replace-type modified-type="PySequence"/>
- </modify-argument>
- <modify-argument index="3">
- <remove-argument />
- </modify-argument>
- <inject-code>
- <insert-template name="callArrayFunction">
- <replace from="$ARG0" to="_size"/>
- <replace from="$ARG1" to="0"/>
- <replace from="$ATTR_TYPE" to="QMatrix2x3"/>
- </insert-template>
- </inject-code>
- </modify-function>
-
- <modify-function signature="setUniformValueArray(const char*,const QMatrix2x4*,int)" rename="setUniformValueArray2x4">
- <modify-argument index="2" >
- <replace-type modified-type="PySequence"/>
- </modify-argument>
- <modify-argument index="3">
- <remove-argument />
- </modify-argument>
- <inject-code>
- <insert-template name="callArrayFunction">
- <replace from="$ARG0" to="_size"/>
- <replace from="$ARG1" to="0"/>
- <replace from="$ATTR_TYPE" to="QMatrix2x4"/>
- </insert-template>
- </inject-code>
- </modify-function>
-
- <modify-function signature="setUniformValueArray(const char*,const QMatrix3x2*,int)" rename="setUniformValueArray3x2">
- <modify-argument index="2" >
- <replace-type modified-type="PySequence"/>
- </modify-argument>
- <modify-argument index="3">
- <remove-argument />
- </modify-argument>
- <inject-code>
- <insert-template name="callArrayFunction">
- <replace from="$ARG0" to="_size"/>
- <replace from="$ARG1" to="0"/>
- <replace from="$ATTR_TYPE" to="QMatrix3x2"/>
- </insert-template>
- </inject-code>
- </modify-function>
-
- <modify-function signature="setUniformValueArray(const char*,const QMatrix3x3*,int)" rename="setUniformValueArray3x3">
- <modify-argument index="2" >
- <replace-type modified-type="PySequence"/>
- </modify-argument>
- <modify-argument index="3">
- <remove-argument />
- </modify-argument>
- <inject-code>
- <insert-template name="callArrayFunction">
- <replace from="$ARG0" to="_size"/>
- <replace from="$ARG1" to="0"/>
- <replace from="$ATTR_TYPE" to="QMatrix3x3"/>
- </insert-template>
- </inject-code>
- </modify-function>
-
- <modify-function signature="setUniformValueArray(const char*,const QMatrix3x4*,int)" rename="setUniformValueArray3x4">
- <modify-argument index="2" >
- <replace-type modified-type="PySequence"/>
- </modify-argument>
- <modify-argument index="3">
- <remove-argument />
- </modify-argument>
- <inject-code>
- <insert-template name="callArrayFunction">
- <replace from="$ARG0" to="_size"/>
- <replace from="$ARG1" to="0"/>
- <replace from="$ATTR_TYPE" to="QMatrix3x4"/>
- </insert-template>
- </inject-code>
- </modify-function>
-
- <modify-function signature="setUniformValueArray(const char*,const QMatrix4x2*,int)" rename="setUniformValueArray4x2">
- <modify-argument index="2" >
- <replace-type modified-type="PySequence"/>
- </modify-argument>
- <modify-argument index="3">
- <remove-argument />
- </modify-argument>
- <inject-code>
- <insert-template name="callArrayFunction">
- <replace from="$ARG0" to="_size"/>
- <replace from="$ARG1" to="0"/>
- <replace from="$ATTR_TYPE" to="QMatrix4x2"/>
- </insert-template>
- </inject-code>
- </modify-function>
-
- <modify-function signature="setUniformValueArray(const char*,const QMatrix4x3*,int)" rename="setUniformValueArray4x3">
- <modify-argument index="2" >
- <replace-type modified-type="PySequence"/>
- </modify-argument>
- <modify-argument index="3">
- <remove-argument />
- </modify-argument>
- <inject-code>
- <insert-template name="callArrayFunction">
- <replace from="$ARG0" to="_size"/>
- <replace from="$ARG1" to="0"/>
- <replace from="$ATTR_TYPE" to="QMatrix4x3"/>
- </insert-template>
- </inject-code>
- </modify-function>
-
- <modify-function signature="setUniformValueArray(const char*,const QMatrix4x4*,int)" rename="setUniformValueArray4x4">
- <modify-argument index="2" >
- <replace-type modified-type="PySequence"/>
- </modify-argument>
- <modify-argument index="3">
- <remove-argument />
- </modify-argument>
- <inject-code>
- <insert-template name="callArrayFunction">
- <replace from="$ARG0" to="_size"/>
- <replace from="$ARG1" to="0"/>
- <replace from="$ATTR_TYPE" to="QMatrix4x4"/>
- </insert-template>
- </inject-code>
- </modify-function>
-
- <!-- ### Use QMatrixZxY overloads -->
- <modify-function signature="setAttributeArray(int,GLenum,const void*,int,int)" remove="all" since="4.7"/>
- <modify-function signature="setAttributeArray(const char*,GLenum,const void*,int,int)" remove="all" since="4.7"/>
- <!-- ### -->
+ <object-type name="QOpenGLTextureBlitter">
+ <enum-type name="Origin"/>
</object-type>
-
- <!-- Qt 4.7 -->
- <object-type name="QGLBuffer" since="4.7">
- <enum-type name="Access" since="4.7"/>
- <enum-type name="Type" since="4.7"/>
- <enum-type name="UsagePattern" since="4.7"/>
- <modify-function signature="allocate(const void*,int)">
- <modify-argument index="1">
- <replace-type modified-type="QByteArray&amp;"/>
- </modify-argument>
- <modify-argument index="2">
- <replace-default-expression with="-1"/>
- </modify-argument>
- <inject-code class="target" position="beginning" file="../glue/qtopengl.cpp" snippet="qglbuffer-allocate"/>
- </modify-function>
- <modify-function signature="map(QGLBuffer::Access)">
- <inject-code file="../glue/qtopengl.cpp" snippet="qglbuffer-map"/>
- </modify-function>
- <modify-function signature="read(int,void*,int)">
- <modify-argument index="2">
- <remove-argument/>
- </modify-argument>
- <modify-argument index="return">
- <replace-type modified-type="(retval, data)"/>
- </modify-argument>
- <inject-code class="target" position="beginning" file="../glue/qtopengl.cpp" snippet="qglbuffer-read"/>
- </modify-function>
- <modify-function signature="write(int,const void*,int)">
- <modify-argument index="2">
- <replace-type modified-type="QByteArray&amp;"/>
- </modify-argument>
- <modify-argument index="3">
- <replace-default-expression with="-1"/>
- </modify-argument>
- <inject-code class="target" position="beginning" file="../glue/qtopengl.cpp" snippet="qglbuffer-write"/>
- </modify-function>
+ <object-type name="QOpenGLTimeMonitor" since="5.1"/>
+ <object-type name="QOpenGLTimerQuery" since="5.1"/>
+ <object-type name="QOpenGLWindow" since="5.4">
+ <enum-type name="UpdateBehavior"/>
+ </object-type>
+ <value-type name="QOpenGLVersionProfile" since="5.1"/>
+ <object-type name="QOpenGLVertexArrayObject">
+ <object-type name="Binder"/>
</object-type>
</typesystem>
diff --git a/sources/pyside2/PySide2/QtOpenGLFunctions/CMakeLists.txt b/sources/pyside2/PySide2/QtOpenGLFunctions/CMakeLists.txt
index eab543b6..fcda32a1 100644
--- a/sources/pyside2/PySide2/QtOpenGLFunctions/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtOpenGLFunctions/CMakeLists.txt
@@ -1,17 +1,15 @@
project(QtOpenGLFunctions)
-set(QtOpenGLFunctions_DROPPED_ENTRIES)
-
get_property(QtOpenGLFunctions_enabled_features TARGET Qt${QT_MAJOR_VERSION}::Gui
- PROPERTY INTERFACE_QT_ENABLED_FEATURES)
+ PROPERTY QT_ENABLED_PUBLIC_FEATURES)
set(QtOpenGLFunctions_SRC ${QtOpenGLFunctions_GEN_DIR}/qtopenglfunctions_module_wrapper.cpp)
-# cf qtbase/src/gui/opengl/opengl.pri
-list(FIND QtOpenGLFunctions_enabled_features "opengles2" _opengles2Index)
-# ### fixme: For cmake >= 3.3: if(opengles2 IN_LIST QtOpenGLFunctions_enabled_features)
-if(_opengles2Index GREATER -1)
- list(APPEND QtOpenGLFunctions_DROPPED_ENTRIES QOpenGLTimeMonitor QOpenGLTimerQuery)
+get_property(QtGui_enabled_features TARGET Qt${QT_MAJOR_VERSION}::Gui
+ PROPERTY QT_ENABLED_PUBLIC_FEATURES)
+
+cmake_policy(SET CMP0057 NEW)
+if("opengles2" IN_LIST QtGui_enabled_features)
list(APPEND QtOpenGLFunctions_SRC
${QtOpenGLFunctions_GEN_DIR}/qopenglfunctions_es2_wrapper.cpp)
message(STATUS "Qt${QT_MAJOR_VERSION}OpenGLFunctions: Dropping Desktop OpenGL classes (GLES2)")
@@ -49,19 +47,23 @@ endif()
configure_file("${QtOpenGLFunctions_SOURCE_DIR}/QtOpenGLFunctions_global.post.h.in"
"${QtOpenGLFunctions_BINARY_DIR}/QtOpenGLFunctions_global.post.h" @ONLY)
-set(QtOpenGLFunctions_include_dirs ${QtGOpenGLFunctions_SOURCE_DIR}
- ${QtOpenGLFunctions_BINARY_DIR}
- ${pyside2_SOURCE_DIR}
- ${Qt${QT_MAJOR_VERSION}Core_INCLUDE_DIRS}
- ${Qt${QT_MAJOR_VERSION}Gui_INCLUDE_DIRS}
- ${libpyside_SOURCE_DIR}
- ${QtCore_GEN_DIR}
- ${QtGui_GEN_DIR}
- )
-set(QtOpenGLFunctions_libraries pyside2
- ${Qt${QT_MAJOR_VERSION}Gui_LIBRARIES})
+set(QtOpenGLFunctions_include_dirs ${QtOpenGLFunctions_SOURCE_DIR}
+ ${QtOpenGLFunctions_BINARY_DIR}
+ ${pyside2_SOURCE_DIR}
+ ${Qt${QT_MAJOR_VERSION}Core_INCLUDE_DIRS}
+ ${Qt${QT_MAJOR_VERSION}Gui_INCLUDE_DIRS}
+ ${Qt${QT_MAJOR_VERSION}OpenGL_INCLUDE_DIRS}
+ ${libpyside_SOURCE_DIR}
+ ${QtCore_GEN_DIR}
+ ${QtGui_GEN_DIR}
+ ${QtOpenGL_GEN_DIR}
+ )
+
+set(QtOpenGLFunctions_libraries pyside2
+ ${Qt${QT_MAJOR_VERSION}Gui_LIBRARIES}
+ ${Qt${QT_MAJOR_VERSION}OpenGL_LIBRARIES})
-set(QtOpenGLFunctions_deps QtGui)
+set(QtOpenGLFunctions_deps QtGui QtOpenGL)
create_pyside_module(NAME QtOpenGLFunctions
INCLUDE_DIRS QtOpenGLFunctions_include_dirs
diff --git a/sources/pyside2/PySide2/QtOpenGLFunctions/QtOpenGLFunctions_global.post.h.in b/sources/pyside2/PySide2/QtOpenGLFunctions/QtOpenGLFunctions_global.post.h.in
index 6c8c7708..c25343e0 100644
--- a/sources/pyside2/PySide2/QtOpenGLFunctions/QtOpenGLFunctions_global.post.h.in
+++ b/sources/pyside2/PySide2/QtOpenGLFunctions/QtOpenGLFunctions_global.post.h.in
@@ -29,33 +29,33 @@
#include <QtGui/qtgui-config.h>
// OpenGL functions are not in the QtGui module header
#if QT_CONFIG(opengl)
-# include <QtGui/qopenglfunctions_1_0.h>
-# include <QtGui/qopenglfunctions_1_1.h>
-# include <QtGui/qopenglfunctions_1_2.h>
-# include <QtGui/qopenglfunctions_1_3.h>
-# include <QtGui/qopenglfunctions_1_4.h>
-# include <QtGui/qopenglfunctions_1_5.h>
-# include <QtGui/qopenglfunctions_2_0.h>
-# include <QtGui/qopenglfunctions_2_1.h>
-# include <QtGui/qopenglfunctions_3_0.h>
-# include <QtGui/qopenglfunctions_3_1.h>
-# include <QtGui/qopenglfunctions_3_2_compatibility.h>
-# include <QtGui/qopenglfunctions_3_2_core.h>
-# include <QtGui/qopenglfunctions_3_3_compatibility.h>
-# include <QtGui/qopenglfunctions_3_3_core.h>
-# include <QtGui/qopenglfunctions_4_0_compatibility.h>
-# include <QtGui/qopenglfunctions_4_0_core.h>
-# include <QtGui/qopenglfunctions_4_1_compatibility.h>
-# include <QtGui/qopenglfunctions_4_1_core.h>
-# include <QtGui/qopenglfunctions_4_2_compatibility.h>
-# include <QtGui/qopenglfunctions_4_2_core.h>
-# include <QtGui/qopenglfunctions_4_3_compatibility.h>
-# include <QtGui/qopenglfunctions_4_3_core.h>
-# include <QtGui/qopenglfunctions_4_4_compatibility.h>
-# include <QtGui/qopenglfunctions_4_4_core.h>
-# include <QtGui/qopenglfunctions_4_5_compatibility.h>
-# include <QtGui/qopenglfunctions_4_5_core.h>
+# include <QtOpenGL/qopenglfunctions_1_0.h>
+# include <QtOpenGL/qopenglfunctions_1_1.h>
+# include <QtOpenGL/qopenglfunctions_1_2.h>
+# include <QtOpenGL/qopenglfunctions_1_3.h>
+# include <QtOpenGL/qopenglfunctions_1_4.h>
+# include <QtOpenGL/qopenglfunctions_1_5.h>
+# include <QtOpenGL/qopenglfunctions_2_0.h>
+# include <QtOpenGL/qopenglfunctions_2_1.h>
+# include <QtOpenGL/qopenglfunctions_3_0.h>
+# include <QtOpenGL/qopenglfunctions_3_1.h>
+# include <QtOpenGL/qopenglfunctions_3_2_compatibility.h>
+# include <QtOpenGL/qopenglfunctions_3_2_core.h>
+# include <QtOpenGL/qopenglfunctions_3_3_compatibility.h>
+# include <QtOpenGL/qopenglfunctions_3_3_core.h>
+# include <QtOpenGL/qopenglfunctions_4_0_compatibility.h>
+# include <QtOpenGL/qopenglfunctions_4_0_core.h>
+# include <QtOpenGL/qopenglfunctions_4_1_compatibility.h>
+# include <QtOpenGL/qopenglfunctions_4_1_core.h>
+# include <QtOpenGL/qopenglfunctions_4_2_compatibility.h>
+# include <QtOpenGL/qopenglfunctions_4_2_core.h>
+# include <QtOpenGL/qopenglfunctions_4_3_compatibility.h>
+# include <QtOpenGL/qopenglfunctions_4_3_core.h>
+# include <QtOpenGL/qopenglfunctions_4_4_compatibility.h>
+# include <QtOpenGL/qopenglfunctions_4_4_core.h>
+# include <QtOpenGL/qopenglfunctions_4_5_compatibility.h>
+# include <QtOpenGL/qopenglfunctions_4_5_core.h>
#endif
#if QT_CONFIG(opengles2)
-# include <QtGui/qopenglfunctions_es2.h>
+# include <QtOpenGL/qopenglfunctions_es2.h>
#endif
diff --git a/sources/pyside2/PySide2/QtOpenGLFunctions/typesystem_openglfunctions.xml b/sources/pyside2/PySide2/QtOpenGLFunctions/typesystem_openglfunctions.xml
index 1d5b08ed..6e4bf800 100644
--- a/sources/pyside2/PySide2/QtOpenGLFunctions/typesystem_openglfunctions.xml
+++ b/sources/pyside2/PySide2/QtOpenGLFunctions/typesystem_openglfunctions.xml
@@ -2,7 +2,7 @@
<!--
/****************************************************************************
**
-** Copyright (C) 2019 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt for Python.
@@ -40,7 +40,7 @@
****************************************************************************/
-->
<typesystem package="PySide2.QtOpenGLFunctions">
- <load-typesystem name="QtGui/typesystem_gui.xml" generate="no"/>
+ <load-typesystem name="QtOpenGL/typesystem_opengl.xml" generate="no"/>
<load-typesystem name="templates/openglfunctions_common.xml" generate="no"/>
<rejection class="^QOpenGL.*$" argument-type="^(const )?GLboolean ?\*$"/>
diff --git a/sources/pyside2/PySide2/QtOpenGLWidgets/CMakeLists.txt b/sources/pyside2/PySide2/QtOpenGLWidgets/CMakeLists.txt
new file mode 100644
index 00000000..694bd7f3
--- /dev/null
+++ b/sources/pyside2/PySide2/QtOpenGLWidgets/CMakeLists.txt
@@ -0,0 +1,34 @@
+project(QtOpenGLWidgets)
+
+set(QtOpenGLWidgets_SRC
+${QtOpenGLWidgets_GEN_DIR}/qopenglwidget_wrapper.cpp
+# module is always needed
+${QtOpenGLWidgets_GEN_DIR}/qtopenglwidgets_module_wrapper.cpp
+)
+
+set(QtOpenGLWidgets_include_dirs ${QtOpenGLWidgets_SOURCE_DIR}
+ ${Qt${QT_MAJOR_VERSION}Core_INCLUDE_DIRS}
+ ${Qt${QT_MAJOR_VERSION}Gui_INCLUDE_DIRS}
+ ${Qt${QT_MAJOR_VERSION}OpenGL_INCLUDE_DIRS}
+ ${Qt${QT_MAJOR_VERSION}Widgets_INCLUDE_DIRS}
+ ${libpyside_SOURCE_DIR}
+ ${QtCore_GEN_DIR}
+ ${QtGui_GEN_DIR}
+ ${QtWidgets_GEN_DIR}
+ ${QtOpenGLWidgets_GEN_DIR})
+
+set(QtOpenGLWidgets_libraries pyside2
+ ${Qt${QT_MAJOR_VERSION}Core_LIBRARIES}
+ ${Qt${QT_MAJOR_VERSION}Gui_LIBRARIES}
+ ${Qt${QT_MAJOR_VERSION}OpenGL_LIBRARIES}
+ ${Qt${QT_MAJOR_VERSION}Widgets_LIBRARIES}
+ ${Qt${QT_MAJOR_VERSION}OpenGLWidgets_LIBRARIES})
+
+set(QtOpenGLWidgets_deps QtOpenGL QtWidgets)
+
+create_pyside_module(NAME QtOpenGLWidgets
+ INCLUDE_DIRS QtOpenGLWidgets_include_dirs
+ LIBRARIES QtOpenGLWidgets_libraries
+ DEPS QtOpenGLWidgets_deps
+ TYPESYSTEM_PATH QtOpenGLWidgets_SOURCE_DIR
+ SOURCES QtOpenGLWidgets_SRC)
diff --git a/sources/pyside2/PySide2/QtWebKit/typesystem_webkit.xml b/sources/pyside2/PySide2/QtOpenGLWidgets/typesystem_openglwidgets.xml
index e92417f2..983fc37f 100644
--- a/sources/pyside2/PySide2/QtWebKit/typesystem_webkit.xml
+++ b/sources/pyside2/PySide2/QtOpenGLWidgets/typesystem_openglwidgets.xml
@@ -2,7 +2,7 @@
<!--
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt for Python.
@@ -39,11 +39,12 @@
**
****************************************************************************/
-->
-<typesystem package="PySide2.QtWebKit">
- <load-typesystem name="QtCore/typesystem_core.xml" generate="no"/>
- <load-typesystem name="QtGui/typesystem_gui.xml" generate="no"/>
- <load-typesystem name="QtNetwork/typesystem_network.xml" generate="no"/>
-
- <namespace-type name="WebCore"/>
+<typesystem package="PySide2.QtOpenGLWidgets">
+ <load-typesystem name="QtCore/typesystem_core.xml" generate="no" />
+ <load-typesystem name="QtGui/typesystem_gui.xml" generate="no" />
+ <load-typesystem name="QtWidgets/typesystem_widgets.xml" generate="no" />
+ <object-type name="QOpenGLWidget">
+ <enum-type name="UpdateBehavior"/>
+ </object-type>
</typesystem>
diff --git a/sources/pyside2/PySide2/QtQml/pysideqmlregistertype.cpp b/sources/pyside2/PySide2/QtQml/pysideqmlregistertype.cpp
index efc86a04..ebc54954 100644
--- a/sources/pyside2/PySide2/QtQml/pysideqmlregistertype.cpp
+++ b/sources/pyside2/PySide2/QtQml/pysideqmlregistertype.cpp
@@ -52,74 +52,34 @@
#include "pyside2_qtcore_python.h"
#include "pyside2_qtqml_python.h"
-#ifndef PYSIDE_MAX_QML_TYPES
-// Maximum number of different Qt QML types the user can export to QML using
-// qmlRegisterType. This limit exists because the QML engine instantiates objects
-// by calling a function with one argument (a void *pointer where the object should
-// be created), and thus does not allow us to choose which object to create. Thus
-// we create a C++ factory function for each new registered type at compile time.
-#define PYSIDE_MAX_QML_TYPES 50
-#endif
+#include <QtQml/QJSValue>
// Forward declarations.
static void propListMetaCall(PySideProperty *pp, PyObject *self, QMetaObject::Call call,
void **args);
-// All registered python types and their creation functions.
-static PyObject *pyTypes[PYSIDE_MAX_QML_TYPES];
-static void (*createFuncs[PYSIDE_MAX_QML_TYPES])(void *);
-
// Mutex used to avoid race condition on PySide::nextQObjectMemoryAddr.
static QMutex nextQmlElementMutex;
-template<int N>
-struct ElementFactoryBase
-{
- static void createInto(void *memory)
- {
- QMutexLocker locker(&nextQmlElementMutex);
- PySide::setNextQObjectMemoryAddr(memory);
- Shiboken::GilState state;
- PyObject *obj = PyObject_CallObject(pyTypes[N], 0);
- if (!obj || PyErr_Occurred())
- PyErr_Print();
- PySide::setNextQObjectMemoryAddr(0);
- }
-};
-
-template<int N>
-struct ElementFactory : ElementFactoryBase<N>
-{
- static void init()
- {
- createFuncs[N] = &ElementFactoryBase<N>::createInto;
- ElementFactory<N-1>::init();
- }
-};
-
-template<>
-struct ElementFactory<0> : ElementFactoryBase<0>
+static void createInto(void *memory, void *type)
{
- static void init()
- {
- createFuncs[0] = &ElementFactoryBase<0>::createInto;
- }
-};
+ QMutexLocker locker(&nextQmlElementMutex);
+ PySide::setNextQObjectMemoryAddr(memory);
+ Shiboken::GilState state;
+ PyObject *obj = PyObject_CallObject(reinterpret_cast<PyObject *>(type), 0);
+ if (!obj || PyErr_Occurred())
+ PyErr_Print();
+ PySide::setNextQObjectMemoryAddr(0);
+}
int PySide::qmlRegisterType(PyObject *pyObj, const char *uri, int versionMajor,
- int versionMinor, const char *qmlName)
+ int versionMinor, const char *qmlName, const char *noCreationReason,
+ bool creatable)
{
using namespace Shiboken;
static PyTypeObject *qobjectType = Shiboken::Conversions::getPythonTypeObject("QObject*");
assert(qobjectType);
- static int nextType = 0;
-
- if (nextType >= PYSIDE_MAX_QML_TYPES) {
- PyErr_Format(PyExc_TypeError, "You can only export %d custom QML types to QML.",
- PYSIDE_MAX_QML_TYPES);
- return -1;
- }
PyTypeObject *pyObjType = reinterpret_cast<PyTypeObject *>(pyObj);
if (!PySequence_Contains(pyObjType->tp_mro, reinterpret_cast<PyObject *>(qobjectType))) {
@@ -132,15 +92,15 @@ int PySide::qmlRegisterType(PyObject *pyObj, const char *uri, int versionMajor,
Q_ASSERT(metaObject);
QQmlPrivate::RegisterType type;
- type.version = 0;
// Allow registering Qt Quick items.
bool registered = false;
#ifdef PYSIDE_QML_SUPPORT
QuickRegisterItemFunction quickRegisterItemFunction = getQuickRegisterItemFunction();
if (quickRegisterItemFunction) {
- registered = quickRegisterItemFunction(pyObj, uri, versionMajor, versionMinor,
- qmlName, &type);
+ registered =
+ quickRegisterItemFunction(pyObj, uri, versionMajor, versionMinor,
+ qmlName, creatable, noCreationReason, &type);
}
#endif
@@ -150,11 +110,11 @@ int PySide::qmlRegisterType(PyObject *pyObj, const char *uri, int versionMajor,
// there's no way to unregister a QML type.
Py_INCREF(pyObj);
- pyTypes[nextType] = pyObj;
+ type.structVersion = 0;
// FIXME: Fix this to assign new type ids each time.
- type.typeId = qMetaTypeId<QObject *>();
- type.listId = qMetaTypeId<QQmlListProperty<QObject> >();
+ type.typeId = QMetaType(QMetaType::QObjectStar);
+ type.listId = QMetaType::fromType<QQmlListProperty<QObject> >();
type.attachedPropertiesFunction = QQmlPrivate::attachedPropertiesFunc<QObject>();
type.attachedPropertiesMetaObject = QQmlPrivate::attachedPropertiesMetaObject<QObject>();
@@ -168,16 +128,16 @@ int PySide::qmlRegisterType(PyObject *pyObj, const char *uri, int versionMajor,
int objectSize = static_cast<int>(PySide::getSizeOfQObject(
reinterpret_cast<SbkObjectType *>(pyObj)));
type.objectSize = objectSize;
- type.create = createFuncs[nextType];
+ type.create = creatable ? createInto : nullptr;
+ type.noCreationReason = noCreationReason;
+ type.userdata = pyObj;
type.uri = uri;
- type.versionMajor = versionMajor;
- type.versionMinor = versionMinor;
+ type.version = QTypeRevision::fromVersion(versionMajor, versionMinor);
type.elementName = qmlName;
type.extensionObjectCreate = 0;
type.extensionMetaObject = 0;
type.customParser = 0;
- ++nextType;
}
type.metaObject = metaObject; // Snapshot may have changed.
@@ -189,6 +149,126 @@ int PySide::qmlRegisterType(PyObject *pyObj, const char *uri, int versionMajor,
return qmlTypeId;
}
+int PySide::qmlRegisterSingletonType(PyObject *pyObj, const char *uri, int versionMajor,
+ int versionMinor, const char *qmlName, PyObject *callback,
+ bool isQObject, bool hasCallback)
+{
+ using namespace Shiboken;
+
+ if (hasCallback) {
+ if (!PyCallable_Check(callback)) {
+ PyErr_Format(PyExc_TypeError, "Invalid callback specified.");
+ return -1;
+ }
+
+ AutoDecRef funcCode(PyObject_GetAttrString(callback, "__code__"));
+ AutoDecRef argCount(PyObject_GetAttrString(funcCode, "co_argcount"));
+
+ int count = PyInt_AsLong(argCount);
+
+ if (count != 1) {
+ PyErr_Format(PyExc_TypeError, "Callback has a bad parameter count.");
+ return -1;
+ }
+
+ // Make sure the callback never gets deallocated
+ Py_INCREF(callback);
+ }
+
+ const QMetaObject *metaObject = nullptr;
+
+ if (isQObject) {
+ static PyTypeObject *qobjectType = Conversions::getPythonTypeObject("QObject*");
+ assert(qobjectType);
+
+ PyTypeObject *pyObjType = reinterpret_cast<PyTypeObject *>(pyObj);
+ if (!PySequence_Contains(pyObjType->tp_mro, reinterpret_cast<PyObject *>(qobjectType))) {
+ PyErr_Format(PyExc_TypeError, "A type inherited from %s expected, got %s.",
+ qobjectType->tp_name, pyObjType->tp_name);
+ return -1;
+ }
+
+ // If we don't have a callback we'll need the pyObj to stay allocated indefinitely
+ if (!hasCallback)
+ Py_INCREF(pyObj);
+
+ metaObject = PySide::retrieveMetaObject(pyObjType);
+ Q_ASSERT(metaObject);
+ }
+
+ QQmlPrivate::RegisterSingletonType type;
+ type.structVersion = 0;
+
+ type.uri = uri;
+ type.version = QTypeRevision::fromVersion(versionMajor, versionMinor);
+ type.typeName = qmlName;
+ type.instanceMetaObject = metaObject;
+
+ if (isQObject) {
+ // FIXME: Fix this to assign new type ids each time.
+ type.typeId = QMetaType(QMetaType::QObjectStar);
+
+ type.qObjectApi =
+ [callback, pyObj, hasCallback](QQmlEngine *engine, QJSEngine *) -> QObject * {
+ AutoDecRef args(PyTuple_New(hasCallback ? 1 : 0));
+
+ if (hasCallback) {
+ PyTuple_SET_ITEM(args, 0, Conversions::pointerToPython(
+ (SbkObjectType *)SbkPySide2_QtQmlTypes[SBK_QQMLENGINE_IDX],
+ engine));
+ }
+
+ AutoDecRef retVal(PyObject_CallObject(hasCallback ? callback : pyObj, args));
+
+ SbkObjectType *qobjectType = (SbkObjectType *)SbkPySide2_QtCoreTypes[SBK_QOBJECT_IDX];
+
+ // Make sure the callback returns something we can convert, else the entire application will crash.
+ if (retVal.isNull() ||
+ Conversions::isPythonToCppPointerConvertible(qobjectType, retVal) == nullptr) {
+ PyErr_Format(PyExc_TypeError, "Callback returns invalid value.");
+ return nullptr;
+ }
+
+ QObject *obj = nullptr;
+ Conversions::pythonToCppPointer(qobjectType, retVal, &obj);
+
+ if (obj != nullptr)
+ Py_INCREF(retVal);
+
+ return obj;
+ };
+ } else {
+ type.scriptApi =
+ [callback](QQmlEngine *engine, QJSEngine *) -> QJSValue {
+ AutoDecRef args(PyTuple_New(1));
+
+ PyTuple_SET_ITEM(args, 0, Conversions::pointerToPython(
+ (SbkObjectType *)SbkPySide2_QtQmlTypes[SBK_QQMLENGINE_IDX],
+ engine));
+
+ AutoDecRef retVal(PyObject_CallObject(callback, args));
+
+ SbkObjectType *qjsvalueType = (SbkObjectType *)SbkPySide2_QtQmlTypes[SBK_QJSVALUE_IDX];
+
+ // Make sure the callback returns something we can convert, else the entire application will crash.
+ if (retVal.isNull() ||
+ Conversions::isPythonToCppPointerConvertible(qjsvalueType, retVal) == nullptr) {
+ PyErr_Format(PyExc_TypeError, "Callback returns invalid value.");
+ return QJSValue(QJSValue::UndefinedValue);
+ }
+
+ QJSValue *val = nullptr;
+ Conversions::pythonToCppPointer(qjsvalueType, retVal, &val);
+
+ Py_INCREF(retVal);
+
+ return *val;
+ };
+ }
+
+ return QQmlPrivate::qmlregister(QQmlPrivate::SingletonRegistration, &type);
+}
+
extern "C"
{
@@ -367,18 +447,23 @@ QtQml_VolatileBoolObject_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
QtQml_VolatileBoolObject *self
= reinterpret_cast<QtQml_VolatileBoolObject *>(type->tp_alloc(type, 0));
- if (self != Q_NULLPTR)
- self->flag = ok;
+ if (self != nullptr)
+ self->flag = new AtomicBool(ok);
return reinterpret_cast<PyObject *>(self);
}
+static void QtQml_VolatileBoolObject_dealloc(PyObject *self)
+{
+ auto volatileBool = reinterpret_cast<QtQml_VolatileBoolObject *>(self);
+ delete volatileBool->flag;
+ Sbk_object_dealloc(self);
+}
+
static PyObject *
QtQml_VolatileBoolObject_get(QtQml_VolatileBoolObject *self)
{
- if (self->flag)
- return Py_True;
- return Py_False;
+ return *self->flag ? Py_True : Py_False;
}
static PyObject *
@@ -397,10 +482,7 @@ QtQml_VolatileBoolObject_set(QtQml_VolatileBoolObject *self, PyObject *args)
return Q_NULLPTR;
}
- if (ok > 0)
- self->flag = true;
- else
- self->flag = false;
+ *self->flag = ok > 0;
Py_RETURN_NONE;
}
@@ -420,7 +502,7 @@ QtQml_VolatileBoolObject_repr(QtQml_VolatileBoolObject *self)
{
PyObject *s;
- if (self->flag)
+ if (*self->flag)
s = PyBytes_FromFormat("%s(True)",
Py_TYPE(self)->tp_name);
else
@@ -435,12 +517,12 @@ QtQml_VolatileBoolObject_str(QtQml_VolatileBoolObject *self)
{
PyObject *s;
- if (self->flag)
+ if (*self->flag)
s = PyBytes_FromFormat("%s(True) -> %p",
- Py_TYPE(self)->tp_name, &(self->flag));
+ Py_TYPE(self)->tp_name, self->flag);
else
s = PyBytes_FromFormat("%s(False) -> %p",
- Py_TYPE(self)->tp_name, &(self->flag));
+ Py_TYPE(self)->tp_name, self->flag);
Py_XINCREF(s);
return s;
}
@@ -450,7 +532,7 @@ static PyType_Slot QtQml_VolatileBoolType_slots[] = {
{Py_tp_str, (void *)reinterpret_cast<reprfunc>(QtQml_VolatileBoolObject_str)},
{Py_tp_methods, (void *)QtQml_VolatileBoolObject_methods},
{Py_tp_new, (void *)QtQml_VolatileBoolObject_new},
- {Py_tp_dealloc, (void *)Sbk_object_dealloc},
+ {Py_tp_dealloc, (void *)QtQml_VolatileBoolObject_dealloc},
{0, 0}
};
static PyType_Spec QtQml_VolatileBoolType_spec = {
@@ -481,8 +563,6 @@ static const char *VolatileBool_SignatureStrings[] = {
void PySide::initQmlSupport(PyObject *module)
{
- ElementFactory<PYSIDE_MAX_QML_TYPES - 1>::init();
-
// Export QmlListProperty type
if (SbkSpecial_Type_Ready(module, PropertyListTypeF(), PropertyList_SignatureStrings) < 0) {
PyErr_Print();
diff --git a/sources/pyside2/PySide2/QtQml/pysideqmlregistertype.h b/sources/pyside2/PySide2/QtQml/pysideqmlregistertype.h
index e94ea043..8ea332f0 100644
--- a/sources/pyside2/PySide2/QtQml/pysideqmlregistertype.h
+++ b/sources/pyside2/PySide2/QtQml/pysideqmlregistertype.h
@@ -42,6 +42,8 @@
#include <sbkpython.h>
+#include <atomic>
+
struct SbkObjectType;
namespace PySide
@@ -68,14 +70,31 @@ void initQmlSupport(PyObject *module);
* \return the metatype id of the registered type.
*/
int qmlRegisterType(PyObject *pyObj, const char *uri, int versionMajor, int versionMinor,
- const char *qmlName);
+ const char *qmlName, const char *noCreationReason = nullptr, bool creatable = true);
+
+/**
+ * PySide implementation of qmlRegisterType<T> function.
+ *
+ * \param pyObj Python type to be registered.
+ * \param uri QML element uri.
+ * \param versionMajor QML component major version.
+ * \param versionMinor QML component minor version.
+ * \param qmlName QML element name
+ * \param callback Registration callback
+ * \return the metatype id of the registered type.
+ */
+int qmlRegisterSingletonType(PyObject *pyObj,const char *uri, int versionMajor, int versionMinor, const char *qmlName,
+ PyObject *callback, bool isQObject, bool hasCallback);
+
}
-// Volatile Bool Ptr type definition.
+// Volatile Bool Ptr type definition for QQmlIncubationController::incubateWhile(std::atomic<bool> *, int)
+
+using AtomicBool = std::atomic<bool>;
typedef struct {
PyObject_HEAD
- volatile bool flag;
+ AtomicBool *flag;
} QtQml_VolatileBoolObject;
PyAPI_FUNC(PyTypeObject *) QtQml_VolatileBoolTypeF(void);
diff --git a/sources/pyside2/PySide2/QtQml/typesystem_qml.xml b/sources/pyside2/PySide2/QtQml/typesystem_qml.xml
index b61b28c0..563d4365 100644
--- a/sources/pyside2/PySide2/QtQml/typesystem_qml.xml
+++ b/sources/pyside2/PySide2/QtQml/typesystem_qml.xml
@@ -54,32 +54,35 @@
in generator tests folder. -->
</primitive-type>
+ <enum-type name="QQmlModuleImportSpecialVersions" since="6.0"/>
+
<!-- For qmlEngine(const QObject*), qmlContext(const QObject*) in qqml.h -->
<namespace-type name="QtQml"/>
- <add-function signature="qmlRegisterType(PyTypeObject,const char*,int,int,const char*)" return-type="int">
- <inject-documentation format="target" mode="append">
- This function registers the Python type in the QML system with the name qmlName, in the library imported from uri having the version number composed from versionMajor and versionMinor.
- Returns the QML type id.
-
- For example, this registers a Python class MySliderItem as a QML type named Slider for version 1.0 of a module called "com.mycompany.qmlcomponents":
-
- ::
+ <!-- expose QQmlIncubationController::incubateWhile() (see
+ QtQml_VolatileBoolTypeF/pysideqmlregistertype.h) -->
+ <namespace-type name="std" generate="no">
+ <value-type name="atomic" generate="no"/>
+ </namespace-type>
- qmlRegisterType(MySliderItem, "com.mycompany.qmlcomponents", 1, 0, "Slider")
-
- Once this is registered, the type can be used in QML by importing the specified module name and version number:
-
- ::
+ <add-function signature="qmlRegisterType(PyTypeObject,const char*,int,int,const char*)" return-type="int">
+ <inject-code class="target" file="../glue/qtqml.cpp" snippet="qmlregistertype"/>
+ </add-function>
- import com.mycompany.qmlcomponents 1.0
+ <add-function signature="qmlRegisterSingletonType(PyTypeObject,const char*,int,int,const char*,PyObject*)" return-type="int">
+ <inject-code class="target" file="../glue/qtqml.cpp" snippet="qmlregistersingletontype_qobject_callback"/>
+ </add-function>
- Slider { ... }
+ <add-function signature="qmlRegisterSingletonType(PyTypeObject,const char*,int,int,const char*)" return-type="int">
+ <inject-code class="target" file="../glue/qtqml.cpp" snippet="qmlregistersingletontype_qobject_nocallback"/>
+ </add-function>
- Note that it's perfectly reasonable for a library to register types to older versions than the actual version of the library. Indeed, it is normal for the new library to allow QML written to previous versions to continue to work, even if more advanced versions of some of its types are available.
- </inject-documentation>
+ <add-function signature="qmlRegisterSingletonType(const char*,int,int,const char*,PyObject*)" return-type="int">
+ <inject-code class="target" file="../glue/qtqml.cpp" snippet="qmlregistersingletontype_qjsvalue"/>
+ </add-function>
- <inject-code class="target" file="../glue/qtqml.cpp" snippet="qmlregistertype"/>
+ <add-function signature="qmlRegisterUncreatableType(PyTypeObject,const char*,int,int,const char*,const char*)" return-type="int">
+ <inject-code class="target" file="../glue/qtqml.cpp" snippet="qmlregisteruncreatabletype"/>
</add-function>
<enum-type identified-by-value="QML_HAS_ATTACHED_PROPERTIES">
@@ -93,6 +96,7 @@
<object-type name="QJSEngine">
<enum-type name="Extension" flags="Extensions" since="5.6"/>
+ <enum-type name="ObjectOwnership" since="6.0"/>
<add-function signature="toScriptValue(const QVariant&amp;)" return-type="QJSValue">
<inject-code class="target" position="end" file="../glue/qtqml.cpp" snippet="qjsengine-toscriptvalue"/>
</add-function>
@@ -116,7 +120,6 @@
<enum-type name="StartMode"/>
</object-type>
<object-type name="QQmlEngine">
- <enum-type name="ObjectOwnership"/>
<modify-function signature="addImageProvider(const QString&amp;,QQmlImageProviderBase*)">
<modify-argument index="2">
<define-ownership owner="c++"/>
@@ -153,14 +156,14 @@
<enum-type name="Status"/>
</object-type>
<object-type name="QQmlIncubationController">
- <modify-function signature="incubateWhile(volatile bool*,int)" allow-thread="yes">
+ <modify-function signature="incubateWhile(std::atomic&lt;bool&gt;*,int)" allow-thread="yes">
<modify-argument index="1">
- <!-- The replace type is needed to use the VolatileBool_Check macro instead of
- a template conversion function with "volatile bool" as argument. -->
+ The replace type is needed to use the VolatileBool_Check macro instead of
+ a template conversion function with "volatile bool" as argument.
<replace-type modified-type="VolatileBool"/>
<conversion-rule class="native">
- volatile bool * %out =
- &amp;((reinterpret_cast&lt;QtQml_VolatileBoolObject *&gt;(%PYARG_1))->flag);
+ auto volatileBool = reinterpret_cast&lt;QtQml_VolatileBoolObject *&gt;(%PYARG_1);
+ std::atomic&lt;bool&gt; *%out = volatileBool->flag;
</conversion-rule>
</modify-argument>
</modify-function>
diff --git a/sources/pyside2/PySide2/QtQuick/CMakeLists.txt b/sources/pyside2/PySide2/QtQuick/CMakeLists.txt
index 0f453c90..25f54679 100644
--- a/sources/pyside2/PySide2/QtQuick/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtQuick/CMakeLists.txt
@@ -3,10 +3,12 @@ project(QtQuick)
set(QtQuick_registerType "${QtQuick_SOURCE_DIR}/pysidequickregistertype.cpp")
set(QtQuick_SRC
+${QtQuick_GEN_DIR}/qquickasyncimageprovider_wrapper.cpp
${QtQuick_GEN_DIR}/qquickframebufferobject_wrapper.cpp
${QtQuick_GEN_DIR}/qquickframebufferobject_renderer_wrapper.cpp
${QtQuick_GEN_DIR}/qquicktexturefactory_wrapper.cpp
${QtQuick_GEN_DIR}/qquickimageprovider_wrapper.cpp
+${QtQuick_GEN_DIR}/qquickimageresponse_wrapper.cpp
${QtQuick_GEN_DIR}/qquicktransform_wrapper.cpp
${QtQuick_GEN_DIR}/qquickitem_wrapper.cpp
${QtQuick_GEN_DIR}/qquickitem_updatepaintnodedata_wrapper.cpp
@@ -17,11 +19,9 @@ ${QtQuick_GEN_DIR}/qquickrendercontrol_wrapper.cpp
${QtQuick_GEN_DIR}/qquicktextdocument_wrapper.cpp
${QtQuick_GEN_DIR}/qquickview_wrapper.cpp
${QtQuick_GEN_DIR}/qquickwindow_wrapper.cpp
-${QtQuick_GEN_DIR}/qsgabstractrenderer_wrapper.cpp
${QtQuick_GEN_DIR}/qsgbasicgeometrynode_wrapper.cpp
${QtQuick_GEN_DIR}/qsgclipnode_wrapper.cpp
${QtQuick_GEN_DIR}/qsgdynamictexture_wrapper.cpp
-${QtQuick_GEN_DIR}/qsgengine_wrapper.cpp
#${QtQuick_GEN_DIR}/qsgflatcolormaterial_wrapper.cpp
${QtQuick_GEN_DIR}/qsggeometry_attribute_wrapper.cpp
${QtQuick_GEN_DIR}/qsggeometry_attributeset_wrapper.cpp
@@ -51,13 +51,6 @@ ${QtQuick_GEN_DIR}/qsgtransformnode_wrapper.cpp
${QtQuick_GEN_DIR}/qtquick_module_wrapper.cpp
)
-if (Qt${QT_MAJOR_VERSION}Quick_VERSION VERSION_GREATER 5.5.1)
- set(QtQuick_SRC ${QtQuick_SRC}
- ${QtQuick_GEN_DIR}/qquickasyncimageprovider_wrapper.cpp
- ${QtQuick_GEN_DIR}/qquickimageresponse_wrapper.cpp
- )
-endif()
-
set(QtQuick_include_dirs ${QtQuick_SOURCE_DIR}
${QtQml_SOURCE_DIR}
${Qt${QT_MAJOR_VERSION}Core_INCLUDE_DIRS}
diff --git a/sources/pyside2/PySide2/QtQuick/pysidequickregistertype.cpp b/sources/pyside2/PySide2/QtQuick/pysidequickregistertype.cpp
index a042ac2c..dc464548 100644
--- a/sources/pyside2/PySide2/QtQuick/pysidequickregistertype.cpp
+++ b/sources/pyside2/PySide2/QtQuick/pysidequickregistertype.cpp
@@ -51,56 +51,19 @@
#include "pyside2_qtquick_python.h"
#include "pyside2_qtqml_python.h"
-#ifndef PYSIDE_MAX_QUICK_TYPES
-// Maximum number of different Qt Quick types the user can export to QML using
-// qmlRegisterType. This limit exists because the QML engine instantiates objects
-// by calling a function with one argument (a void* pointer where the object should
-// be created), and thus does not allow us to choose which object to create. Thus
-// we create a C++ factory function for each new registered type at compile time.
-# define PYSIDE_MAX_QUICK_TYPES 50
-#endif // !PYSIDE_MAX_QUICK_TYPES
-
-// All registered python types and their creation functions.
-static PyObject *pyTypes[PYSIDE_MAX_QUICK_TYPES];
-static void (*createFuncs[PYSIDE_MAX_QUICK_TYPES])(void *);
-
// Mutex used to avoid race condition on PySide::nextQObjectMemoryAddr.
static QMutex nextQmlElementMutex;
-// Python object factory functions.
-template<int N>
-struct ElementFactoryBase
-{
- static void createQuickItem(void *memory)
- {
- QMutexLocker locker(&nextQmlElementMutex);
- PySide::setNextQObjectMemoryAddr(memory);
- Shiboken::GilState state;
- PyObject *obj = PyObject_CallObject(pyTypes[N], 0);
- if (!obj || PyErr_Occurred())
- PyErr_Print();
- PySide::setNextQObjectMemoryAddr(0);
- }
-};
-
-template<int N>
-struct ElementFactory : ElementFactoryBase<N>
-{
- static void init()
- {
- createFuncs[N] = &ElementFactoryBase<N>::createQuickItem;
- ElementFactory<N-1>::init();
- }
-};
-
-template<>
-struct ElementFactory<0> : ElementFactoryBase<0>
+static void createQuickItem(void *memory, void *type)
{
- static void init()
- {
- createFuncs[0] = &ElementFactoryBase<0>::createQuickItem;
- }
-};
+ QMutexLocker locker(&nextQmlElementMutex);
+ PySide::setNextQObjectMemoryAddr(memory);
+ Shiboken::GilState state;
+ PyObject *obj = PyObject_CallObject(reinterpret_cast<PyObject *>(type), 0);
+ if (!obj || PyErr_Occurred())
+ PyErr_Print();
+ PySide::setNextQObjectMemoryAddr(0);
+}
#define PY_REGISTER_IF_INHERITS_FROM(className, typeToRegister,typePointerName, \
typeListName, typeMetaObject, type, registered) \
@@ -117,6 +80,39 @@ bool pyTypeObjectInheritsFromClass(PyTypeObject *pyObjType, QByteArray className
return isDerived;
}
+template <typename T>
+struct QPysideQmlMetaTypeInterface : QtPrivate::QMetaTypeInterface
+{
+ const QByteArray name;
+
+ QPysideQmlMetaTypeInterface(const QByteArray &name, const QMetaObject *metaObject = nullptr)
+ : QMetaTypeInterface {
+ /*.revision=*/ 0,
+ /*.size=*/ sizeof(T),
+ /*.alignment=*/ alignof(T),
+ /*.flags=*/ QtPrivate::QMetaTypeTypeFlags<T>::Flags,
+ /*.metaObject=*/ metaObject,
+ /*.name=*/ name.constData(),
+ /*.typeId=*/ 0,
+ /*.ref=*/ { Q_BASIC_ATOMIC_INITIALIZER(0) },
+ /*.deleteSelf=*/ [](QMetaTypeInterface *self) {
+ delete static_cast<QPysideQmlMetaTypeInterface *>(self);
+ },
+ /*.defaultCtr=*/ [](const QMetaTypeInterface *, void *addr) { new (addr) T(); },
+ /*.copyCtr=*/ [](const QMetaTypeInterface *, void *addr, const void *other) {
+ new (addr) T(*reinterpret_cast<const T *>(other));
+ },
+ /*.moveCtr=*/ [](const QMetaTypeInterface *, void *addr, void *other) {
+ new (addr) T(std::move(*reinterpret_cast<T *>(other)));
+ },
+ /*.dtor=*/ [](const QMetaTypeInterface *, void *addr) {
+ reinterpret_cast<T *>(addr)->~T();
+ },
+ /*.legacyRegisterOp=*/ nullptr
+ }
+ , name(name) {}
+};
+
template <class WrapperClass>
void registerTypeIfInheritsFromClass(
QByteArray className,
@@ -129,40 +125,11 @@ void registerTypeIfInheritsFromClass(
{
bool shouldRegister = !registered && pyTypeObjectInheritsFromClass(typeToRegister, className);
if (shouldRegister) {
- int ptrType =
- QMetaType::registerNormalizedType(
- typePointerName.constData(),
- QtMetaTypePrivate::QMetaTypeFunctionHelper<WrapperClass *>::Destruct,
- QtMetaTypePrivate::QMetaTypeFunctionHelper<WrapperClass *>::Construct,
- sizeof(WrapperClass *),
- static_cast< ::QFlags<QMetaType::TypeFlag> >(QtPrivate::QMetaTypeTypeFlags<
- WrapperClass *>::Flags),
- typeMetaObject);
- if (ptrType == -1) {
- PyErr_Format(PyExc_TypeError, "Meta type registration of \"%s\" for QML usage failed.",
- typePointerName.constData());
- return;
- }
+ QMetaType ptrType(new QPysideQmlMetaTypeInterface<WrapperClass *>(typePointerName, typeMetaObject));
+ QMetaType lstType(new QPysideQmlMetaTypeInterface<QQmlListProperty<WrapperClass>>(typeListName));
- int lstType =
- QMetaType::registerNormalizedType(
- typeListName.constData(),
- QtMetaTypePrivate::QMetaTypeFunctionHelper<QQmlListProperty<WrapperClass> >
- ::Destruct,
- QtMetaTypePrivate::QMetaTypeFunctionHelper<QQmlListProperty<WrapperClass> >
- ::Construct,
- sizeof(QQmlListProperty<WrapperClass>),
- static_cast< ::QFlags<QMetaType::TypeFlag> >(
- QtPrivate::QMetaTypeTypeFlags<QQmlListProperty<WrapperClass> >::Flags),
- nullptr);
- if (lstType == -1) {
- PyErr_Format(PyExc_TypeError, "Meta type registration of \"%s\" for QML usage failed.",
- typeListName.constData());
- return;
- }
-
- type->typeId = ptrType;
- type->listId = lstType;
+ type->typeId = std::move(ptrType);
+ type->listId = std::move(lstType);
type->attachedPropertiesFunction = QQmlPrivate::attachedPropertiesFunc<WrapperClass>();
type->attachedPropertiesMetaObject =
QQmlPrivate::attachedPropertiesMetaObject<WrapperClass>();
@@ -178,16 +145,9 @@ void registerTypeIfInheritsFromClass(
}
bool quickRegisterType(PyObject *pyObj, const char *uri, int versionMajor, int versionMinor,
- const char *qmlName, QQmlPrivate::RegisterType *type)
+ const char *qmlName, bool creatable, const char *noCreationReason, QQmlPrivate::RegisterType *type)
{
using namespace Shiboken;
- static int nextType = 0;
-
- if (nextType >= PYSIDE_MAX_QUICK_TYPES) {
- PyErr_Format(PyExc_TypeError,
- "You can only export %d Qt Quick types to QML.", PYSIDE_MAX_QUICK_TYPES);
- return false;
- }
PyTypeObject *pyObjType = reinterpret_cast<PyTypeObject *>(pyObj);
PyTypeObject *qQuickItemPyType =
@@ -208,8 +168,6 @@ bool quickRegisterType(PyObject *pyObj, const char *uri, int versionMajor, int v
// there's no way to unregister a QML type.
Py_INCREF(pyObj);
- pyTypes[nextType] = pyObj;
-
// Used in macro registration.
QByteArray pointerName(qmlName);
pointerName.append('*');
@@ -227,11 +185,12 @@ bool quickRegisterType(PyObject *pyObj, const char *uri, int versionMajor, int v
if (!registered)
return false;
- type->create = createFuncs[nextType];
- type->version = 0;
+ type->structVersion = 0;
+ type->create = creatable ? createQuickItem : nullptr;
+ type->noCreationReason = noCreationReason;
+ type->userdata = pyObj;
type->uri = uri;
- type->versionMajor = versionMajor;
- type->versionMinor = versionMinor;
+ type->version = QTypeRevision::fromVersion(versionMajor, versionMinor);
type->elementName = qmlName;
type->metaObject = metaObject;
@@ -239,14 +198,12 @@ bool quickRegisterType(PyObject *pyObj, const char *uri, int versionMajor, int v
type->extensionMetaObject = 0;
type->customParser = 0;
- ++nextType;
return true;
}
void PySide::initQuickSupport(PyObject *module)
{
Q_UNUSED(module);
- ElementFactory<PYSIDE_MAX_QUICK_TYPES - 1>::init();
#ifdef PYSIDE_QML_SUPPORT
setQuickRegisterItemFunction(quickRegisterType);
#endif
diff --git a/sources/pyside2/PySide2/QtQuick/typesystem_quick.xml b/sources/pyside2/PySide2/QtQuick/typesystem_quick.xml
index 223eff77..31e05979 100644
--- a/sources/pyside2/PySide2/QtQuick/typesystem_quick.xml
+++ b/sources/pyside2/PySide2/QtQuick/typesystem_quick.xml
@@ -107,16 +107,9 @@
<enum-type name="TextRenderType" since="5.10"/>
</object-type>
- <object-type name="QSGAbstractRenderer">
- <enum-type name="ClearModeBit" flags="ClearMode"/>
- <enum-type name="MatrixTransformFlag" flags="MatrixTransformFlags" since="5.14"/>
- </object-type>
<object-type name="QSGBasicGeometryNode"/>
<object-type name="QSGClipNode"/>
<object-type name="QSGDynamicTexture"/>
- <object-type name="QSGEngine">
- <enum-type name="CreateTextureOption" flags="CreateTextureOptions"/>
- </object-type>
<!-- <object-type name="QSGFlatColorMaterial"/> -->
<object-type name="QSGGeometry">
<enum-type name="DataPattern"/>
diff --git a/sources/pyside2/PySide2/QtSvg/CMakeLists.txt b/sources/pyside2/PySide2/QtSvg/CMakeLists.txt
index 19768274..34f72219 100644
--- a/sources/pyside2/PySide2/QtSvg/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtSvg/CMakeLists.txt
@@ -1,10 +1,8 @@
project(QtSvg)
set(QtSvg_SRC
-${QtSvg_GEN_DIR}/qgraphicssvgitem_wrapper.cpp
${QtSvg_GEN_DIR}/qsvggenerator_wrapper.cpp
${QtSvg_GEN_DIR}/qsvgrenderer_wrapper.cpp
-${QtSvg_GEN_DIR}/qsvgwidget_wrapper.cpp
# module is always needed
${QtSvg_GEN_DIR}/qtsvg_module_wrapper.cpp
)
@@ -13,20 +11,17 @@ set(QtSvg_include_dirs ${QtSvg_SOURCE_DIR}
${QtSvg_BINARY_DIR}
${Qt${QT_MAJOR_VERSION}Core_INCLUDE_DIRS}
${Qt${QT_MAJOR_VERSION}Gui_INCLUDE_DIRS}
- ${Qt${QT_MAJOR_VERSION}Widgets_INCLUDE_DIRS}
${Qt${QT_MAJOR_VERSION}Svg_INCLUDE_DIRS}
${libpyside_SOURCE_DIR}
${QtCore_GEN_DIR}
${QtGui_GEN_DIR}
- ${QtWidgets_GEN_DIR}
)
set(QtSvg_libraries pyside2
${Qt${QT_MAJOR_VERSION}Core_LIBRARIES}
${Qt${QT_MAJOR_VERSION}Gui_LIBRARIES}
- ${Qt${QT_MAJOR_VERSION}Widgets_LIBRARIES}
${Qt${QT_MAJOR_VERSION}Svg_LIBRARIES}
)
-set(QtSvg_deps QtWidgets)
+set(QtSvg_deps QtGui)
create_pyside_module(NAME QtSvg
INCLUDE_DIRS QtSvg_include_dirs
diff --git a/sources/pyside2/PySide2/QtSvg/typesystem_svg.xml b/sources/pyside2/PySide2/QtSvg/typesystem_svg.xml
index 079a79e9..c921c631 100644
--- a/sources/pyside2/PySide2/QtSvg/typesystem_svg.xml
+++ b/sources/pyside2/PySide2/QtSvg/typesystem_svg.xml
@@ -2,7 +2,7 @@
<!--
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt for Python.
@@ -40,10 +40,9 @@
****************************************************************************/
-->
<typesystem package="PySide2.QtSvg">
- <load-typesystem name="QtWidgets/typesystem_widgets.xml" generate="no"/>
+ <load-typesystem name="QtGui/typesystem_gui.xml" generate="no"/>
<object-type name="QSvgRenderer"/>
- <object-type name="QSvgWidget"/>
<object-type name="QSvgGenerator">
<modify-function signature="setOutputDevice(QIODevice*)">
@@ -59,16 +58,4 @@
</modify-function>
</object-type>
- <object-type name="QGraphicsSvgItem">
- <modify-function signature="QGraphicsSvgItem(QGraphicsItem*)">
- <modify-argument index="this">
- <parent index="1" action="add"/>
- </modify-argument>
- </modify-function>
- <modify-function signature="QGraphicsSvgItem(const QString&amp;,QGraphicsItem*)">
- <modify-argument index="this">
- <parent index="2" action="add"/>
- </modify-argument>
- </modify-function>
- </object-type>
</typesystem>
diff --git a/sources/pyside2/PySide2/QtSvgWidgets/CMakeLists.txt b/sources/pyside2/PySide2/QtSvgWidgets/CMakeLists.txt
new file mode 100644
index 00000000..e04d5194
--- /dev/null
+++ b/sources/pyside2/PySide2/QtSvgWidgets/CMakeLists.txt
@@ -0,0 +1,39 @@
+project(QtSvgWidgets)
+
+set(QtSvgWidgets_SRC
+${QtSvgWidgets_GEN_DIR}/qgraphicssvgitem_wrapper.cpp
+${QtSvgWidgets_GEN_DIR}/qsvgwidget_wrapper.cpp
+# module is always needed
+${QtSvgWidgets_GEN_DIR}/qtsvgwidgets_module_wrapper.cpp
+)
+
+set(QtSvgWidgets_include_dirs ${QtSvgWidgets_SOURCE_DIR}
+ ${QtSvgWidgets_BINARY_DIR}
+ ${Qt${QT_MAJOR_VERSION}Core_INCLUDE_DIRS}
+ ${Qt${QT_MAJOR_VERSION}Gui_INCLUDE_DIRS}
+ ${Qt${QT_MAJOR_VERSION}Widgets_INCLUDE_DIRS}
+ ${Qt${QT_MAJOR_VERSION}Svg_INCLUDE_DIRS}
+ ${Qt${QT_MAJOR_VERSION}SvgWidgets_INCLUDE_DIRS}
+ ${libpyside_SOURCE_DIR}
+ ${QtCore_GEN_DIR}
+ ${QtGui_GEN_DIR}
+ ${QtWidgets_GEN_DIR}
+ ${QtSvg_GEN_DIR}
+ )
+
+set(QtSvgWidgets_libraries pyside2
+ ${Qt${QT_MAJOR_VERSION}Core_LIBRARIES}
+ ${Qt${QT_MAJOR_VERSION}Gui_LIBRARIES}
+ ${Qt${QT_MAJOR_VERSION}Widgets_LIBRARIES}
+ ${Qt${QT_MAJOR_VERSION}Svg_LIBRARIES}
+ ${Qt${QT_MAJOR_VERSION}SvgWidgets_LIBRARIES}
+ )
+
+set(QtSvgWidgets_deps QtSvg QtWidgets)
+
+create_pyside_module(NAME QtSvgWidgets
+ INCLUDE_DIRS QtSvgWidgets_include_dirs
+ LIBRARIES QtSvgWidgets_libraries
+ DEPS QtSvgWidgets_deps
+ TYPESYSTEM_PATH QtSvgWidgets_SOURCE_DIR
+ SOURCES QtSvgWidgets_SRC)
diff --git a/sources/pyside2/PySide2/QtSvgWidgets/typesystem_svgwidgets.xml b/sources/pyside2/PySide2/QtSvgWidgets/typesystem_svgwidgets.xml
new file mode 100644
index 00000000..a6aa5b92
--- /dev/null
+++ b/sources/pyside2/PySide2/QtSvgWidgets/typesystem_svgwidgets.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt for Python.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+-->
+<typesystem package="PySide2.QtSvgWidgets">
+ <load-typesystem name="QtSvg/typesystem_svg.xml" generate="no"/>
+ <load-typesystem name="QtWidgets/typesystem_widgets.xml" generate="no"/>
+
+ <object-type name="QSvgWidget"/>
+
+ <object-type name="QGraphicsSvgItem">
+ <modify-function signature="QGraphicsSvgItem(QGraphicsItem*)">
+ <modify-argument index="this">
+ <parent index="1" action="add"/>
+ </modify-argument>
+ </modify-function>
+ <modify-function signature="QGraphicsSvgItem(const QString&amp;,QGraphicsItem*)">
+ <modify-argument index="this">
+ <parent index="2" action="add"/>
+ </modify-argument>
+ </modify-function>
+ </object-type>
+</typesystem>
diff --git a/sources/pyside2/PySide2/QtTest/QtTest_global.pre.h.in b/sources/pyside2/PySide2/QtTest/QtTest_global.pre.h.in
index 65daf1b8..da5534b8 100644
--- a/sources/pyside2/PySide2/QtTest/QtTest_global.pre.h.in
+++ b/sources/pyside2/PySide2/QtTest/QtTest_global.pre.h.in
@@ -1,5 +1,5 @@
// QT_WIDGETS_LIB changes code generation in pysideqtesttouch.h
-#if @Qt5Widgets_FOUND@
+#if @Qt6Widgets_FOUND@
# define QT_WIDGETS_LIB
#endif
diff --git a/sources/pyside2/PySide2/QtTest/typesystem_test.xml b/sources/pyside2/PySide2/QtTest/typesystem_test.xml
index f7facaf7..eb638bef 100644
--- a/sources/pyside2/PySide2/QtTest/typesystem_test.xml
+++ b/sources/pyside2/PySide2/QtTest/typesystem_test.xml
@@ -89,14 +89,14 @@
The problem that costed my days of bug hunting is the fact that shiboken gives
misleading error messages. The messages that I could not get rid of were
- signature 'generateTouchEvent(QWidget*,QTouchDevice*,bool)' for function modification in 'QTest' not found. Possible candidates:
- signature 'generateTouchEvent(QWindow*,QTouchDevice*,bool)' for function modification in 'QTest' not found. Possible candidates:
+ signature 'generateTouchEvent(QWidget*,QInputDevice*,bool)' for function modification in 'QTest' not found. Possible candidates:
+ signature 'generateTouchEvent(QWindow*,QInputDevice*,bool)' for function modification in 'QTest' not found. Possible candidates:
I always thought that for some reason the functions were not recognized, or the arguments somehow
do not match their declaration. Only late in the project, I learnt that also
a simply missing type name in the argument list leads to this message.
- <object-type name="QTouchDevice">
+ <object-type name="QInputDevice">
<enum-type name="CapabilityFlag" flags="Capabilities"/>
<enum-type name="DeviceType"/>
</object-type>
@@ -151,12 +151,12 @@
</modify-argument>
</modify-function>
</object-type>
- <modify-function signature="generateTouchEvent(QWidget*,QTouchDevice*,bool)" rename="touchEvent" since="4.6">
+ <modify-function signature="generateTouchEvent(QWidget*,QPointingDevice*,bool)" rename="touchEvent" since="4.6">
<modify-argument index="return">
<define-ownership class="target" owner="target"/>
</modify-argument>
</modify-function>
- <modify-function signature="generateTouchEvent(QWindow*,QTouchDevice*,bool)" rename="touchEvent" since="4.6">
+ <modify-function signature="generateTouchEvent(QWindow*,QPointingDevice*,bool)" rename="touchEvent" since="4.6">
<modify-argument index="return">
<define-ownership class="target" owner="target"/>
</modify-argument>
diff --git a/sources/pyside2/PySide2/QtUiTools/glue/plugins.h b/sources/pyside2/PySide2/QtUiTools/glue/plugins.h
index 9bfcec6e..402965a8 100644
--- a/sources/pyside2/PySide2/QtUiTools/glue/plugins.h
+++ b/sources/pyside2/PySide2/QtUiTools/glue/plugins.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt for Python.
@@ -40,26 +40,28 @@
#ifndef _PLUGIN_H_
#define _PLUGIN_H_
-#include <QPluginLoader>
#include "customwidgets.h"
-inline void registerCustomWidget(PyObject *obj)
-{
- static PyCustomWidgets *plugin = nullptr;
+#include <QtCore/qpluginloader.h>
- if (plugin == 0) {
- const auto &instances = QPluginLoader::staticInstances();
- for (QObject *o : instances) {
- plugin = qobject_cast<PyCustomWidgets *>(o);
- if (plugin)
- break;
- }
+static inline PyCustomWidgets *findPlugin()
+{
+ const auto &instances = QPluginLoader::staticInstances();
+ for (QObject *o : instances) {
+ if (auto plugin = qobject_cast<PyCustomWidgets *>(o))
+ return plugin;
}
+ return nullptr;
+}
- if (!plugin)
- qDebug() << "Failed to load uiloader plugin.";
- else
+static void registerCustomWidget(PyObject *obj)
+{
+ static PyCustomWidgets *const plugin = findPlugin();
+
+ if (plugin)
plugin->registerWidgetType(obj);
+ else
+ qWarning("Qt for Python: Failed to find the static QUiLoader plugin.");
}
#endif
diff --git a/sources/pyside2/PySide2/QtUiTools/typesystem_uitools.xml b/sources/pyside2/PySide2/QtUiTools/typesystem_uitools.xml
index 2ca12e78..85092a5c 100644
--- a/sources/pyside2/PySide2/QtUiTools/typesystem_uitools.xml
+++ b/sources/pyside2/PySide2/QtUiTools/typesystem_uitools.xml
@@ -146,31 +146,6 @@
Riverbank's PyQt.
-->
<add-function signature="loadUiType(const QString&amp; @uifile@)" return-type="PyObject*">
- <inject-documentation format="target" mode="append">
- This function will allow users to generate and load a `.ui` file at runtime, and it returns
- a `tuple` containing the reference to the Python class, and the base class.
-
- We don't recommend this approach since the workflow should be to generate a Python file
- from the `.ui` file, and then import and load it to use it, but we do understand that
- there are some corner cases when such functionality is required.
-
- The internal process relies on `uic` being in the PATH, which is the same requirement for
- the new `pyside2-uic` to work (which is just a wrapper around `uic -g python`)
-
- A Simple use can be:
-
- .. code-block:: python
-
- from PySide2.QtUiTools import loadUiType
-
- generated_class, base_class = loadUiType("themewidget.ui")
- # the values will be:
- # (&lt;class '__main__.Ui_ThemeWidgetForm'&gt;, &lt;class 'PySide2.QtWidgets.QWidget'&gt;)
-
-
- In that case, `generated_class` will be a reference to the Python class,
- and `base_class` will be a reference to the base class.
- </inject-documentation>
<inject-code file="../glue/qtuitools.cpp" snippet="loaduitype"/>
</add-function>
diff --git a/sources/pyside2/PySide2/QtWebKit/CMakeLists.txt b/sources/pyside2/PySide2/QtWebKit/CMakeLists.txt
deleted file mode 100644
index 4220e46b..00000000
--- a/sources/pyside2/PySide2/QtWebKit/CMakeLists.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-project(QtWebKit)
-
-set(QtWebKit_SRC
-${QtWebKit_GEN_DIR}/webcore_wrapper.cpp
-# module is always needed
-${QtWebKit_GEN_DIR}/qtwebkit_module_wrapper.cpp
-)
-
-set(QtWebKit_include_dirs ${QtWebKit_SOURCE_DIR}
- ${QtWebKit_BINARY_DIR}
- ${Qt${QT_MAJOR_VERSION}Core_INCLUDE_DIRS}
- ${Qt${QT_MAJOR_VERSION}Gui_INCLUDE_DIRS}
- ${Qt${QT_MAJOR_VERSION}Network_INCLUDE_DIRS}
- ${Qt${QT_MAJOR_VERSION}WebKit_INCLUDE_DIRS}
- ${libpyside_SOURCE_DIR}
- ${QtCore_GEN_DIR}
- ${QtGui_GEN_DIR}
- ${QtWidgets_GEN_DIR}
- ${QtNetwork_GEN_DIR}
- )
-set(QtWebKit_libraries pyside2
- ${Qt${QT_MAJOR_VERSION}WebKit_LIBRARIES}
- ${Qt${QT_MAJOR_VERSION}Network_LIBRARIES}
- ${Qt${QT_MAJOR_VERSION}Gui_LIBRARIES}
- ${Qt${QT_MAJOR_VERSION}Core_LIBRARIES}
- )
-set(QtWebKit_deps QtGui QtNetwork)
-create_pyside_module(NAME QtWebKit
- INCLUDE_DIRS QtWebKit_include_dirs
- LIBRARIES QtWebKit_libraries
- DEPS QtWebKit_deps
- TYPESYSTEM_PATH QtWebKit_SOURCE_DIR
- SOURCES QtWebKit_SRC)
-
diff --git a/sources/pyside2/PySide2/QtWebKitWidgets/CMakeLists.txt b/sources/pyside2/PySide2/QtWebKitWidgets/CMakeLists.txt
deleted file mode 100644
index 0bf660a6..00000000
--- a/sources/pyside2/PySide2/QtWebKitWidgets/CMakeLists.txt
+++ /dev/null
@@ -1,65 +0,0 @@
-project(QtWebKitWidgets)
-
-set(QtWebKitWidgets_SRC
-${QtWebKitWidgets_GEN_DIR}/qgraphicswebview_wrapper.cpp
-${QtWebKitWidgets_GEN_DIR}/qwebdatabase_wrapper.cpp
-${QtWebKitWidgets_GEN_DIR}/qwebelement_wrapper.cpp
-${QtWebKitWidgets_GEN_DIR}/qwebelementcollection_wrapper.cpp
-${QtWebKitWidgets_GEN_DIR}/qwebframe_wrapper.cpp
-${QtWebKitWidgets_GEN_DIR}/qwebhistory_wrapper.cpp
-${QtWebKitWidgets_GEN_DIR}/qwebhistoryinterface_wrapper.cpp
-${QtWebKitWidgets_GEN_DIR}/qwebhistoryitem_wrapper.cpp
-${QtWebKitWidgets_GEN_DIR}/qwebhittestresult_wrapper.cpp
-${QtWebKitWidgets_GEN_DIR}/qwebinspector_wrapper.cpp
-${QtWebKitWidgets_GEN_DIR}/qwebpage_choosemultiplefilesextensionoption_wrapper.cpp
-${QtWebKitWidgets_GEN_DIR}/qwebpage_choosemultiplefilesextensionreturn_wrapper.cpp
-${QtWebKitWidgets_GEN_DIR}/qwebpage_errorpageextensionoption_wrapper.cpp
-${QtWebKitWidgets_GEN_DIR}/qwebpage_errorpageextensionreturn_wrapper.cpp
-${QtWebKitWidgets_GEN_DIR}/qwebpage_extensionoption_wrapper.cpp
-${QtWebKitWidgets_GEN_DIR}/qwebpage_extensionreturn_wrapper.cpp
-${QtWebKitWidgets_GEN_DIR}/qwebpage_viewportattributes_wrapper.cpp
-${QtWebKitWidgets_GEN_DIR}/qwebpage_wrapper.cpp
-${QtWebKitWidgets_GEN_DIR}/qwebpluginfactory_mimetype_wrapper.cpp
-${QtWebKitWidgets_GEN_DIR}/qwebpluginfactory_plugin_wrapper.cpp
-${QtWebKitWidgets_GEN_DIR}/qwebpluginfactory_wrapper.cpp
-${QtWebKitWidgets_GEN_DIR}/qwebsecurityorigin_wrapper.cpp
-${QtWebKitWidgets_GEN_DIR}/qwebsettings_wrapper.cpp
-${QtWebKitWidgets_GEN_DIR}/qwebview_wrapper.cpp
-# module is always needed
-${QtWebKitWidgets_GEN_DIR}/qtwebkitwidgets_module_wrapper.cpp
-)
-
-set(QtWebKitWidgets_include_dirs
- ${QtWebKitWidgets_SOURCE_DIR}
- ${QtWebKitWidgets_BINARY_DIR}
- ${Qt${QT_MAJOR_VERSION}Core_INCLUDE_DIRS}
- ${Qt${QT_MAJOR_VERSION}Gui_INCLUDE_DIRS}
- ${Qt${QT_MAJOR_VERSION}Widgets_INCLUDE_DIRS}
- ${Qt${QT_MAJOR_VERSION}WebKit_INCLUDE_DIRS}
- ${Qt${QT_MAJOR_VERSION}PrintSupport_INCLUDE_DIRS}
- ${Qt${QT_MAJOR_VERSION}Network_INCLUDE_DIRS}
- ${Qt${QT_MAJOR_VERSION}WebKitWidgets_INCLUDE_DIRS}
- ${libpyside_SOURCE_DIR}
- ${QtCore_GEN_DIR}
- ${QtGui_GEN_DIR}
- ${QtWidgets_GEN_DIR}
- ${QtPrintSupport_GEN_DIR}
- ${QtWebKit_GEN_DIR}
- ${QtNetwork_GEN_DIR}
- )
-set(QtWebKitWidgets_libraries pyside2
- ${Qt${QT_MAJOR_VERSION}WebKit_LIBRARIES}
- ${Qt${QT_MAJOR_VERSION}WebKitWidgets_LIBRARIES}
- ${Qt${QT_MAJOR_VERSION}Network_LIBRARIES}
- ${Qt${QT_MAJOR_VERSION}Widgets_LIBRARIES}
- ${Qt${QT_MAJOR_VERSION}Gui_LIBRARIES}
- ${Qt${QT_MAJOR_VERSION}Core_LIBRARIES}
- )
-set(QtWebKitWidgets_deps QtWidgets QtPrintSupport QtNetwork)
-create_pyside_module(NAME QtWebKitWidgets
- INCLUDE_DIRS QtWebKitWidgets_include_dirs
- LIBRARIES QtWebKitWidgets_libraries
- DEPS QtWebKitWidgets_deps
- TYPESYSTEM_PATH QtWebKitWidgets_SOURCE_DIR
- SOURCES QtWebKitWidgets_SRC)
-
diff --git a/sources/pyside2/PySide2/QtWebKitWidgets/typesystem_webkitwidgets.xml b/sources/pyside2/PySide2/QtWebKitWidgets/typesystem_webkitwidgets.xml
deleted file mode 100644
index 7760c1c3..00000000
--- a/sources/pyside2/PySide2/QtWebKitWidgets/typesystem_webkitwidgets.xml
+++ /dev/null
@@ -1,211 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
--->
-<typesystem package="PySide2.QtWebKitWidgets">
- <load-typesystem name="QtCore/typesystem_core.xml" generate="no"/>
- <load-typesystem name="QtGui/typesystem_gui.xml" generate="no"/>
- <load-typesystem name="QtWidgets/typesystem_widgets.xml" generate="no"/>
- <load-typesystem name="QtWebKit/typesystem_webkit.xml" generate="no"/>
- <load-typesystem name="QtNetwork/typesystem_network.xml" generate="no"/>
- <load-typesystem name="QtPrintSupport/typesystem_printsupport.xml" generate="no"/>
- <load-typesystem name="templates/webkitwidgets_common.xml" generate="no"/>
-
- <value-type name="QWebDatabase"/>
-
- <object-type name="QWebPluginFactory">
- <enum-type name="Extension"/>
- <value-type name="Plugin"/>
- <value-type name="MimeType"/>
- <modify-function signature="create(const QString &amp;,const QUrl &amp;,const QStringList &amp;,const QStringList &amp;)const">
- <modify-argument index="return">
- <define-ownership class="native" owner="c++"/>
- <define-ownership class="target" owner="target"/>
- </modify-argument>
- </modify-function>
- </object-type>
-
- <object-type name="QWebHistory"/>
- <object-type name="QWebHistoryInterface"/>
- <value-type name="QWebHistoryItem"/>
-
- <value-type name="QWebSecurityOrigin">
- <enum-type name="SubdomainSetting"/>
- </value-type>
-
- <object-type name="QWebSettings">
- <enum-type name="FontFamily"/>
- <enum-type name="FontSize"/>
- <enum-type name="ThirdPartyCookiePolicy"/>
- <enum-type name="WebAttribute"/>
- <enum-type name="WebGraphic"/>
- </object-type>
-
- <object-type name="QWebView">
- <modify-function signature="setPage(QWebPage*)">
- <modify-argument index="1">
- <reference-count action="set"/>
- </modify-argument>
- </modify-function>
- <modify-function signature="page()const">
- <modify-argument index="return">
- <define-ownership class="target" owner="default"/>
- </modify-argument>
- <inject-code position="end" file="../glue/qtwebkitwidgets.cpp" snippet="qwebview-page"/>
- </modify-function>
- <modify-function signature="print(QPrinter*)const" rename="print_"/>
- </object-type>
-
- <value-type name="QWebElement" since="4.6">
- <enum-type name="StyleResolveStrategy"/>
- </value-type>
-
- <value-type name="QWebElementCollection" since="4.6">
- <add-function signature="__len__">
- <inject-code file="../glue/qtwebkitwidgets.cpp" snippet="qwebelementcollection-len"/>
- </add-function>
- <add-function signature="__getitem__">
- <inject-code file="../glue/qtwebkitwidgets.cpp" snippet="qwebelementcollection-getitem"/>
- </add-function>
- </value-type>
-
- <object-type name="QWebFrame">
- <enum-type name="RenderLayer" flags="RenderLayers" since="4.6"/>
- <enum-type name="ValueOwnership"/>
- <modify-function signature="addToJavaScriptWindowObject(QString,QObject*,QWebFrame::ValueOwnership)">
- <modify-argument index="2">
- <parent index="this" action="add"/>
- </modify-argument>
- </modify-function>
- <modify-function signature="print(QPrinter*)const" rename="print_"/>
- <modify-function signature="metaData()const">
- <modify-argument index="return">
- <replace-type modified-type="PyObject"/>
- </modify-argument>
- <inject-code position="end" file="../glue/qtwebkitwidgets.cpp" snippet="qwebframe-metadata" />
- </modify-function>
- </object-type>
-
- <object-type name="QWebPage">
- <enum-type name="ErrorDomain"/>
- <enum-type name="Extension"/>
- <enum-type name="Feature"/>
- <enum-type name="FindFlag" flags="FindFlags"/>
- <enum-type name="LinkDelegationPolicy"/>
- <enum-type name="NavigationType"/>
- <enum-type name="PermissionPolicy" since="4.8" revision="4800"/>
- <enum-type name="VisibilityState"/>
- <enum-type name="WebAction"/>
- <enum-type name="WebWindowType"/>
-
- <value-type name="ChooseMultipleFilesExtensionOption"/>
- <value-type name="ChooseMultipleFilesExtensionReturn"/>
- <value-type name="ErrorPageExtensionOption" since="4.6"/>
- <value-type name="ErrorPageExtensionReturn" since="4.6"/>
- <value-type name="ExtensionOption"/>
- <value-type name="ExtensionReturn"/>
- <value-type name="ViewportAttributes"/>
-
- <modify-function signature="extension(QWebPage::Extension,const QWebPage::ExtensionOption*,QWebPage::ExtensionReturn*)">
- <modify-argument index="2" invalidate-after-use="yes">
- <conversion-rule class="target">
- <insert-template name="qwebpage_extension_argument_conversion">
- <replace from="$TYPE_SUFFIX" to="Option"/>
- </insert-template>
- </conversion-rule>
- </modify-argument>
- <modify-argument index="3" invalidate-after-use="yes">
- <conversion-rule class="target">
- <insert-template name="qwebpage_extension_argument_conversion">
- <replace from="$TYPE_SUFFIX" to="Return"/>
- </insert-template>
- </conversion-rule>
- </modify-argument>
- </modify-function>
-
- <modify-function signature="setNetworkAccessManager(QNetworkAccessManager*)">
- <modify-argument index="1">
- <reference-count action="set"/>
- </modify-argument>
- </modify-function>
- <modify-function signature="networkAccessManager()const">
- <modify-argument index="return">
- <reference-count action="set" variable-name="setNetworkAccessManager(QNetworkAccessManager*)1"/>
- </modify-argument>
- </modify-function>
- <modify-function signature="view()const">
- <modify-argument index="return">
- <define-ownership owner="default"/>
- </modify-argument>
- </modify-function>
- <modify-function signature="pluginFactory()const">
- <modify-argument index="return">
- <define-ownership owner="default"/>
- </modify-argument>
- </modify-function>
-
- <modify-function signature="javaScriptPrompt(QWebFrame*,const QString &amp;,const QString &amp;,QString*)">
- <modify-argument index="4">
- <remove-argument />
- <conversion-rule class="native">
- <insert-template name="qstring_remove"/>
- </conversion-rule>
- </modify-argument>
- <modify-argument index="return">
- <replace-type modified-type="PySequence"/>
- <conversion-rule class="native">
- <insert-template name="pysequence_qstring"/>
- </conversion-rule>
- <conversion-rule class="target">
- <insert-template name="qstring_pytuple"/>
- </conversion-rule>
- </modify-argument>
- </modify-function>
-
- <add-function signature="qt_metacall()">
- <inject-code class="native" file="../glue/qtwebkitwidgets.cpp" snippet="qwebpage-qt-metacall"/>
- </add-function>
- </object-type>
-
- <value-type name="QWebHitTestResult"/>
-
- <object-type name="QGraphicsWebView" since="4.6"/>
- <object-type name="QWebInspector" since="4.6"/>
-</typesystem>
diff --git a/sources/pyside2/PySide2/QtWidgets/CMakeLists.txt b/sources/pyside2/PySide2/QtWidgets/CMakeLists.txt
index 506a6fc7..5383d941 100644
--- a/sources/pyside2/PySide2/QtWidgets/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtWidgets/CMakeLists.txt
@@ -9,8 +9,6 @@ ${QtWidgets_GEN_DIR}/qabstractitemview_wrapper.cpp
${QtWidgets_GEN_DIR}/qabstractscrollarea_wrapper.cpp
${QtWidgets_GEN_DIR}/qabstractslider_wrapper.cpp
${QtWidgets_GEN_DIR}/qabstractspinbox_wrapper.cpp
-${QtWidgets_GEN_DIR}/qaction_wrapper.cpp
-${QtWidgets_GEN_DIR}/qactiongroup_wrapper.cpp
${QtWidgets_GEN_DIR}/qapplication_wrapper.cpp
${QtWidgets_GEN_DIR}/qboxlayout_wrapper.cpp
${QtWidgets_GEN_DIR}/qbuttongroup_wrapper.cpp
@@ -26,11 +24,9 @@ ${QtWidgets_GEN_DIR}/qcompleter_wrapper.cpp
${QtWidgets_GEN_DIR}/qdatawidgetmapper_wrapper.cpp
${QtWidgets_GEN_DIR}/qdateedit_wrapper.cpp
${QtWidgets_GEN_DIR}/qdatetimeedit_wrapper.cpp
-${QtWidgets_GEN_DIR}/qdesktopwidget_wrapper.cpp
${QtWidgets_GEN_DIR}/qdial_wrapper.cpp
${QtWidgets_GEN_DIR}/qdialog_wrapper.cpp
${QtWidgets_GEN_DIR}/qdialogbuttonbox_wrapper.cpp
-${QtWidgets_GEN_DIR}/qdirmodel_wrapper.cpp
${QtWidgets_GEN_DIR}/qdockwidget_wrapper.cpp
${QtWidgets_GEN_DIR}/qdoublespinbox_wrapper.cpp
${QtWidgets_GEN_DIR}/qerrormessage_wrapper.cpp
@@ -109,7 +105,6 @@ ${QtWidgets_GEN_DIR}/qmenu_wrapper.cpp
${QtWidgets_GEN_DIR}/qmenubar_wrapper.cpp
${QtWidgets_GEN_DIR}/qmessagebox_wrapper.cpp
${QtWidgets_GEN_DIR}/qmouseeventtransition_wrapper.cpp
-${QtWidgets_GEN_DIR}/qopenglwidget_wrapper.cpp
${QtWidgets_GEN_DIR}/qpangesture_wrapper.cpp
${QtWidgets_GEN_DIR}/qpinchgesture_wrapper.cpp
${QtWidgets_GEN_DIR}/qplaintextdocumentlayout_wrapper.cpp
@@ -124,7 +119,6 @@ ${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
${QtWidgets_GEN_DIR}/qslider_wrapper.cpp
@@ -190,9 +184,6 @@ ${QtWidgets_GEN_DIR}/qtreeview_wrapper.cpp
${QtWidgets_GEN_DIR}/qtreewidget_wrapper.cpp
${QtWidgets_GEN_DIR}/qtreewidgetitem_wrapper.cpp
${QtWidgets_GEN_DIR}/qtreewidgetitemiterator_wrapper.cpp
-${QtWidgets_GEN_DIR}/qundocommand_wrapper.cpp
-${QtWidgets_GEN_DIR}/qundogroup_wrapper.cpp
-${QtWidgets_GEN_DIR}/qundostack_wrapper.cpp
${QtWidgets_GEN_DIR}/qundoview_wrapper.cpp
${QtWidgets_GEN_DIR}/qvboxlayout_wrapper.cpp
${QtWidgets_GEN_DIR}/qwhatsthis_wrapper.cpp
diff --git a/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml b/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml
index 2d3761d3..79b824d5 100644
--- a/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml
+++ b/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml
@@ -67,6 +67,7 @@
-->
<rejection class="*" enum-name="enum_1"/>
+ <rejection class="QMdi"/>
<!--
Event classes have a lot of non-documented protected fields, those fields
@@ -234,7 +235,7 @@
<object-type name="QLayoutItem">
- <modify-function signature="widget()">
+ <modify-function signature="widget()const">
<modify-argument index="return">
<define-ownership class="target" owner="default"/>
</modify-argument>
@@ -460,19 +461,6 @@
<enum-type name="SliderAction"/>
<enum-type name="SliderChange"/>
</object-type>
- <object-type name="QActionGroup">
- <enum-type name="ExclusionPolicy" since="5.14"/>
- <modify-function signature="addAction(QAction*)">
- <modify-argument index="1">
- <parent index="this" action="add"/>
- </modify-argument>
- </modify-function>
- <modify-function signature="removeAction(QAction*)">
- <modify-argument index="1">
- <parent index="this" action="remove"/>
- </modify-argument>
- </modify-function>
- </object-type>
<object-type name="QCheckBox"/>
<object-type name="QCommonStyle">
</object-type>
@@ -524,14 +512,6 @@
</modify-argument>
</modify-function>
</object-type>
- <object-type name="QDirModel" polymorphic-id-expression="qobject_cast&lt;QDirModel*&gt;(%1)">
- <enum-type name="Roles"/>
- <modify-function signature="setIconProvider(QFileIconProvider*)">
- <modify-argument index="1">
- <parent index="this" action="add"/>
- </modify-argument>
- </modify-function>
- </object-type>
<object-type name="QFileIconProvider">
<enum-type name="IconType"/>
<enum-type name="Option" flags="Options"/>
@@ -637,8 +617,6 @@
<object-type name="QItemDelegate">
<!-- ### "doLayout(...)" is an internal method. -->
<modify-function signature="doLayout(QStyleOptionViewItem,QRect*,QRect*,QRect*,bool)const" remove="all"/>
- <!-- ### "selected(QPixmap,QPalette,bool)" is an internal method. -->
- <modify-function signature="selected(QPixmap,QPalette,bool)const" remove="all"/>
<!-- ### -->
<modify-function signature="drawCheck(QPainter*,QStyleOptionViewItem,QRect,Qt::CheckState)const">
<modify-argument index="1" invalidate-after-use="yes"/>
@@ -962,15 +940,6 @@
</modify-function>
</object-type>
- <object-type name="QShortcut">
- <add-function signature="QShortcut(QKeySequence&amp;,QWidget*,PyCallable*,Qt::ShortcutContext)">
- <modify-argument index="4">
- <replace-default-expression with="Qt::WindowShortcut"/>
- </modify-argument>
- <inject-code class="target" position="beginning" file="../glue/qtwidgets.cpp" snippet="qshortcut-1"/>
- <inject-code class="target" position="end" file="../glue/qtwidgets.cpp" snippet="qshortcut-2"/>
- </add-function>
- </object-type>
<object-type name="QSpacerItem"/>
<object-type name="QStatusBar">
<modify-function signature="addWidget(QWidget*,int)">
@@ -1077,40 +1046,6 @@
</modify-argument>
</modify-function>
</object-type>
- <object-type name="QUndoCommand">
- <modify-function signature="mergeWith(const QUndoCommand*)">
- <modify-argument index="1" invalidate-after-use="yes"/>
- </modify-function>
- </object-type>
- <object-type name="QUndoGroup">
- <modify-function signature="addStack(QUndoStack*)">
- <modify-argument index="1">
- <parent index="this" action="add"/>
- </modify-argument>
- </modify-function>
- <modify-function signature="removeStack(QUndoStack*)">
- <modify-argument index="1">
- <parent index="this" action="add"/>
- </modify-argument>
- </modify-function>
- </object-type>
- <object-type name="QUndoStack">
- <modify-function signature="createUndoAction(QObject*,const QString&amp;)const">
- <modify-argument index="return">
- <parent index="1" action="add"/>
- </modify-argument>
- </modify-function>
- <modify-function signature="createRedoAction(QObject*,const QString&amp;)const">
- <modify-argument index="return">
- <parent index="1" action="add"/>
- </modify-argument>
- </modify-function>
- <modify-function signature="push(QUndoCommand*)">
- <modify-argument index="1">
- <parent index="this" action="add"/>
- </modify-argument>
- </modify-function>
- </object-type>
<object-type name="QUndoView">
<modify-function signature="setGroup(QUndoGroup*)">
<modify-argument index="1">
@@ -1251,8 +1186,6 @@
<object-type name="QColorDialog">
<enum-type name="ColorDialogOption" flags="ColorDialogOptions"/>
<modify-function signature="getColor(const QColor&amp;,QWidget*,const QString&amp;,QFlags&lt;QColorDialog::ColorDialogOption>)" allow-thread="yes"/>
- <!-- Qt5: obsolete -->
- <modify-function signature="getRgba(unsigned int,bool*,QWidget*)" remove="all"/>
</object-type>
<object-type name="QLayout">
@@ -1561,16 +1494,6 @@
</inject-code>
</modify-function>
- <modify-function signature="getDouble(QWidget*,const QString&amp;,const QString&amp;,double,double,double,int,bool*,QFlags&lt;Qt::WindowType&gt;)" allow-thread="yes">
- <modify-argument index="8">
- <remove-default-expression/>
- <remove-argument/>
- </modify-argument>
- <inject-code class="target" position="beginning">
- <insert-template name="fix_arg,arg,arg,arg,arg,arg,arg,bool*,arg"/>
- </inject-code>
- </modify-function>
-
<modify-function signature="getDouble(QWidget*,const QString&amp;,const QString&amp;,double,double,double,int,bool*,QFlags&lt;Qt::WindowType&gt;,double)" allow-thread="yes">
<modify-argument index="8">
<remove-default-expression/>
@@ -2023,7 +1946,7 @@
<object-type name="QWidget" delete-in-main-thread="true">
<!-- see QWindow::nativeEvent(), QAbstractNativeEventFilter::nativeEventFilter() -->
- <modify-function signature="nativeEvent(const QByteArray &amp;,void*,long*)">
+ <modify-function signature="nativeEvent(const QByteArray &amp;,void*,qintptr*)">
<modify-argument index="3">
<remove-argument/>
<conversion-rule class="native">
@@ -2224,33 +2147,6 @@
</modify-argument>
</modify-function>
- <modify-function signature="getContentsMargins(int*,int*,int*,int*)const">
- <modify-argument index="0">
- <replace-type modified-type="PyObject"/>
- </modify-argument>
- <modify-argument index="1">
- <remove-argument/>
- </modify-argument>
- <modify-argument index="2">
- <remove-argument/>
- </modify-argument>
- <modify-argument index="3">
- <remove-argument/>
- </modify-argument>
- <modify-argument index="4">
- <remove-argument/>
- </modify-argument>
- <inject-code class="target" position="beginning">
- <insert-template name="fix_number*,number*,number*,number*">
- <replace from="$TYPE" to="int"/>
- </insert-template>
- </inject-code>
- <inject-code class="native" position="end">
- <insert-template name="fix_native_return_number*,number*,number*,number*">
- <replace from="$TYPE" to="int"/>
- </insert-template>
- </inject-code>
- </modify-function>
<modify-function signature="insertAction(QAction*,QAction*)">
<modify-argument index="2">
<parent index="this" action="add"/>
@@ -2409,13 +2305,8 @@
</modify-argument>
</modify-function>
- <modify-function signature="pixmap()const">
- <modify-argument index="return">
- <!-- Defining ownership as "default" avoids the object to be automatically
- set as parent of the returned pointer. -->
- <define-ownership class="target" owner="default"/>
- </modify-argument>
- </modify-function>
+ <modify-function signature="pixmap(Qt::ReturnByValueConstant)const" remove="all"/>
+ <modify-function signature="picture(Qt::ReturnByValueConstant)const" remove="all"/>
<modify-function signature="setMovie(QMovie *)">
<modify-argument index="1">
<parent index="this" action="add"/>
@@ -2705,28 +2596,6 @@
</modify-argument>
</modify-function>
<modify-function signature="del()" rename="del_"/>
- <modify-function signature="getTextMargins(int*,int*,int*,int*)const">
- <modify-argument index="0">
- <replace-type modified-type="PyObject*"/>
- </modify-argument>
- <modify-argument index="1">
- <remove-argument/>
- </modify-argument>
- <modify-argument index="2">
- <remove-argument/>
- </modify-argument>
- <modify-argument index="3">
- <remove-argument/>
- </modify-argument>
- <modify-argument index="4">
- <remove-argument/>
- </modify-argument>
- <inject-code class="target" position="beginning">
- <insert-template name="fix_number*,number*,number*,number*">
- <replace from="$TYPE" to="int"/>
- </insert-template>
- </inject-code>
- </modify-function>
<add-function signature="addAction(QAction*)">
<inject-code class="target" position="beginning" file="../glue/qtwidgets.cpp" snippet="qlineedit-addaction"/>
@@ -2737,9 +2606,6 @@
<enum-type name="Mode"/>
<enum-type name="SegmentStyle"/>
</object-type>
- <object-type name="QOpenGLWidget">
- <enum-type name="UpdateBehavior"/>
- </object-type>
<object-type name="QSplashScreen">
<!-- Override QWidget.painter -->
<modify-function signature="repaint()" remove="all"/>
@@ -2760,7 +2626,6 @@
</modify-argument>
</modify-function>
</object-type>
- <object-type name="QDesktopWidget"/>
<object-type name="QFrame">
<enum-type name="Shadow"/>
<enum-type name="Shape"/>
@@ -2781,7 +2646,7 @@
sys.exit(app.exec_())
</inject-documentation>
</modify-function>
- <modify-function signature="valueChanged(QString)">
+ <modify-function signature="textChanged(QString)">
<inject-documentation mode="append" format="target">
::
@@ -2942,20 +2807,8 @@
</modify-function>
<modify-function signature="print(QPagedPaintDevice*)const" rename="print_"/>
</object-type>
- <object-type name="QAction">
- <enum-type name="ActionEvent"/>
- <enum-type name="MenuRole"/>
- <enum-type name="Priority" since="4.6"/>
- <modify-function signature="setMenu(QMenu*)">
- <modify-argument index="1">
- <parent index="this" action="add"/>
- </modify-argument>
- </modify-function>
- <modify-function signature="triggered(bool)" allow-thread="yes"/>
- </object-type>
<object-type name="QApplication">
- <enum-type name="ColorSpec"/>
<extra-includes>
<include file-name="QBasicTimer" location="global"/>
<include file-name="QFont" location="global"/>
diff --git a/sources/pyside2/PySide2/__init__.py.in b/sources/pyside2/PySide2/__init__.py.in
index 8013ac68..f860c6ac 100644
--- a/sources/pyside2/PySide2/__init__.py.in
+++ b/sources/pyside2/PySide2/__init__.py.in
@@ -12,6 +12,9 @@ __version_info__ = (@BINDING_API_MAJOR_VERSION@, @BINDING_API_MINOR_VERSION@, @B
def _additional_dll_directories(package_dir):
# Find shiboken2 relative to the package directory.
root = os.path.dirname(package_dir)
+ # Check for a flat .zip as deployed by cx_free(PYSIDE-1257)
+ if root.endswith('.zip'):
+ return []
shiboken2 = os.path.join(root, 'shiboken2')
if os.path.isdir(shiboken2): # Standard case, only shiboken2 is needed
return [shiboken2]
diff --git a/sources/pyside2/PySide2/global.h.in b/sources/pyside2/PySide2/global.h.in
index a8065a7b..a23b0f33 100644
--- a/sources/pyside2/PySide2/global.h.in
+++ b/sources/pyside2/PySide2/global.h.in
@@ -37,6 +37,16 @@
**
****************************************************************************/
+// Make "signals:", "slots:" visible as access specifiers
+#define QT_ANNOTATE_ACCESS_SPECIFIER(a) __attribute__((annotate(#a)))
+
+// Q_PROPERTY is defined as class annotation which does not work since a
+// sequence of properties will to expand to a sequence of annotations
+// annotating nothing, causing clang to complain. Instead, define it away in a
+// static assert with the stringified argument in a ','-operator (cf qdoc).
+
+#define QT_ANNOTATE_CLASS(type,...) static_assert(sizeof(#__VA_ARGS__),#type);
+
#include <QtCore/qnamespace.h>
#if @ENABLE_X11@
@@ -51,7 +61,4 @@
// not in release
#define QT_NO_DEBUG
-// Make "signals:", "slots:" visible as access specifiers
-#define QT_ANNOTATE_ACCESS_SPECIFIER(a) __attribute__((annotate(#a)))
-
// Here are now all configured modules appended:
diff --git a/sources/pyside2/PySide2/glue/qtcore.cpp b/sources/pyside2/PySide2/glue/qtcore.cpp
index 9b927cce..6d8c0876 100644
--- a/sources/pyside2/PySide2/glue/qtcore.cpp
+++ b/sources/pyside2/PySide2/glue/qtcore.cpp
@@ -587,6 +587,14 @@ Py_END_ALLOW_THREADS
PySide::runCleanupFunctions();
// @snippet moduleshutdown
+// @snippet qt-qenum
+%PYARG_0 = PySide::QEnum::QEnumMacro(%1, false);
+// @snippet qt-qenum
+
+// @snippet qt-qflag
+%PYARG_0 = PySide::QEnum::QEnumMacro(%1, true);
+// @snippet qt-qflag
+
// @snippet qt-pysideinit
Shiboken::Conversions::registerConverterName(SbkPySide2_QtCoreTypeConverters[SBK_QSTRING_IDX], "unicode");
Shiboken::Conversions::registerConverterName(SbkPySide2_QtCoreTypeConverters[SBK_QSTRING_IDX], "str");
@@ -639,8 +647,10 @@ if (%PYARG_0 == Py_None)
// @snippet qline-hash
namespace PySide {
- template<> inline uint hash(const QLine &v) {
- return qHash(qMakePair(qMakePair(v.x1(), v.y1()), qMakePair(v.x2(), v.y2())));
+ template<> inline Py_ssize_t hash(const QLine &l)
+ {
+ const int v[4] = {l.x1(), l.y1(), l.x2(), l.y2()};
+ return qHashRange(v, v + 4);
}
};
// @snippet qline-hash
@@ -707,7 +717,7 @@ if (!PyDateTimeAPI) PySideDateTime_IMPORT;
// @snippet qpoint
namespace PySide {
- template<> inline uint hash(const QPoint &v) {
+ template<> inline Py_ssize_t hash(const QPoint &v) {
return qHash(qMakePair(v.x(), v.y()));
}
};
@@ -715,15 +725,16 @@ namespace PySide {
// @snippet qrect
namespace PySide {
- template<> inline uint hash(const QRect &v) {
- return qHash(qMakePair(qMakePair(v.x(), v.y()), qMakePair(v.width(), v.height())));
+ template<> inline Py_ssize_t hash(const QRect &r) {
+ const int v[4] = {r.x(), r.y(), r.width(), r.height()};
+ return qHashRange(v, v + 4);
}
};
// @snippet qrect
// @snippet qsize
namespace PySide {
- template<> inline uint hash(const QSize &v) {
+ template<> inline Py_ssize_t hash(const QSize &v) {
return qHash(qMakePair(v.width(), v.height()));
}
};
@@ -793,9 +804,9 @@ static QObject *_findChildHelper(const QObject *parent, const QString &name, PyT
return nullptr;
}
-static inline bool _findChildrenComparator(const QObject *&child, const QRegExp &name)
+static inline bool _findChildrenComparator(const QObject *&child, const QRegularExpression &name)
{
- return name.indexIn(child->objectName()) != -1;
+ return name.match(child->objectName()).hasMatch();
}
static inline bool _findChildrenComparator(const QObject *&child, const QString &name)
@@ -820,15 +831,10 @@ QObject *child = _findChildHelper(%CPPSELF, %2, reinterpret_cast<PyTypeObject *>
%PYARG_0 = %CONVERTTOPYTHON[QObject *](child);
// @snippet qobject-findchild-2
-// @snippet qobject-findchildren-1
-%PYARG_0 = PyList_New(0);
-_findChildrenHelper(%CPPSELF, %2, reinterpret_cast<PyTypeObject *>(%PYARG_1), %PYARG_0);
-// @snippet qobject-findchildren-1
-
-// @snippet qobject-findchildren-2
+// @snippet qobject-findchildren
%PYARG_0 = PyList_New(0);
_findChildrenHelper(%CPPSELF, %2, reinterpret_cast<PyTypeObject *>(%PYARG_1), %PYARG_0);
-// @snippet qobject-findchildren-2
+// @snippet qobject-findchildren
// @snippet qobject-tr
QString result;
@@ -1288,6 +1294,14 @@ QByteArray ba(1 + int(%2), char(0));
%CPPSELF.%FUNCTION_NAME(Shiboken::String::toCString(%PYARG_1), Shiboken::String::len(%PYARG_1));
// @snippet qcryptographichash-adddata
+// @snippet qsocketdescriptor
+#ifdef WIN32
+using DescriptorType = Qt::HANDLE;
+#else
+using DescriptorType = int;
+#endif
+// @snippet qsocketdescriptor
+
// @snippet qsocketnotifier
PyObject *socket = %PYARG_1;
if (socket != nullptr) {
@@ -1968,3 +1982,41 @@ PyTuple_SET_ITEM(%out, 0, %CONVERTTOPYTHON[%INTYPE_0](%in.first));
PyTuple_SET_ITEM(%out, 1, %CONVERTTOPYTHON[%INTYPE_1](%in.second));
return %out;
// @snippet return-qpair
+
+// @snippet qthread_pthread_cleanup
+#ifdef Q_OS_UNIX
+# include <stdio.h>
+# include <pthread.h>
+static void qthread_pthread_cleanup(void *arg)
+{
+ // PYSIDE 1282: When terminating a thread using QThread::terminate()
+ // (pthread_cancel()), QThread::run() is aborted and the lock is released,
+ // but ~GilState() is still executed for some reason. Prevent it from
+ // releasing.
+ auto gil = reinterpret_cast<Shiboken::GilState *>(arg);
+ gil->abandon();
+}
+#endif // Q_OS_UNIX
+// @snippet qthread_pthread_cleanup
+
+// @snippet qthread_pthread_cleanup_install
+#ifdef Q_OS_UNIX
+pthread_cleanup_push(qthread_pthread_cleanup, &gil);
+#endif
+// @snippet qthread_pthread_cleanup_install
+
+// @snippet qthread_pthread_cleanup_uninstall
+#ifdef Q_OS_UNIX
+pthread_cleanup_pop(0);
+#endif
+// @snippet qthread_pthread_cleanup_uninstall
+
+// @snippet qlibraryinfo_build
+#if defined(IS_PY3K) && defined(Py_LIMITED_API)
+auto suffix = PyUnicode_FromString(" [limited API]");
+auto oldResult = pyResult;
+pyResult = PyUnicode_Concat(pyResult, suffix);
+Py_DECREF(oldResult);
+Py_DECREF(suffix);
+#endif
+// @snippet qlibraryinfo_build
diff --git a/sources/pyside2/PySide2/glue/qtgui.cpp b/sources/pyside2/PySide2/glue/qtgui.cpp
index a6b45b7c..2a139fe6 100644
--- a/sources/pyside2/PySide2/glue/qtgui.cpp
+++ b/sources/pyside2/PySide2/glue/qtgui.cpp
@@ -144,7 +144,7 @@ for (int i = 0, i_max = %CPPSELF.count(); i < i_max; ++i){
// @snippet qpixmap
// @snippet qimage-constbits
-%PYARG_0 = Shiboken::Buffer::newObject(%CPPSELF.%FUNCTION_NAME(), %CPPSELF.byteCount());
+%PYARG_0 = Shiboken::Buffer::newObject(%CPPSELF.%FUNCTION_NAME(), %CPPSELF.sizeInBytes());
// @snippet qimage-constbits
// @snippet qimage-bits
diff --git a/sources/pyside2/PySide2/glue/qtqml.cpp b/sources/pyside2/PySide2/glue/qtqml.cpp
index 1913204c..5ff072e0 100644
--- a/sources/pyside2/PySide2/glue/qtqml.cpp
+++ b/sources/pyside2/PySide2/glue/qtqml.cpp
@@ -42,6 +42,26 @@ int %0 = PySide::qmlRegisterType(%ARGUMENT_NAMES);
%PYARG_0 = %CONVERTTOPYTHON[int](%0);
// @snippet qmlregistertype
+// @snippet qmlregistersingletontype_qobject_callback
+int %0 = PySide::qmlRegisterSingletonType(%ARGUMENT_NAMES, true, true);
+%PYARG_0 = %CONVERTTOPYTHON[int](%0);
+// @snippet qmlregistersingletontype_qobject_callback
+
+// @snippet qmlregistersingletontype_qobject_nocallback
+int %0 = PySide::qmlRegisterSingletonType(%ARGUMENT_NAMES, nullptr, true, false);
+%PYARG_0 = %CONVERTTOPYTHON[int](%0);
+// @snippet qmlregistersingletontype_qobject_nocallback
+
+// @snippet qmlregistersingletontype_qjsvalue
+int %0 = PySide::qmlRegisterSingletonType(nullptr, %ARGUMENT_NAMES, false, true);
+%PYARG_0 = %CONVERTTOPYTHON[int](%0);
+// @snippet qmlregistersingletontype_qjsvalue
+
+// @snippet qmlregisteruncreatabletype
+int %0 = PySide::qmlRegisterType(%ARGUMENT_NAMES, false);
+%PYARG_0 = %CONVERTTOPYTHON[int](%0);
+// @snippet qmlregisteruncreatabletype
+
// @snippet init
PySide::initQmlSupport(module);
// @snippet init
diff --git a/sources/pyside2/PySide2/glue/qtuitools.cpp b/sources/pyside2/PySide2/glue/qtuitools.cpp
index 668b512e..d81f6205 100644
--- a/sources/pyside2/PySide2/glue/qtuitools.cpp
+++ b/sources/pyside2/PySide2/glue/qtuitools.cpp
@@ -137,16 +137,19 @@ if (uiFileName.isEmpty()) {
Py_RETURN_NONE;
}
-QString uicBin("uic");
-QStringList uicArgs = {"-g", "python", QString::fromUtf8(uiFileName)};
+// Use the 'pyside2-uic' wrapper instead of 'uic'
+// This approach is better than rely on 'uic' since installing
+// the wheels cover this case.
+QString uicBin("pyside2-uic");
+QStringList uicArgs = {QString::fromUtf8(uiFileName)};
QProcess uicProcess;
uicProcess.start(uicBin, uicArgs);
if (!uicProcess.waitForFinished()) {
- qCritical() << "Cannot run 'uic': " << uicProcess.errorString() << " - "
+ qCritical() << "Cannot run 'pyside2-uic': " << uicProcess.errorString() << " - "
<< "Exit status " << uicProcess.exitStatus()
<< " (" << uicProcess.exitCode() << ")\n"
- << "Check if 'uic' is in PATH";
+ << "Check if 'pyside2-uic' is in PATH";
Py_RETURN_NONE;
}
QByteArray uiFileContent = uicProcess.readAllStandardOutput();
diff --git a/sources/pyside2/PySide2/pysideqtesttouch.h b/sources/pyside2/PySide2/pysideqtesttouch.h
index 115c7835..935ab59d 100644
--- a/sources/pyside2/PySide2/pysideqtesttouch.h
+++ b/sources/pyside2/PySide2/pysideqtesttouch.h
@@ -68,145 +68,133 @@ namespace QTest
}
PySideQTouchEventSequence *press(int touchId, const QPoint &pt, QWindow *window = nullptr)
{
- QTouchEvent::TouchPoint &p = point(touchId);
- p.setScreenPos(mapToScreen(window, pt));
- p.setState(Qt::TouchPointPressed);
+ auto it = m_points.find(touchId);
+ if (it == m_points.end()) {
+ QEventPoint point(touchId, QEventPoint::Pressed, pt, mapToScreen(window, pt));
+ m_points.insert(touchId, point);
+ }
return this;
}
PySideQTouchEventSequence *move(int touchId, const QPoint &pt, QWindow *window = nullptr)
{
- QTouchEvent::TouchPoint &p = point(touchId);
- p.setScreenPos(mapToScreen(window, pt));
- p.setState(Qt::TouchPointMoved);
+ QEventPoint point(touchId, QEventPoint::Updated, pt, mapToScreen(window, pt));
+ m_points[touchId] = point;
return this;
}
PySideQTouchEventSequence *release(int touchId, const QPoint &pt, QWindow *window = nullptr)
{
- QTouchEvent::TouchPoint &p = point(touchId);
- p.setScreenPos(mapToScreen(window, pt));
- p.setState(Qt::TouchPointReleased);
+ auto it = m_points.find(touchId);
+ if (it == m_points.end()) {
+ QEventPoint point(touchId, QEventPoint::Released, pt, mapToScreen(window, pt));
+ m_points.insert(touchId, point);
+ }
return this;
}
PySideQTouchEventSequence *stationary(int touchId)
{
- QTouchEvent::TouchPoint &p = pointOrPreviousPoint(touchId);
- p.setState(Qt::TouchPointStationary);
+ auto it = m_points.find(touchId);
+ if (it == m_points.end()) {
+ auto previous_it = m_previousPoints.find(touchId);
+ const QEventPoint point = previous_it != m_previousPoints.end()
+ ? previous_it.value()
+ : QEventPoint(touchId, QEventPoint::Stationary, QPointF(), QPointF());
+ m_points.insert(touchId, point);
+ }
return this;
}
#ifdef QT_WIDGETS_LIB
PySideQTouchEventSequence *press(int touchId, const QPoint &pt, QWidget *widget = nullptr)
{
- QTouchEvent::TouchPoint &p = point(touchId);
- p.setScreenPos(mapToScreen(widget, pt));
- p.setState(Qt::TouchPointPressed);
+ auto it = m_points.find(touchId);
+ if (it == m_points.end()) {
+ QEventPoint point(touchId, QEventPoint::Pressed, pt, mapToScreen(widget, pt));
+ m_points.insert(touchId, point);
+ }
return this;
}
PySideQTouchEventSequence *move(int touchId, const QPoint &pt, QWidget *widget = nullptr)
{
- QTouchEvent::TouchPoint &p = point(touchId);
- p.setScreenPos(mapToScreen(widget, pt));
- p.setState(Qt::TouchPointMoved);
+ QEventPoint point(touchId, QEventPoint::Updated, pt, mapToScreen(widget, pt));
+ m_points[touchId] = point;
return this;
}
PySideQTouchEventSequence *release(int touchId, const QPoint &pt, QWidget *widget = nullptr)
{
- QTouchEvent::TouchPoint &p = point(touchId);
- p.setScreenPos(mapToScreen(widget, pt));
- p.setState(Qt::TouchPointReleased);
+ auto it = m_points.find(touchId);
+ if (it == m_points.end()) {
+ QEventPoint point(touchId, QEventPoint::Released, pt, mapToScreen(widget, pt));
+ m_points.insert(touchId, point);
+ }
return this;
}
#endif
void commit(bool processEvents = true)
{
- if (!points.isEmpty()) {
- if (targetWindow)
- {
- qt_handleTouchEvent(targetWindow, device, points.values());
+ if (!m_points.isEmpty()) {
+ if (targetWindow) {
+ qt_handleTouchEvent(targetWindow, device, m_points.values());
}
#ifdef QT_WIDGETS_LIB
- else if (targetWidget)
- {
- qt_handleTouchEvent(targetWidget->windowHandle(), device, points.values());
+ else if (targetWidget) {
+ qt_handleTouchEvent(targetWidget->windowHandle(), device, m_points.values());
}
#endif
}
if (processEvents)
QCoreApplication::processEvents();
- previousPoints = points;
- points.clear();
+ m_previousPoints = m_points;
+ m_points.clear();
}
private:
#ifdef QT_WIDGETS_LIB
- PySideQTouchEventSequence(QWidget *widget, QTouchDevice *aDevice, bool autoCommit)
- : targetWidget(widget), targetWindow(0), device(aDevice), commitWhenDestroyed(autoCommit)
+ PySideQTouchEventSequence(QWidget *widget, QPointingDevice *aDevice, bool autoCommit)
+ : targetWidget(widget), device(aDevice), commitWhenDestroyed(autoCommit)
{
}
#endif
- PySideQTouchEventSequence(QWindow *window, QTouchDevice *aDevice, bool autoCommit)
- :
-#ifdef QT_WIDGETS_LIB
- targetWidget(0),
-#endif
- targetWindow(window), device(aDevice), commitWhenDestroyed(autoCommit)
+ PySideQTouchEventSequence(QWindow *window, QPointingDevice *aDevice, bool autoCommit)
+ : targetWindow(window), device(aDevice), commitWhenDestroyed(autoCommit)
{
}
- QTouchEvent::TouchPoint &point(int touchId)
- {
- if (!points.contains(touchId))
- points[touchId] = QTouchEvent::TouchPoint(touchId);
- return points[touchId];
- }
-
- QTouchEvent::TouchPoint &pointOrPreviousPoint(int touchId)
- {
- if (!points.contains(touchId)) {
- if (previousPoints.contains(touchId))
- points[touchId] = previousPoints.value(touchId);
- else
- points[touchId] = QTouchEvent::TouchPoint(touchId);
- }
- return points[touchId];
- }
-
#ifdef QT_WIDGETS_LIB
- QPoint mapToScreen(QWidget *widget, const QPoint &pt)
+ QPointF mapToScreen(const QWidget *widget, const QPointF &pt)
{
if (widget)
return widget->mapToGlobal(pt);
return targetWidget ? targetWidget->mapToGlobal(pt) : pt;
}
#endif
- QPoint mapToScreen(QWindow *window, const QPoint &pt)
+ QPointF mapToScreen(const QWindow *window, const QPointF &pt)
{
if(window)
return window->mapToGlobal(pt);
return targetWindow ? targetWindow->mapToGlobal(pt) : pt;
}
- QMap<int, QTouchEvent::TouchPoint> previousPoints;
- QMap<int, QTouchEvent::TouchPoint> points;
+ QMap<int, QEventPoint> m_previousPoints;
+ QMap<int, QEventPoint> m_points;
#ifdef QT_WIDGETS_LIB
- QWidget *targetWidget;
+ QWidget *targetWidget = nullptr;
#endif
- QWindow *targetWindow;
- QTouchDevice *device;
- bool commitWhenDestroyed;
+ QWindow *targetWindow = nullptr;
+ QPointingDevice *device = nullptr;
+ bool commitWhenDestroyed = false;
#ifdef QT_WIDGETS_LIB
- friend PySideQTouchEventSequence *generateTouchEvent(QWidget *, QTouchDevice *, bool);
+ friend PySideQTouchEventSequence *generateTouchEvent(QWidget *, QPointingDevice *, bool);
#endif
- friend PySideQTouchEventSequence *generateTouchEvent(QWindow *, QTouchDevice *, bool);
+ friend PySideQTouchEventSequence *generateTouchEvent(QWindow *, QPointingDevice *, bool);
};
#ifdef QT_WIDGETS_LIB
inline
PySideQTouchEventSequence *generateTouchEvent(QWidget *widget,
- QTouchDevice *device,
+ QPointingDevice *device,
bool autoCommit = true)
{
return new PySideQTouchEventSequence(widget, device, autoCommit);
@@ -214,7 +202,7 @@ private:
#endif
inline
PySideQTouchEventSequence *generateTouchEvent(QWindow *window,
- QTouchDevice *device,
+ QPointingDevice *device,
bool autoCommit = true)
{
return new PySideQTouchEventSequence(window, device, autoCommit);
diff --git a/sources/pyside2/PySide2/templates/core_common.xml b/sources/pyside2/PySide2/templates/core_common.xml
index 6d02428a..b6fb72a2 100644
--- a/sources/pyside2/PySide2/templates/core_common.xml
+++ b/sources/pyside2/PySide2/templates/core_common.xml
@@ -242,8 +242,8 @@
<!-- Helpers for modifying "bool nativeEventFilter(QByteArray, void*, long *result)"
to return a tuple of bool,long -->
<template name="return_native_eventfilter_conversion_variables">
- long resultVar{0};
- long *%out = &amp;resultVar;
+ qintptr resultVar{0};
+ qintptr *%out = &amp;resultVar;
</template>
<template name="return_native_eventfilter_conversion">
%RETURN_TYPE %out = false;
diff --git a/sources/pyside2/cmake/Macros/PySideModules.cmake b/sources/pyside2/cmake/Macros/PySideModules.cmake
index 14707f96..5022002c 100644
--- a/sources/pyside2/cmake/Macros/PySideModules.cmake
+++ b/sources/pyside2/cmake/Macros/PySideModules.cmake
@@ -93,7 +93,7 @@ macro(create_pyside_module)
# Contains include directories to pass to shiboken's preprocessor.
# Workaround: Added ${QT_INCLUDE_DIR}/QtCore until
# qtdeclarative/8d560d1bf0a747bf62f73fad6b6774095442d9d2 has reached qt5.git
- string(REPLACE ";" ${PATH_SEP} core_includes "${Qt5Core_INCLUDE_DIRS}")
+ string(REPLACE ";" ${PATH_SEP} core_includes "${Qt${QT_MAJOR_VERSION}Core_INCLUDE_DIRS}")
set(shiboken_include_dirs ${pyside2_SOURCE_DIR}${PATH_SEP}${QT_INCLUDE_DIR}${PATH_SEP}${core_includes})
set(shiboken_framework_include_dirs_option "")
if(CMAKE_HOST_APPLE)
diff --git a/sources/pyside2/doc/CMakeLists.txt b/sources/pyside2/doc/CMakeLists.txt
index f416ec47..ffbb3c1e 100644
--- a/sources/pyside2/doc/CMakeLists.txt
+++ b/sources/pyside2/doc/CMakeLists.txt
@@ -95,16 +95,51 @@ add_custom_target(qdoc
COMMENT "Running qdoc against Qt source code..."
SOURCE "pyside.qdocconf")
+# conditional tag for sphinx build
+#string(JOIN "_" SPHINX_TAG ${DOC_OUTPUT_FORMAT} "format")
+# Python script to replace the virtualFolder string in the QHP
+set(py_cmd "from __future__ import print_function
+import fileinput
+import re
+try:
+\tfor line in fileinput.input('html/PySide.qhp',inplace=True,backup='.bak'):
+\t\tline_copy=line.strip()
+\t\tif not line_copy: # check for empty line
+\t\t\tcontinue
+\t\tmatch=re.match('(^.*virtualFolder.)doc(.*$)',line)
+\t\tif match:
+\t\t\trepl=''.join([match.group(1),'pyside2',match.group(2)])
+\t\t\tprint(line.replace(match.group(0),repl),end='')
+\t\telse:
+\t\t\tprint(line)
+except:
+\tpass\n")
+file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/py_script.py CONTENT ${py_cmd})
+
add_custom_target(apidoc
- COMMAND ${SHIBOKEN_PYTHON_INTERPRETER} ${SPHINX_BUILD} -b html ${CMAKE_CURRENT_BINARY_DIR}/rst html
- #copying shiboken2 (including ApiExtractor) doc htmls
- COMMENT "Copying over the Shiboken2 doc HTMLs..."
- COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/html/shiboken2
- COMMAND ${CMAKE_COMMAND} -E copy_directory
- ${CMAKE_CURRENT_BINARY_DIR}/../../shiboken2/doc/html
- ${CMAKE_CURRENT_BINARY_DIR}/html/shiboken2
+ COMMAND ${SHIBOKEN_PYTHON_INTERPRETER} ${SPHINX_BUILD} -b ${DOC_OUTPUT_FORMAT} ${CMAKE_CURRENT_BINARY_DIR}/rst html
+ COMMENT "Generating PySide htmls..."
)
+# create a custom commands to copy the shiboken docs
+# and generate offline help based on the output format.
+if(DOC_OUTPUT_FORMAT STREQUAL "html")
+ add_custom_command(TARGET apidoc POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/html/shiboken2
+ COMMAND ${CMAKE_COMMAND} -E copy_directory
+ ${CMAKE_CURRENT_BINARY_DIR}/../../shiboken2/doc/html
+ ${CMAKE_CURRENT_BINARY_DIR}/html/shiboken2
+ COMMENT "Copying Shiboken docs..."
+ VERBATIM)
+else()
+ file(TO_NATIVE_PATH ${CMAKE_CURRENT_BINARY_DIR}/html/PySide.qhp QHP_FILE)
+ add_custom_command(TARGET apidoc POST_BUILD
+ COMMAND ${PYTHON_EXECUTABLE} py_script.py
+ COMMAND qhelpgenerator ${QHP_FILE}
+ COMMENT "Generating QCH from a QHP file..."
+ VERBATIM)
+endif()
+
# create conf.py based on conf.py.in
configure_file("conf.py.in" "rst/conf.py" @ONLY)
diff --git a/sources/pyside2/doc/_themes/pysidedocs_qthelp/domainindex.html b/sources/pyside2/doc/_themes/pysidedocs_qthelp/domainindex.html
new file mode 100644
index 00000000..c136cdd1
--- /dev/null
+++ b/sources/pyside2/doc/_themes/pysidedocs_qthelp/domainindex.html
@@ -0,0 +1,57 @@
+{#
+ basic/domainindex.html
+ ~~~~~~~~~~~~~~~~~~~~~~
+
+ Template for domain indices (module index, ...).
+
+ :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS.
+ :license: BSD, see LICENSE for details.
+#}
+{% extends "layout.html" %}
+{% set title = indextitle %}
+{% block extrahead %}
+{{ super() }}
+{% if not embedded and collapse_index %}
+ <script type="text/javascript">
+ DOCUMENTATION_OPTIONS.COLLAPSE_INDEX = true;
+ </script>
+{% endif %}
+{% endblock %}
+{% block body %}
+<div class="section">
+ {%- set curr_group = 0 %}
+
+ <h1>{{ indextitle }}</h1>
+
+ <div class="modindex-jumpbox">
+ {%- for (letter, entries) in content %}
+ <a href="#cap-{{ letter }}"><strong>{{ letter }}</strong></a>
+ {%- if not loop.last %} | {% endif %}
+ {%- endfor %}
+ </div>
+
+ <table class="indextable modindextable" cellspacing="0" cellpadding="2">
+ {%- for letter, entries in content %}
+ <tr class="pcap"><td></td><td>&nbsp;</td><td></td></tr>
+ <tr class="cap"><td></td><td><a name="cap-{{ letter }}">
+ <strong>{{ letter }}</strong></a></td><td></td></tr>
+ {%- for (name, grouptype, page, anchor, extra, qualifier, description)
+ in entries %}
+ {%- if grouptype == 1 %}{% set curr_group = curr_group + 1 %}{% endif %}
+ <tr{% if grouptype == 2 %} class="cg-{{ curr_group }}"{% endif %}>
+ <td>{% if grouptype == 1 -%}
+ <img src="{{ pathto('_static/minus.png', 1) }}" id="toggle-{{ curr_group }}"
+ class="toggler" style="display: none" alt="-" />
+ {%- endif %}</td>
+ <td>{% if grouptype == 2 %}&nbsp;&nbsp;&nbsp;{% endif %}
+ {% if page %}<a href="{{ pathto(page) }}#{{ anchor }}">{% endif -%}
+ <tt class="xref">{{ name|e }}</tt>
+ {%- if page %}</a>{% endif %}
+ {%- if extra %} <em>({{ extra|e }})</em>{% endif -%}
+ </td><td>{% if qualifier %}<strong>{{ qualifier|e }}:</strong>{% endif %}
+ <em>{{ description|e }}</em></td></tr>
+ {%- endfor %}
+ {%- endfor %}
+ </table>
+</div>
+{% endblock %}
diff --git a/sources/pyside2/doc/_themes/pysidedocs_qthelp/static/fakebar.png b/sources/pyside2/doc/_themes/pysidedocs_qthelp/static/fakebar.png
new file mode 100644
index 00000000..b45830e0
--- /dev/null
+++ b/sources/pyside2/doc/_themes/pysidedocs_qthelp/static/fakebar.png
Binary files differ
diff --git a/sources/pyside2/doc/_themes/pysidedocs_qthelp/static/logo_python.jpg b/sources/pyside2/doc/_themes/pysidedocs_qthelp/static/logo_python.jpg
new file mode 100644
index 00000000..cd474efb
--- /dev/null
+++ b/sources/pyside2/doc/_themes/pysidedocs_qthelp/static/logo_python.jpg
Binary files differ
diff --git a/sources/pyside2/doc/_themes/pysidedocs_qthelp/static/logo_qt.png b/sources/pyside2/doc/_themes/pysidedocs_qthelp/static/logo_qt.png
new file mode 100644
index 00000000..3bc03b7c
--- /dev/null
+++ b/sources/pyside2/doc/_themes/pysidedocs_qthelp/static/logo_qt.png
Binary files differ
diff --git a/sources/pyside2/doc/_themes/pysidedocs_qthelp/static/minus.png b/sources/pyside2/doc/_themes/pysidedocs_qthelp/static/minus.png
new file mode 100644
index 00000000..da1c5620
--- /dev/null
+++ b/sources/pyside2/doc/_themes/pysidedocs_qthelp/static/minus.png
Binary files differ
diff --git a/sources/pyside2/doc/_themes/pysidedocs_qthelp/static/plus.png b/sources/pyside2/doc/_themes/pysidedocs_qthelp/static/plus.png
new file mode 100644
index 00000000..b3cb3742
--- /dev/null
+++ b/sources/pyside2/doc/_themes/pysidedocs_qthelp/static/plus.png
Binary files differ
diff --git a/sources/pyside2/doc/_themes/pysidedocs_qthelp/static/pyside.css b/sources/pyside2/doc/_themes/pysidedocs_qthelp/static/pyside.css
new file mode 100644
index 00000000..aee5e442
--- /dev/null
+++ b/sources/pyside2/doc/_themes/pysidedocs_qthelp/static/pyside.css
@@ -0,0 +1,1943 @@
+@import url('cookie-confirm.css') screen;
+
+/* -- admonitions -- */
+
+div.admonition {
+ margin: 1.5em 0 1.5em;
+ padding: 0;
+}
+
+div.admonition dt {
+ font-weight: bold;
+}
+
+div.admonition dl {
+ margin-bottom: 0;
+}
+
+p.admonition-title {
+ margin: 0px 10px 5px 0px;
+ font-weight: bold;
+}
+
+div.admonition code {
+ font-family: inherit;
+}
+
+p.admonition-title + p {
+ padding-left: 1em;
+}
+
+div.admonition a:after {
+ content: ', ';
+}
+
+div.admonition a:last-child:after {
+ content: '';
+}
+
+.body {
+ width: 100%
+}
+.bodywrapper .admonition p.admonition-title {
+ margin-bottom:5px
+}
+
+.bodywrapper .admonition p {
+ margin:0
+}
+
+div.body p.centered {
+ text-align: center;
+ margin-top: 25px;
+}
+
+div.warning, div.seealso, div.note {
+ padding: 6px 0px 6px 10px;
+ border: none;
+}
+
+div.warning {
+ background-color: #ffe4e4;
+}
+
+div.seealso {
+ background-color: #fff2d6;
+}
+
+div.note {
+ background-color: #f3f3f4;
+}
+
+table.docutils {
+ margin-right: auto;
+ margin-bottom: 10px;
+ border: none;
+ width: initial;
+}
+
+table.docutils.colwidths-given td {
+ float: none;
+}
+
+table.docutils th,
+table.docutils td {
+ padding-left:0;
+ border: none;
+}
+
+table.docutils td ul {
+ margin:0
+}
+
+table.docutils td ul > li {
+ margin: 0 0 0.5em;
+}
+h2 em {
+ float: right;
+ font-size: 10px;
+ position: relative;
+ top: -20px;
+}
+
+.document {
+ padding-bottom: 20px;
+}
+
+.documentwrapper {
+ margin-left: 20px;
+}
+
+.body blockquote {
+ border: none;
+ padding-left: 0;
+ margin-bottom: 1.5em;
+}
+
+.sphinxsidebar {
+ float: left;
+ width: 186px;
+ padding: 25px;
+ text-align: left;
+ background-color: #fff;
+}
+
+.sphinxsidebar ul {
+ padding: 0px;
+ margin: 0px;
+ list-style-position: inside;
+}
+
+.sphinxsidebar > ul {
+ padding: 0px;
+ margin: 0px;
+}
+
+.sphinxsidebar ul li li {
+ margin-left: 10px;
+ padding: 0px;
+ font-size: 0.95em;
+}
+
+.sphinxsidebar ul a,
+.sphinxsidebar p.topless a {
+ word-break: break-word;
+}
+
+.sphinxsidebar h3, .sphinxsidebar h3 a {
+ color: #333;
+}
+
+.sphinxsidebar p.topless {
+ margin: 1em 0 1em;
+}
+
+.pysidetoc ul {
+ list-style: none;
+ padding: 0px;
+ margin: 0px;
+}
+
+.pysidetoc em {
+ font-style: normal;
+}
+
+.pysidetoc strong {
+ display: block;
+ padding: 5px;
+ margin: 0 10px 10px 0;
+ border: none;
+ background-color: #e2e2e2;
+}
+
+.section .docutils.container td {
+ float:left;
+}
+
+.hide {
+ display: none;
+}
+
+/* copy-notice */
+.document + p {
+ margin-left: 255px;
+ width: 70%;
+ font-size: 0.75em;
+ margin: 0 35px 15px 280px;
+}
+
+#searchbox {
+ border-top: 1px solid #989898;
+ padding-top: 10px;
+ margin-left: -10px;
+ margin-right: -10px;
+ padding-left: 10px;
+ padding-right: 10px;
+}
+
+#search_button {
+ border: 1px solid #3A393A;
+ background-color: #3A393A;
+ color: white;
+ cursor: pointer;
+ -moz-border-radius: 5px;
+ -webkit-border-radius: 5px;
+ -khtml-border-radius: 5px;
+
+}
+
+form {
+ margin: 0px;
+ padding: 0px;
+}
+
+#searchbox h3 {
+ padding: 10px 0 0 0;
+ margin-bottom: 5px;
+}
+
+/* search field */
+form #q {
+ width: 136px;
+ /* height: 22px; */
+ /* border: none; */
+ margin: 0px;
+ -moz-border-radius: 5px;
+ -webkit-border-radius: 5px;
+ -khtml-border-radius: 5px;
+ margin-top: 2px;
+ padding: 4px;
+ line-height: 22px;
+}
+
+#search-results h2 {
+ display: none;
+}
+
+#search-results h2 {
+ display: none;
+}
+
+#search-results ul.search {
+ margin: 0px;
+ padding: 0px;
+}
+
+ul.search div.context {
+ padding-left: 40px;
+}
+
+#installation td {
+ text-align: center;
+ font-weight: bold;
+}
+
+em {
+ color: inherit;
+ font-style:italic;
+}
+
+/******** REL bar *********/
+
+.related {
+ display: inline;
+}
+
+.related h3 {
+ display: none;
+}
+
+.align-center {
+ text-align: center;
+}
+
+.contentstable {
+ width: 100%;
+}
+
+.contentstable td {
+ padding-left: 30px;
+ vertical-align: top;
+}
+
+p.biglink a {
+ font-size: 20px;
+}
+
+dt:target, .highlight {
+ background-color: #fbe54e;
+}
+
+p.highlight-link {
+ margin-top: 10px;
+ font-size: 0.8em;
+}
+
+#synopsis table, table.field-list {
+ margin: 1em 0 1em 0;
+}
+
+table.field-list tr {
+ text-align: left;
+}
+
+tt.descname {
+ font-size: 120%;
+ font-weight: bold;
+}
+
+#functions ul, #virtual-functions ul, #slots ul, #signals ul, #static-functions ul {
+ margin: 0;
+ padding: 6px;
+ border: 1px solid #ddd;
+ border-radius: 0;
+ background-color: #e2e2e2;
+}
+
+#functions p, #virtual-functions p, #slots p, #signals p, #static-functions p {
+ margin: 0;
+ padding: 0;
+}
+
+#functions li, #virtual-functions li, #slots li, #signals li, #static-functions li {
+ list-style: none;
+ margin: 5px;
+ padding: 0;
+ font-size: 90%;
+}
+
+#synopsis span.pre {
+ color: #009491;
+ font-weight: bolder;
+}
+
+#detailed-description .class dt,
+#detailed-description .method dt,
+#detailed-description .staticmethod dt,
+#detailed-description .attribute dt {
+ margin: 0px;
+ margin-bottom: 10px;
+ padding: 10px;
+ font-weight: bold;
+ background-color: #e2e2e2;
+ border: none;
+ border-radius: 0;
+}
+
+#detailed-description dd > blockquote,
+#detailed-description dd > .field-list {
+ font-family: monospace;
+ font-size: small;
+ border-left: 10px solid #e2e2e2;
+ padding-left: 10px;
+ margin-bottom: 1.5em;
+}
+
+#detailed-description dd > blockquote blockquote {
+ border: none;
+ padding: 0;
+}
+
+#detailed-description .class .field-odd,
+#detailed-description .method .field-odd,
+#detailed-description .staticmethod .field-odd,
+#detailed-description .attribute .field-odd {
+ margin: 0;
+ padding: 1px 0 0 0;
+ background-color: #ffffff;
+
+}
+
+#detailed-description .class .field-even,
+#detailed-description .method .field-even,
+#detailed-description .staticmethod .field-even,
+#detailed-description .attribute .field-even {
+ margin: 0;
+ padding: 1px 0 0 0;
+ background-color: #ffffff;
+}
+
+#detailed-description .class .field-odd li,
+#detailed-description .method .field-odd li,
+#detailed-description .staticmethod .field-odd li,
+#detailed-description .attribute .field-odd li {
+ list-style: none;
+ margin: 0;
+ padding: 0;
+
+}
+
+#detailed-description .class .field-even li,
+#detailed-description .method .field-even li,
+#detailed-description .staticmethod .field-even li,
+#detailed-description .attribute .field-even li {
+ list-style: none;
+ margin: 0;
+ padding: 0;
+}
+
+#detailed-description .class .field-odd p,
+#detailed-description .method .field-odd p,
+#detailed-description .staticmethod .field-odd p,
+#detailed-description .attribute .field-odd p{
+ margin: 0;
+ margin-left: 20px;
+
+}
+
+#detailed-description .class .field-even p,
+#detailed-description .method .field-even p,
+#detailed-description .staticmethod .field-even p,
+#detailed-description .attribute .field-even p{
+ margin: 0;
+ margin-left: 20px;
+}
+
+#detailed-description .class .field-odd p:last-child,
+#detailed-description .method .field-odd p:last-child,
+#detailed-description .staticmethod .field-odd p:last-child,
+#detailed-description .attribute .field-odd p:last-child {
+ margin-bottom: 10px;
+
+}
+
+#detailed-description .class .field-even p:last-child,
+#detailed-description .method .field-even p:last-child,
+#detailed-description .staticmethod .field-even p:last-child,
+#detailed-description .attribute .field-even p:last-child{
+ margin-bottom: 10px;
+}
+
+.document dl.attribute,
+.document dl.class,
+.document dl.method,
+.document dl.staticmethod {
+ margin-top: 2em;
+}
+
+.document dl.attribute dd,
+.document dl.class dd,
+.document dl.method dd,
+.document dl.staticmethod dd {
+ padding-left: 1em;
+}
+
+#detailed-description .attribute td:nth-child(1) {
+ font-family: monospace;
+}
+
+/* Qt theme */
+#navbar {
+ position:fixed;
+ top:0;
+ left:0;
+ z-index:100;
+ background:#fff;
+ width:100%
+}
+#navbar .container, .fixed .container {
+ max-width:1280px;
+ margin:0 auto;
+ padding:0 3.9%; /* 0? */
+ position:relative;
+ overflow:visible
+}
+#navbar .navbar-header {
+ position:relative
+}
+#menuextras li a:hover span {
+ color: #41cd52;
+}
+/* new header */
+#mm-wrap, #mm-wrap #mm-helper,
+#mm-wrap #mm-helper li.mm-item,
+#mm-wrap #mm-helper a.mm-link {
+ -moz-transition: none;
+ -o-transition: none;
+ -webkit-transition: none;
+ transition: none;
+ -webkit-border-radius: 0 0 0 0;
+ -moz-border-radius: 0 0 0 0;
+ -ms-border-radius: 0 0 0 0;
+ -o-border-radius: 0 0 0 0;
+ border-radius: 0 0 0 0;
+ -webkit-box-shadow: none;
+ -moz-box-shadow: none;
+ -ms-box-shadow: none;
+ -o-box-shadow: none;
+ box-shadow: none;
+ background: none;
+ border: 0;
+ bottom: auto;
+ box-sizing: border-box;
+ clip: auto;
+ color: #090e21;
+ display: block;
+ float: none;
+ font-family: inherit;
+ font-size: 14px;
+ height: auto;
+ left: auto;
+ line-height: 1.7;
+ list-style-type: none;
+ margin: 0;
+ min-height: 0;
+ opacity: 1;
+ outline: none;
+ overflow: visible;
+ padding: 0;
+ position: relative;
+ right: auto;
+ text-align: left;
+ text-decoration: none;
+ text-transform: none;
+ top: auto;
+ vertical-align: baseline;
+ visibility: inherit;
+ width: auto;
+}
+#mm-wrap #mm-helper {
+ visibility:visible;
+ text-align:right;
+ padding:0 0px 0 0px
+}
+#navbar #mm-wrap #mm-helper li.mm-item {
+ border-right:solid #f3f3f4 1px;
+ padding-right:30px;
+ padding-left:30px
+}
+#navbar #mm-wrap #mm-helper li.mm-item > a:hover {
+ opacity: .5
+}
+#mm-wrap #mm-helper > li.mm-item {
+ margin:0 0 0 0;
+ display:inline-block;
+ height:auto;
+ vertical-align:middle
+}
+#navbar #mm-wrap #mm-helper li.mm-item:nth-child(3) {
+ border-right:0
+}
+#mm-wrap #mm-helper a.mm-link {
+ cursor: pointer
+}
+@media (max-width: 1279px) {
+ #navbar {
+ padding:0;
+ position:relative;
+ }
+ #navbar .container {
+ max-width:100%
+ }
+ .container {
+ padding:0 2%
+ }
+}
+#navbar .navbar-oneQt {
+ display:inline;
+ float:left;
+ width:31px;
+ color:#41cd52
+}
+#navbar .navbar-oneQt:before {
+ content:attr(data-icon);
+ position:absolute;
+ top:14px;
+ left:0;
+ color:#41cd52;
+ font-family:'Qt Icons';
+ line-height:1;
+ font-size:40px;
+ transition:all 0.3s ease-in-out;
+}
+#mm-wrap {
+ clear:both;
+ background:rgba(255, 255, 255, 0.1);
+ -webkit-border-radius:0px 0px 0px 0px;
+ -moz-border-radius:0px 0px 0px 0px;
+ -ms-border-radius:0px 0px 0px 0px;
+ -o-border-radius:0px 0px 0px 0px;
+ border-radius:0px 0px 0px 0px
+}
+#mm-wrap #mm-helper li.mm-item:last-child a {
+ background:transparent url("icon_avatar.png") 50% 50% no-repeat !important;
+ background-size:24px !important;
+ width:24px !important;
+ height:24px !important;
+}
+#navbar #mm-wrap #mm-helper li.mm-item > a {
+ opacity:1;
+ -webkit-transition:all 0.3s ease-in-out;
+ -moz-transition:all 0.3s ease-in-out;
+ -ms-transition:all 0.3s ease-in-out;
+ -o-transition:all 0.3s ease-in-out;
+ transition:all 0.3s ease-in-out;
+}
+#mm-wrap #mm-helper > li.mm-item > a.mm-link {
+ border-top:0px solid #fff;
+ border-left:0px solid #fff;
+ border-right:0px solid #fff;
+ border-bottom:0px solid #fff;
+ outline:none;
+ text-decoration:none;
+ padding:0 0 0 0;
+ line-height:70px;
+ font-weight:normal;
+ height:70px;
+ vertical-align:baseline;
+ text-align:left;
+ width:auto;
+ display:block;
+ color:#090e21;
+ text-transform:none;
+ text-decoration:none;
+ background:rgba(0, 0, 0, 0);
+ -webkit-border-radius:0px 0px 0px 0px;
+ -moz-border-radius:0px 0px 0px 0px;
+ -ms-border-radius:0px 0px 0px 0px;
+ -o-border-radius:0px 0px 0px 0px;
+ border-radius:0px 0px 0px 0px;
+ font-family:inherit;
+ font-size:14px;
+}
+/* end new header */
+@media (min-width: 1320px) {
+ .body .flowListDiv dl.flowList {
+ -webkit-column-count:3;
+ -moz-column-count:3;
+ column-count:3
+ }
+}
+@media (min-width: 1120px) {
+ #navbar.fixed {
+ -moz-box-shadow:0px 0px 8px rgba(0,0,0,0.23);
+ -webkit-box-shadow:0px 0px 8px rgba(0,0,0,0.23);
+ box-shadow:0px 0px 8px rgba(0,0,0,0.23)
+ }
+ #navbar.fixed #mm-wrap #mm-helper > li.mm-item > a.mm-link {
+ height:50px;
+ line-height:50px
+ }
+ #navbar.fixed .navbar-oneQt:before {
+ font-size:35px;
+ top:7px
+ }
+
+ .flowListDiv dl.flowList {
+ -webkit-column-count:2;
+ -moz-column-count:2;
+ column-count:2
+ }
+}
+@media (max-width: 1120px) {
+ #navbar {
+ padding:0;
+ position:relative
+ }
+ #navbar .navbar-oneQt:before {
+ left:10px
+ }
+ #navbar .container {
+ max-width:100%;
+ padding:0
+ }
+ #footerbar .container {
+ padding:0
+ }
+ body .main {
+ margin-top:0px
+ }
+ #footerbar .footer-main .footer-nav {
+ padding:3.9% 0 3.9% 3%;
+ border-bottom:1px solid #413d3b;
+ float:none;
+ display:block;
+ width:auto
+ }
+ #footerbar .footer-main .theqtcompany {
+ clear:both;
+ float:left;
+ margin:30px 0 8px 3%
+ }
+ #footerbar .footer-main .footer-social {
+ float:left;
+ padding:50px 0px 0px 3%
+ }
+ #footerbar #menu-footer-submenu {
+ clear:both;
+ float:none;
+ display:block;
+ padding:0px 0px 3.9% 3%
+ }
+ ul#menu-footer-submenu {
+ margin-left: 0
+ }
+}
+.cookies_yum {
+ background-color:#cecfd5;
+ display:none;
+ width:100%
+}
+.cookies_yum img {
+ width:25px;
+ top:6px;
+ display:inline-block;
+ position:absolute;
+ left:13px
+}
+.cookies_yum div {
+ margin:0 auto;
+ max-width:1280px;
+ min-height:30px;
+ padding:6px 0px 6px 0px;
+ position:relative
+}
+.cookies_yum p {
+ color:#09102b;
+ margin:0px;
+ font-size:0.79em;
+ display:inline-block;
+ line-height:1.2;
+ padding:0 30px 0 50px
+}
+.cookies_yum p a {
+ white-space:nowrap
+}
+.cookies_yum a:hover {
+ color:#46a2da
+}
+.cookies_yum .close {
+ width:15px;
+ height:15px;
+ background-image:url("cookiebar-x.png");
+ background-size:15px 30px;
+ background-position:top left;
+ cursor:pointer;
+ top:13px;
+ right:13px;
+ position:absolute;
+ transition:none
+}
+.cookies_yum .close:hover {
+ background-position:bottom left
+}
+#sidebar-toggle,#toc-toggle {
+ width:24px;
+ height:14px;
+ background-size:24px 28px;
+ cursor:pointer;
+ background-image:url("list_expand.png");
+ float:right
+}
+#sidebar-toggle.collapsed,
+#toc-toggle.collapsed {
+ background-position:bottom left
+}
+#sidebar-content > h2 {
+ display:none
+}
+#footerbar {
+ background:#222840;
+ color:#fff;
+ font-size: 0.9em;
+}
+#footerbar.fixed {
+ bottom:0;
+ left:0;
+ width:100%
+}
+#footerbar .footer-nav {
+ display:inline;
+ float:left
+}
+#footerbar .footer-main .footer-nav li {
+ float:left;
+ margin-right:1em
+}
+#footerbar .footer-main .footer-nav li a {
+ display:block;
+ padding:30px 0 10px 0;
+ line-height:20px;
+ height:20px;
+ color:#fff;
+ font-weight: 600;
+}
+#footerbar .footer-main .footer-nav li a:hover,#footerbar .footer-main .footer-nav li.current-menu-item a {
+ color:#eee
+}
+#footerbar .footer-main .footer-nav .sub-menu {
+ margin-left:0;
+ margin-bottom:0
+}
+#footerbar .footer-main .footer-nav .sub-menu li {
+ float:none;
+ width: 100%;
+}
+#footerbar .footer-main .footer-nav .sub-menu ul {
+ padding:1px 1em;
+ font-size:0.786em;
+ line-height:8px;
+ float:none;
+ color:#5d5b59;
+ margin-bottom:0
+}
+#footerbar .footer-main .footer-nav .sub-menu li a {
+ padding:2px 0;
+ font-size:1em;
+ float:none;
+ color:#cecfd5;
+ font-weight: 400;
+}
+#footerbar .footer-main .footer-nav .sub-menu li a:hover,#footerbar .footer-main .footer-nav .sub-menu li.current-menu-item a {
+ color:#eee
+}
+#footerbar .theqtcompany {
+ background:url("theqtcompany.png") no-repeat;
+ background-size:100%;
+ width:215px;
+ height:68px;
+ display:inline;
+ float:right;
+ margin:29px 0 28px 30px
+}
+#footerbar .footer-social {
+ display:inline;
+ float:right;
+ width:164px
+}
+#footerbar .footer-main .footer-social>div {
+ margin-left:0.1em;
+ margin-bottom:10px
+}
+#footerbar .disclaimer {
+ font-size:0.786em;
+ line-height:2.73;
+ color:#868584;
+ padding-top:20px;
+ padding-bottom:0.5%
+}
+#footerbar .disclaimer a {
+ color:#bdbebf
+}
+#footerbar .disclaimer a:hover {
+ color:#d6d6d6
+}
+#footerbar .disclaimer ul li {
+ float:left;
+ vertical-align:middle;
+ margin-left:1.18em
+}
+#footerbar .disclaimer ul li:first-child {
+ margin-left:0
+}
+#footerbar .disclaimer ul.lang-selector a {
+ color:#506a34;
+ color:rgba(128,195,66,0.3)
+}
+#footerbar .disclaimer ul.lang-selector a:hover {
+ color:#80c342;
+ color:rgba(128,195,66,0.7)
+}
+#menu-footer-menu, #menu-footer-menu ul {
+ margin-left:0;
+ margin-bottom:0
+}
+@font-face {
+ font-family: 'Titillium Web';
+ font-style: normal;
+ font-weight: 400;
+ src: url("//d33sqmjvzgs8hq.cloudfront.net/wp-content/themes/oneqt/assets/fonts/titillium-web-v4-latin_latin-ext-regular.eot");
+ /* IE9 Compat Modes */
+ src: local("Titillium Web"), local("TitilliumWeb-Regular"), url("//d33sqmjvzgs8hq.cloudfront.net/wp-content/themes/oneqt/assets/fonts/titillium-web-v4-latin_latin-ext-regular.eot?#iefix") format("embedded-opentype"), url("//d33sqmjvzgs8hq.cloudfront.net/wp-content/themes/oneqt/assets/fonts/titillium-web-v4-latin_latin-ext-regular.woff2") format("woff2"), url("//d33sqmjvzgs8hq.cloudfront.net/wp-content/themes/oneqt/assets/fonts/titillium-web-v4-latin_latin-ext-regular.woff") format("woff"), url("//d33sqmjvzgs8hq.cloudfront.net/wp-content/themes/oneqt/assets/fonts/titillium-web-v4-latin_latin-ext-regular.ttf") format("truetype"), url("//d33sqmjvzgs8hq.cloudfront.net/wp-content/themes/oneqt/assets/fonts/titillium-web-v4-latin_latin-ext-regular.svg#TitilliumWeb") format("svg");
+ /* Legacy iOS */
+}
+/* titillium-web-italic - latin_latin-ext */
+@font-face {
+ font-family: 'Titillium Web';
+ font-style: italic;
+ font-weight: 400;
+ src: url("//d33sqmjvzgs8hq.cloudfront.net/wp-content/themes/oneqt/assets/fonts/titillium-web-v4-latin_latin-ext-italic.eot");
+ /* IE9 Compat Modes */
+ src: local("Titillium WebItalic"), local("TitilliumWeb-Italic"), url("//d33sqmjvzgs8hq.cloudfront.net/wp-content/themes/oneqt/assets/fonts/titillium-web-v4-latin_latin-ext-italic.eot?#iefix") format("embedded-opentype"), url("//d33sqmjvzgs8hq.cloudfront.net/wp-content/themes/oneqt/assets/fonts/titillium-web-v4-latin_latin-ext-italic.woff2") format("woff2"), url("//d33sqmjvzgs8hq.cloudfront.net/wp-content/themes/oneqt/assets/fonts/titillium-web-v4-latin_latin-ext-italic.woff") format("woff"), url("//d33sqmjvzgs8hq.cloudfront.net/wp-content/themes/oneqt/assets/fonts/titillium-web-v4-latin_latin-ext-italic.ttf") format("truetype"), url("//d33sqmjvzgs8hq.cloudfront.net/wp-content/themes/oneqt/assets/fonts/titillium-web-v4-latin_latin-ext-italic.svg#TitilliumWeb") format("svg");
+ /* Legacy iOS */
+}
+/* titillium-web-600 - latin_latin-ext */
+@font-face {
+ font-family: 'Titillium Web';
+ font-style: normal;
+ font-weight: 600;
+ src: url("//d33sqmjvzgs8hq.cloudfront.net/wp-content/themes/oneqt/assets/fonts/titillium-web-v4-latin_latin-ext-600.eot");
+ /* IE9 Compat Modes */
+ src: local("Titillium WebSemiBold"), local("TitilliumWeb-SemiBold"), url("//d33sqmjvzgs8hq.cloudfront.net/wp-content/themes/oneqt/assets/fonts/titillium-web-v4-latin_latin-ext-600.eot?#iefix") format("embedded-opentype"), url("//d33sqmjvzgs8hq.cloudfront.net/wp-content/themes/oneqt/assets/fonts/titillium-web-v4-latin_latin-ext-600.woff2") format("woff2"), url("//d33sqmjvzgs8hq.cloudfront.net/wp-content/themes/oneqt/assets/fonts/titillium-web-v4-latin_latin-ext-600.woff") format("woff"), url("//d33sqmjvzgs8hq.cloudfront.net/wp-content/themes/oneqt/assets/fonts/titillium-web-v4-latin_latin-ext-600.ttf") format("truetype"), url("//d33sqmjvzgs8hq.cloudfront.net/wp-content/themes/oneqt/assets/fonts/titillium-web-v4-latin_latin-ext-600.svg#TitilliumWeb") format("svg");
+ /* Legacy iOS */
+}
+@font-face {
+ font-family:monospace;
+ font-style:normal;
+ font-weight:400;
+ src:local("Droid Sans Mono"),local("DroidSansMono"),url(//fonts.gstatic.com/s/droidsansmono/v7/ns-m2xQYezAtqh7ai59hJUYuTAAIFFn5GTWtryCmBQ4.woff) format("woff")
+}
+@font-face {
+ font-family:'Qt Icons';
+ src:url("../style/icomoon.eot?-tgjuoj");
+ src:url("../style/icomoon.eot?#iefix-tgjuoj") format("embedded-opentype"),url("../style/icomoon.woff?-tgjuoj") format("woff"),url("../style/icomoon.ttf?-tgjuoj") format("truetype"),url("../style/icomoon.svg?-tgjuoj#icomoon") format("svg");
+ font-weight:normal;
+ font-style:normal
+}
+@font-face {
+ font-family:'social-icons';
+ src:url("../style/social-icons.eot?54625607");
+ src:url("../style/social-icons.eot?54625607#iefix") format("embedded-opentype"),
+ url("../style/social-icons.woff?54625607") format("woff");
+ font-weight:normal;
+ font-style:normal
+}
+.clearfix:before,.clearfix:after {
+ content:" ";
+ display:table
+}
+.clearfix:after {
+ clear:both
+}
+.clearfix {
+ *zoom:1
+}
+.clearfix .right {
+ float:right
+}
+html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video {
+ margin:0;
+ padding:0;
+ border:0;
+ font-size:100%;
+ line-height: 1.4;
+}
+html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,caption,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video {
+ vertical-align:baseline
+}
+h1,h2,h3,h4,h5,h6 {
+ font-weight:300
+}
+.body h2,.body h3,.body h4,.body h5,.body h6 {
+ margin:1.5em 0 0.75em
+}
+.body h1 {
+ margin-bottom:0.75em;
+ font-size:2.25em;
+}
+.body h3.fn,.body h3.flags {
+ color:#26282a;
+ font-size:1.46em;
+ padding:15px 0 15px 0;
+ border-bottom:2px #eee solid;
+ word-wrap:break-word
+}
+.body .fngroup {
+ border-bottom:2px #eee solid;
+ padding-bottom:15px;
+ margin-bottom:1.5em
+}
+.body .fngroup h3.fngroupitem {
+ margin:0;
+ padding-bottom:0;
+ border:none
+}
+.body h3.fn .name,
+.body h3 span.type,
+.qmlname span.name {
+ font-weight: 400
+}
+.qmlname {
+ font-size:1.46em
+}
+.qmlproto table {
+ border:none;
+ border-bottom:2px #eee solid
+}
+.qmlproto table p {
+ max-width:100%
+}
+.qmlproto table tr {
+ background-color:#fff
+}
+.qmlname td, .qmlname th {
+ border:none;
+ text-align:left;
+ padding:5px 0 0 0
+}
+.qmlreadonly,.qmldefault {
+ padding:0 5px 0 5px;
+ font-size:0.75em;
+ background-color:#eee;
+ float:right
+}
+.qmlreadonly {
+ color:#414141
+}
+.qmldefault {
+ color:#D14141
+}
+.rightAlign {
+ padding:3px 5px 3px 10px;
+ text-align:right
+}
+.centerAlign.functionIndex {
+ text-align:center;
+ font-size:150%;
+ margin-bottom: 1em
+}
+article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section {
+ display:block
+}
+body {
+ line-height:1.25em;
+ font-family: Arial, Helvitica;
+ font-weight:400;
+ transition-duration:1s;
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+ font-size: 16px;
+ background-color:#f3f3f4;
+ color:#404244;
+}
+ol,ul {
+ list-style-type: square;
+ #color: #17a81a;
+}
+.body ol,.body ul {
+ margin-top:0.75em;
+ margin-left:20px
+}
+.bodywrapper ol>li {
+ list-style-type:decimal;
+ margin-left:15px
+}
+.bodywrapper ol.a >li {
+ list-style-type:lower-alpha;
+}
+.bodywrapper ol.A >li {
+ list-style-type:upper-alpha;
+}
+.bodywrapper ol.i >li {
+ list-style-type:lower-roman;
+}
+.bodywrapper ol.I >li {
+ list-style-type:upper-roman;
+}
+.body li p {
+ margin-top:1em
+}
+blockquote,q {
+ quotes:none;
+ border-left:10px solid #ddd;
+ padding-left:10px
+}
+blockquote:before,blockquote:after,q:before,q:after {
+ content:'';
+ content:none;
+ width:100%
+}
+table {
+ border-collapse:collapse;
+ border-spacing:0;
+ margin-bottom:5px;
+ width:100%
+}
+a {
+ color:#17a81a;
+ text-decoration:none;
+ transition-duration:0.3s
+}
+a:hover {
+ color:#17a81a
+}
+.main,#footerbar>div {
+ max-width:1280px;
+ width:95%;
+ margin:0 auto
+}
+.main {
+ margin-top:80px
+}
+@media (max-width: 1120px) {
+ .main,.navbar-header,#footerbar>div {
+ width: 100%;
+ margin: 0;
+ }
+ .main .main-rounded {
+ padding: 0 15px;
+ }
+}
+.main_index {
+ background-color:#fff
+}
+.sectionlist {
+ margin-bottom:2em
+}
+[class*="col-"] {
+ letter-spacing:normal
+}
+.landing,.main_index .row {
+ letter-spacing:-0.31em
+}
+.main_index .row>div {
+ letter-spacing:normal
+}
+.col-1,.body {
+ display:inline-block;
+ background-color:#fff;
+ padding: 25px 35px 20px 30px;
+ -webkit-box-sizing:border-box;
+ -moz-box-sizing:border-box;
+ -ms-box-sizing:border-box;
+ box-sizing:border-box;
+}
+.col-1 h2 {
+ font-size:1.8em;
+ font-weight:300;
+ line-height:1.1;
+ margin-bottom:0.83em;
+ margin-top:1em
+}
+.icons1of3 img {
+ display:inline-block;
+ float:left;
+ margin-right:0.75em;
+ margin-top:-5px;
+ width:2.75em
+}
+div.multi-column {
+ position:relative
+}
+div.multi-column div {
+ display:-moz-inline-box;
+ display:inline-block;
+ vertical-align:top;
+ margin-top:1em;
+ margin-right:2em;
+ width:16em
+}
+.sidebar {
+ display:block;
+ position:relative;
+ position:sticky;
+ float:left;
+ -webkit-box-sizing:border-box;
+ -moz-box-sizing:border-box;
+ -ms-box-sizing:border-box;
+ box-sizing:border-box;
+ width:20%;
+ padding-right:20px
+}
+.sidebar li {
+ text-overflow:ellipsis;
+ overflow:hidden
+}
+.toc,.sectionlist {
+ padding:25px;
+ background-color:#fff;
+ margin-bottom:1.25em
+}
+.sidebar .sectionlist p {
+ margin-bottom:0
+}
+.sectionlist.promo {
+ padding:0;
+ background-color:#f3f3f4
+}
+.sidebar-content:empty {
+ display:none;
+ visibility:hidden
+}
+.col-2 h2,.toc h3,.sidebar-content h2,
+.sidebar-content h3,.sectionlist h2,
+.sphinxsidebar {
+ position: fixed;
+ overflow: scroll;
+ overflow-x: hidden;
+ overflow-y: hidden;
+}
+.sphinxsidebar h3 {
+ font-weight: bold;
+ margin-bottom:1em;
+}
+.toc h3 a {
+ color:#404244
+}
+.title {
+ font-size:2.25em;
+ font-weight:300;
+ letter-spacing:-1px;
+ line-height:1.15em;
+ margin-bottom:0.5em;
+ word-wrap:break-word
+}
+.navigationbar,col-1 h2 {
+ font-size:0.85em
+}
+.navigationbar h1 {
+ font-size:2.5em;
+ margin-bottom:0.85em;
+ margin-top:0.85em
+}
+.navigationbar li {
+ display:inline-block;
+ margin-right:5px;
+ position:relative;
+ padding-right:10px;
+ color:#585a5c
+}
+.navigationbar ul:last-of-type li a {
+ color:#404244
+}
+.sectionlist li, .sphinxsidebar li {
+ padding-bottom: 10px;
+ line-height: 1.75em;
+}
+.col-1 ul {
+ margin-bottom:1.56em
+}
+.bodywrapper li {
+ margin-top:0.5em;
+ line-height:1.25em
+}
+.bodywrapper li.level2 {
+ margin-left:10px;
+ margin-top:0.4em;
+ font-size:0.9375em;
+}
+.bodywrapper p,
+.bodywrapper dd {
+ line-height:1.25em;
+ margin:1em 0 1em;
+ color:#404244
+}
+.bodywrapper b {
+ font-weight:600
+}
+.body ul,.body ol {
+ /* margin-bottom:1.5em */
+}
+.bodywrapper ul ul {
+ margin-top:0.5em
+}
+.bodywrapper .naviNextPrevious {
+ margin-top:25px;
+ max-width:100%
+}
+.naviNextPrevious.headerNavi,
+p.naviNextPrevious + p {
+ display:none
+}
+.nextPage {
+ float:right
+}
+.prevPage:before {
+ content:"< "
+}
+.nextPage:after {
+ content:" >"
+}
+.navigationbar li a {
+ color:#404244
+}
+.navigationbar li:after {
+ color:#404244;
+ content:"›";
+ display:inline-block;
+ font-size:1.5em;
+ line-height:1;
+ position:absolute;
+ right:-2px;
+ top:-4px
+}
+.sub-navigation {
+ margin-top:10px
+}
+.navigationbar li:last-child:after,.sub-navigation li:after {
+ content:none
+}
+.navigationbar {
+ margin-bottom:10px;
+ line-height:1em
+}
+#buildversion {
+ margin-bottom:10px;
+ font-style:italic;
+ font-size:small;
+ float:right
+}
+.copy-notice {
+ width:75%;
+ font-size:0.75em;
+ margin:20px 35px 0 10px;
+ line-height:1.75em;
+ float:right;
+ color:#585a5c
+}
+.copy-notice.index {
+ margin-top:10px;
+ float:none
+}
+li a.active {
+ color:#585a5c
+}
+.flowList {
+ padding:25px
+}
+.flowListDiv dl {
+ -webkit-column-count:1;
+ -moz-column-count:1;
+ column-count:1
+}
+.flowList dd {
+ display:inline-block;
+ margin-left:10px;
+ width:90%;
+ line-height:1.15em;
+ overflow-x:hidden;
+ text-overflow:ellipsis
+}
+.alphaChar {
+ font-size:2em;
+ position:absolute
+}
+.flowList.odd {
+ background-color:#f9f9f9
+}
+.body ul>li,.doc-column ul>li {
+ list-style-image:url("list_arrow.png");
+ margin-left:15px;
+ color:#404244;
+ margin-top:0.65em;
+ line-height:1em
+}
+.bodywrapper table p {
+ margin:0px;
+ padding:0px
+}
+.bodywrapper table p {
+ margin:0px;
+ padding:0px;
+ min-height:1.25em
+}
+.bodywrapper .qmldoc {
+ margin-top:0.75em
+}
+.body h2 {
+ margin-top: 1.5em;
+ font-size:1.75em
+}
+.body h3 {
+ font-size:1.35em
+}
+.body h4 {
+ font-size:1.15em
+}
+.body p img {
+ margin-top:0.75em;
+ max-width:100%
+}
+.body .border img {
+ box-shadow:3px 3px 8px 3px rgba(200,200,200,0.5)
+}
+.body .border .player {
+ box-shadow:3px 3px 8px 3px rgba(200,200,200,0.5)
+}
+.body p.figCaption {
+ transform:translateY(-30px);
+ color:#606366;
+ font-size:95%;
+ margin-left:3px;
+ font-style:italic
+}
+.body table {
+ width:initial;
+ vertical-align:initial
+}
+table .odd {
+ background-color:#f9f9f9
+}
+table thead {
+ text-align:left;
+ padding-left:20px
+}
+table,table td,table th {
+ border:1px solid #eee
+}
+table td,table th {
+ padding:5px 20px;
+ line-height:1.3
+}
+.body .fixed table td {
+ min-width:50%;
+ width:50%
+}
+table.alignedsummary,table.propsummary {
+ width:initial
+}
+table.valuelist td.tblval {
+ font-size:0.75em
+}
+div.main_index .row {
+ border-bottom:10px solid #f3f3f4
+}
+div.main_index .row {
+ position:relative
+}
+div.main_index .row>div {
+ display:inline-block;
+ width:50%;
+ vertical-align:top;
+ padding:2em 3em;
+ -webkit-box-sizing:border-box;
+ -moz-box-sizing:border-box;
+ -ms-box-sizing:border-box;
+ box-sizing:border-box
+}
+div.main_index h2 {
+ font-size:2.1875em;
+ margin-bottom:1em
+}
+#search_bar {
+ width:40%;
+ float:right
+}
+div.main_index .row:after {
+ content:"";
+ position:absolute;
+ top:0;
+ right:50%;
+ height:100%;
+ width:10px;
+ background-color:#f3f3f4
+}
+div.table {
+ overflow-x:auto
+}
+.body tr > td > pre {
+ font-size:0.75em
+}
+p.qt_commercial {
+ border:3px solid #5caa15;
+ margin:0 auto;
+ padding:15px;
+ width:28%;
+ text-align:center;
+ clear:both
+}
+h1.qt_commercial {
+ padding:20px;
+ background-color:#5caa15;
+ display:inline;
+ float:right;
+ font-size:1.25em;
+ line-height:1.25em;
+ height:1.25em;
+ color:#fff
+}
+div.qt_commercial {
+ border-top:5px solid #5caa15;
+ margin-bottom:50px
+}
+div.pre {
+ position:relative;
+ height:auto
+}
+pre, .LegaleseLeft {
+ background-color:#222840;
+ color:#fff;
+ display:block;
+ font-family:monospace;
+ line-height:1.5;
+ overflow-x:auto;
+ margin-bottom:25px;
+ padding:25px;
+ margin-top:0.75em;
+ font-size: .8em;
+}
+.bodywrapper .LegaleseLeft p {
+ color:#fff;
+ white-space: pre-wrap
+}
+pre .str,code .str {
+ color:#aaaaaa
+}
+pre .kwd,code .kwd {
+ color:#ffff55
+}
+pre .com,code .com {
+ color:#55ffff
+}
+pre .typ,code .typ {
+ color:#4f9d08
+}
+pre a .typ,code a .typ {
+ color:#21be2b
+}
+pre .lit,code .lit {
+ color:#ff55ff
+}
+pre .pun,code .pun {
+ color:#fff
+}
+pre .pln,code .pln {
+ color:#fff
+}
+@media print {
+ pre {
+ background-color:#eee !important
+ }
+ pre .str,code .str {
+ color:#060
+ }
+ pre .kwd,code .kwd{
+ color:#006;
+ font-weight:bold
+ }
+ pre .com,code .com {
+ color:#600
+ }
+ pre .typ,code .typ {
+ color:#404;
+ font-weight:bold
+ }
+ pre .lit,code .lit {
+ color:#044
+ }
+ pre .pun,code .pun {
+ color:#440
+ }
+ pre .pln,code .pln {
+ color:#000
+ }
+}
+pre.wrap {
+ white-space:pre-wrap
+}
+pre span.wrap {
+ display:none;
+ background:url("wrap.png") no-repeat;
+ right:0;
+ top:2px;
+ position:absolute;
+ width:20px;
+ height:14px;
+ margin:4px;
+ opacity:0.65
+}
+
+span.pre {
+ color: #09102d;
+}
+
+span.wrap:hover {
+ opacity:1
+}
+span.wrap:active {
+ opacity:0.75
+}
+.copy_text {
+ background-color:#46a2da;
+ color:#fff;
+ border:2px solid #46a2da;
+ padding:10px 16px;
+ margin-left:-10px;
+ margin-top:-50px;
+ position:absolute;
+ opacity:0;
+ cursor:pointer;
+ float:right
+}
+.copy_text:hover {
+ background-color:#fff;
+ color:#46a2da
+}
+code,.codelike {
+ font-family:monospace;
+}
+#detailed-description .function dt > code,
+#detailed-description .function dt > em {
+ font-weight:bold
+}
+h3.fn code {
+ font-size:0.75em;
+ float:right;
+ background-color:#eee;
+ padding:3px;
+ margin: 3px 0 0 20px
+}
+pre:hover>.copy_text {
+ display:inline-block;
+ opacity:1;
+ transition:0.5s ease
+}
+#main_title_bar {
+ background:url("pyside-logo.png") no-repeat;
+ background-size:100%;
+ width:366px;
+ height:86px;
+ margin:15px 0 15px 0
+}
+#main_title_bar h1 {
+ visibility:hidden
+}
+#main_title_bar .search_bar {
+ letter-spacing:normal;
+ width:50%;
+ display:inline-block;
+ -webkit-box-sizing:border-box;
+ -moz-box-sizing:border-box;
+ -ms-box-sizing:border-box;
+ box-sizing:border-box;
+ vertical-align:middle
+}
+#main_title_bar h1 {
+ letter-spacing:normal;
+ display:inline-block;
+ -webkit-box-sizing:border-box;
+ -moz-box-sizing:border-box;
+ -ms-box-sizing:border-box;
+ box-sizing:border-box;
+ vertical-align:middle
+}
+#main_title_bar .search_bar * {
+ letter-spacing:normal;
+ padding:0;
+ margin:0;
+ border:none
+}
+#sidebar-toggle,#toc-toggle {
+ display:none
+}
+@media (max-width: 980px) {
+ body {
+ font-size:calc-em(14px)
+ }
+ #main_title_bar>h1,#main_title_bar .search_bar {
+ width:100%
+ }
+ #main_title_bar .search_bar {
+ margin-bottom:15px
+ }
+ .main {
+ margin-top:0px
+ }
+ .main_index .row {
+ border:none !important
+ }
+ .title {
+ font-size:1.5em;
+ font-weight:400;
+ word-wrap:break-word
+ }
+ .col-1,.body,.naviNextPrevious,.sidebar {
+ padding:10px
+ }
+ .sidebar {
+ position:relative;
+ padding-top:0
+ }
+ .search .sidebar {
+ display:none;
+ visibility:hidden
+ }
+ .col-2 h2,.toc h3,.sidebar-content h2,.sidebar-content h3,.sectionlist h2 {
+ text-align:center;
+ margin-bottom:5px
+ }
+ div.main_index .row:after {
+ content:none
+ }
+ div.main_index .row>div {
+ display:block !important;
+ width:100%;
+ padding:15px;
+ margin:0
+ }
+ .body,.sidebar,.col-1 {
+ width:100%
+ }
+ .sidebar-content,.col-2,.toc {
+ background-color:#fff;
+ margin-bottom:1em;
+ padding:20px
+ }
+ #sidebar-toggle,#toc-toggle {
+ display:block
+ }
+ #sidebar-toggle.collapsed + h2 {
+ display:block
+ }
+ .bodywrapper p {
+ margin-bottom:1em;
+ max-width:100%
+ }
+ table td,table th {
+ padding:5px 5px
+ }
+ .sectionlist {
+ padding:0
+ }
+ .sidebar > .sectionlist {
+ padding:20px
+ }
+ .sectionlist.promo {
+ max-width:46%;
+ margin:0 auto 1em auto;
+ float:left;
+ padding:0 2%
+ }
+ .sidebar .sidebar-content {
+ clear:both
+ }
+ .copy-notice {
+ float:none;
+ width:initial
+ }
+}
+[id]:target > *:first-child,
+dt[id]:target {
+ -webkit-animation:highlighter 3s;
+ animation:highlighter 3s
+}
+@-webkit-keyframes highlighter {
+ 25% {
+ background-color:#d1e8f6;
+ color:#444
+ }
+ 75% {
+ background-color:#d1e8f6;
+ color:#444
+ }
+}
+@keyframes highlighter {
+ 25% {
+ background-color:#d1e8f6;
+ color:#444
+ }
+ 75% {
+ background-color:#d1e8f6;
+ color:#444
+ }
+}
+@-webkit-keyframes copypaste {
+ 25% {
+ opacity:1
+ }
+ 100% {
+ border-radius:10px;
+ margin-top:-50px;
+ opacity:1
+ }
+}
+@keyframes copypaste {
+ 25% {
+ opacity:1
+ }
+ 100% {
+ border-radius:10px;
+ margin-top:-50px;
+ opacity:1
+ }
+}
+#footer {
+ clear:both
+}
+.footer-social i {
+ font-family: "social-icons";
+ font-style: normal;
+ font-size:150%;
+ margin: .55em;
+ color: #cecfd5
+}
+.footer-social i:hover {
+ color: #eee
+}
+.footer-social .icon-twitter:before {
+ content: '\f099'
+}
+.footer-social .icon-facebook:before {
+ content: '\f09a'
+}
+.footer-social .icon-youtube:before {
+ content: '\f16a'
+}
+.menuextraslanguages {
+ display:none;
+ visibility:hidden
+}
+
+input:focus {
+ border-color: #46a2da;
+ box-shadow: 0 0 5px #46a2da;
+ color: #000;
+}
+
+.animation {
+ width: 100%;
+ border-style: none;
+ border-width: 0
+}
+
+.player {
+ width: auto;
+ position: relative;
+ display: table;
+ margin-bottom:1.5em;
+}
+
+.playcontrol {
+ display: none;
+ background: url("play_icon.svg") no-repeat center,
+ linear-gradient(
+ rgba(0,0,0,0.15), rgba(0,0,0,0.15)
+ );
+ background-size: 25%;
+ width: 100%;
+ height: 100%;
+ position: absolute;
+ left: 0%;
+ right: 0%;
+ top: 0%;
+ bottom: 0%;
+ margin: auto
+}
+
+/* expand/collapse code sections */
+pre input {
+ display:none;
+ visibility:hidden
+}
+pre label {
+ display:block;
+ margin:-3px 3px 0 -16px;
+ text-align:center;
+ color:#21be2b;
+ float:left;
+}
+pre label:hover {
+ color:#fff
+}
+pre label::before {
+ font-weight:600;
+ font-size:16px;
+ content:"+";
+ display:inline-block;
+ width:16px;
+ height:16px
+}
+#ec_expand {
+ height:16px;
+ overflow:hidden;
+ transition:height 0.35s;
+}
+#ec_expand::before {
+ content:"...*/";
+ color:#aaa;
+ background-color:#3a4055;
+ z-index:99 !important;
+ right:25px;
+ position:absolute
+}
+#ec_toggle:checked ~ #ec_expand {
+ height:initial
+}
+#ec_toggle:checked ~ #ec_expand::before {
+ content:""
+}
+#ec_toggle:checked ~ label::before {
+ content:"-"
+}
+
+/* permalinks */
+h1:hover > .headerlink,
+h2:hover > .plink,
+h2:hover > .headerlink,
+h3:hover > .plink,
+h3:hover > .headerlink,
+h4:hover > .plink,
+h4:hover > .headerlink,
+h5:hover > .plink,
+h5:hover > .headerlink {
+ opacity:1
+}
+a.plink, a.headerlink {
+ opacity: 0;
+ padding-left: 8px;
+ font-size: 0.8em;
+ font-weight: 600;
+ transition: opacity 180ms ease-in-out
+}
+a.plink::before {
+ content:'\00B6'
+}
+
+table.special {
+ border: 3px;
+ padding: 0px;
+ border-collapse: separate;
+ border-spacing: 20px;
+ line-height: 1.5em;
+}
+
+.special p {
+ text-align: center;
+ color: #3a4055;
+}
+
+.special a {
+ display: block;
+ border-bottom: 0;
+ text-decoration: none;
+}
+
+.special a:hover {
+ border-bottom: 0;
+ text-decoration: none;
+}
+
+.special strong {
+ color: #17a81a;
+ font-size: 110%;
+ font-weight: normal;
+}
+
+table.special th,
+table.special td {
+ border: 1px solid #888;
+ padding-top: 14px;
+ padding-bottom: 14px;
+ padding-left: 6px;
+ padding-right: 5px;
+ border-radius: 5px;
+ -moz-border-radius: 5px;
+ -webkit-border-radius: 5px;
+ -khtml-border-radius: 5px;
+}
+
+.special td:hover {
+ padding-top: 2px;
+ padding-bottom: 2px;
+ border-bottom: 4px solid #41cd52;
+}
diff --git a/sources/pyside2/doc/_themes/pysidedocs_qthelp/static/pysidelogo.png b/sources/pyside2/doc/_themes/pysidedocs_qthelp/static/pysidelogo.png
new file mode 100644
index 00000000..3a2f2bd1
--- /dev/null
+++ b/sources/pyside2/doc/_themes/pysidedocs_qthelp/static/pysidelogo.png
Binary files differ
diff --git a/sources/pyside2/doc/_themes/pysidedocs_qthelp/static/relbar_bg.png b/sources/pyside2/doc/_themes/pysidedocs_qthelp/static/relbar_bg.png
new file mode 100644
index 00000000..4036733a
--- /dev/null
+++ b/sources/pyside2/doc/_themes/pysidedocs_qthelp/static/relbar_bg.png
Binary files differ
diff --git a/sources/pyside2/doc/_themes/pysidedocs_qthelp/theme.conf b/sources/pyside2/doc/_themes/pysidedocs_qthelp/theme.conf
new file mode 100644
index 00000000..4384b459
--- /dev/null
+++ b/sources/pyside2/doc/_themes/pysidedocs_qthelp/theme.conf
@@ -0,0 +1,7 @@
+[theme]
+inherit = default
+stylesheet = pyside.css
+pygments_style = none
+
+[options]
+nosidebar = true
diff --git a/sources/pyside2/doc/codesnippets/examples/mainwindows/application/mainwindow.h b/sources/pyside2/doc/codesnippets/examples/mainwindows/application/mainwindow.h
index bdb7bcf2..d2cda4aa 100644
--- a/sources/pyside2/doc/codesnippets/examples/mainwindows/application/mainwindow.h
+++ b/sources/pyside2/doc/codesnippets/examples/mainwindows/application/mainwindow.h
@@ -48,7 +48,8 @@
**
****************************************************************************/
-from PySide2.QtWidgets import (QAction, QApplication, QMainWindow, QMenu,
+from PySide2.QtGui import QAction
+from PySide2.QtWidgets import (QApplication, QMainWindow, QMenu,
QPlainTextEdit, QSessionManager)
diff --git a/sources/pyside2/doc/codesnippets/webkitsnippets/qtwebkit_qwebinspector_snippet.cpp b/sources/pyside2/doc/codesnippets/webkitsnippets/qtwebkit_qwebinspector_snippet.cpp
deleted file mode 100644
index 79dc1517..00000000
--- a/sources/pyside2/doc/codesnippets/webkitsnippets/qtwebkit_qwebinspector_snippet.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-def wrapInFunction():
-//! [0]
- # ...
- page = QWebPage()
- # ...
-
- inspector = QWebInspector()
- inspector.setPage(page)
-//! [0]
-
diff --git a/sources/pyside2/doc/codesnippets/webkitsnippets/qtwebkit_qwebview_snippet.cpp b/sources/pyside2/doc/codesnippets/webkitsnippets/qtwebkit_qwebview_snippet.cpp
deleted file mode 100644
index 268f4344..00000000
--- a/sources/pyside2/doc/codesnippets/webkitsnippets/qtwebkit_qwebview_snippet.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-def wrapInFunction():
-//! [0]
- view.page().history()
-//! [0]
-
-
-//! [1]
- view.page().settings()
-//! [1]
-
-
-//! [2]
- view.triggerAction(QWebPage.Copy)
-//! [2]
-
-
-//! [3]
- view.page().triggerPageAction(QWebPage.Stop)
-//! [3]
-
-
-//! [4]
- view.page().triggerPageAction(QWebPage.GoBack)
-//! [4]
-
-
-//! [5]
- view.page().triggerPageAction(QWebPage.GoForward)
-//! [5]
-
diff --git a/sources/pyside2/doc/codesnippets/webkitsnippets/simple/main.cpp b/sources/pyside2/doc/codesnippets/webkitsnippets/simple/main.cpp
deleted file mode 100644
index 1382cd44..00000000
--- a/sources/pyside2/doc/codesnippets/webkitsnippets/simple/main.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-from PySide2.QtCore import *
-from PySide2.QtGui import *
-from PySide2.QtWebKit import *
-import sys
-
-app = QApplication(sys.argv)
-parent = None
-//! [Using QWebView]
-view = QWebView(parent)
-view.load(QUrl("http://qt-project.org/"))
-view.show()
-//! [Using QWebView]
-sys.exit(app.exec_())
diff --git a/sources/pyside2/doc/codesnippets/webkitsnippets/webelement/main.cpp b/sources/pyside2/doc/codesnippets/webkitsnippets/webelement/main.cpp
deleted file mode 100644
index 67e101ae..00000000
--- a/sources/pyside2/doc/codesnippets/webkitsnippets/webelement/main.cpp
+++ /dev/null
@@ -1,114 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-def traverse():
-//! [Traversing with QWebElement]
- frame.setHtml("<html><body><p>First Paragraph</p><p>Second Paragraph</p></body></html>")
- doc = frame.documentElement()
- body = doc.firstChild()
- firstParagraph = body.firstChild()
- secondParagraph = firstParagraph.nextSibling()
-//! [Traversing with QWebElement]
-
-def findButtonAndClick():
- frame.setHtml("<form name=\"myform\" action=\"submit_form.asp\" method=\"get\">" \
- "<input type=\"text\" name=\"myfield\">" \
- "<input type=\"submit\" value=\"Submit\">" \
- "</form>")
-
-//! [Calling a DOM element method]
-
- document = frame.documentElement()
- # Assume that the document has the following structure:
- #
- # <form name="myform" action="submit_form.asp" method="get">
- # <input type="text" name="myfield">
- # <input type="submit" value="Submit">
- # </form>
-
- button = document.findFirst("input[type=submit]")
- button.evaluateJavaScript("click()")
-
-//! [Calling a DOM element method]
-
-def autocomplete1():
- document = frame.documentElement()
-//! [autocomplete1]
- firstTextInput = document.findFirst("input[type=text]")
- storedText = firstTextInput.attribute("value")
-//! [autocomplete1]
-
-def autocomplete2():
- document = frame.documentElement()
- storedText = "text"
-
-//! [autocomplete2]
- firstTextInput = document.findFirst("input[type=text]")
- textInput.setAttribute("value", storedText)
-//! [autocomplete2]
-
-def findAll():
-//! [FindAll]
- document = frame.documentElement()
- # Assume the document has the following structure:
- #
- # <p class=intro>
- # <span>Intro</span>
- # <span>Snippets</span>
- # </p>
- # <p>
- # <span>Content</span>
- # <span>Here</span>
- # </p>
-
-//! [FindAll intro]
- allSpans = document.findAll("span")
- introSpans = document.findAll("p.intro span")
-//! [FindAll intro] //! [FindAll]
diff --git a/sources/pyside2/doc/codesnippets/webkitsnippets/webpage/main.cpp b/sources/pyside2/doc/codesnippets/webkitsnippets/webpage/main.cpp
deleted file mode 100644
index b64a4f35..00000000
--- a/sources/pyside2/doc/codesnippets/webkitsnippets/webpage/main.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** 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.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-class Thumbnailer (QObject):
- def __init__(self, url):
-//! [1]
- QObject.__init__(self)
- self.page = QWebPage()
- self.page.mainFrame().load(url)
- page.loadFinished[bool].connect(self.render)
-//! [1]
-
- finished = Signal()
-
-//! [2]
- def render(self):
- self.page.setViewportSize(self.page.mainFrame().contentsSize())
- image = QImage(self.page.viewportSize(), QImage.Format_ARGB32)
- painter = QPainter(image)
-
- self.page.mainFrame().render(painter)
- painter.end()
-
- thumbnail = image.scaled(400, 400)
- thumbnail.save("thumbnail.png")
-
- self.finished.emit()
-//! [2]
-//! [0]
-
-app = QApplication(sys.argv)
-
-thumbnail = Thumbnailer(QUrl("http://qt-project.org"))
-thumbnail.finished.connect(app.quit)
-sys.exit(app.exec_())
diff --git a/sources/pyside2/doc/conf.py.in b/sources/pyside2/doc/conf.py.in
index e197b1ac..e37abcb2 100644
--- a/sources/pyside2/doc/conf.py.in
+++ b/sources/pyside2/doc/conf.py.in
@@ -31,6 +31,11 @@ extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.ifconfig',
'sphinx.ext.graphviz', 'inheritance_diagram', 'pysideinclude',
'sphinx.ext.viewcode']
+output_format='@DOC_OUTPUT_FORMAT@'
+
+def setup(app):
+ app.add_config_value('output_format','qthelp','env')
+
rst_epilog = """
.. |project| replace:: Qt for Python
.. |pymodname| replace:: PySide2
@@ -170,6 +175,10 @@ html_show_sourcelink = False
# Link to the shiboken2 sphinx project to enable linking
# between the two projects.
-intersphinx_mapping = {'shiboken2': ('shiboken2','@CMAKE_BINARY_DIR@/../shiboken2/doc/html/objects.inv')}
+intersphinx_mapping = {'shiboken2': ('shiboken2','@CMAKE_BINARY_DIR@/doc/html/shiboken2/doc/html/objects.inv')}
add_module_names = False
+
+# -- Options for qthelp output ---------------------------------------------------
+qthelp_theme = 'pysidedocs_qthelp'
+
diff --git a/sources/pyside2/doc/deployment-briefcase.rst b/sources/pyside2/doc/deployment-briefcase.rst
new file mode 100644
index 00000000..fec5e0d5
--- /dev/null
+++ b/sources/pyside2/doc/deployment-briefcase.rst
@@ -0,0 +1,199 @@
+|project| & Briefcase
+#######################
+
+`Briefcase <https://briefcase.readthedocs.io>`_ is a packaging tool that lets you create a standalone package for a Python application. It supports the following installer formats:
+
+ * .app application bundle for macOS
+ * MSI installer for Windows
+ * AppImage for Linux
+
+For more details, see the `official documentation <https://briefcase.readthedocs.io/en/latest/index.html>`_.
+
+Preparation
+===========
+
+Install `Briefcase` using the following **pip** command::
+
+ pip install briefcase
+
+You also need : docker on linux, `WixToolset`_ on windows,
+
+If you're using a virtual environment, remember to activate it before installing `Briefcase`.
+
+After installation, the `briefcase` binary is located in your virtual environment's `bin/`
+directory, or where your Python executable is located.
+
+You can either create a brand new project using the briefcase assistant or setup your own.
+
+.. _`WixToolset`: https://wixtoolset.org/
+
+Use Briefcase Assistant
+=======================
+
+Run the following command and answer the questions to get started::
+
+ briefcase new
+
+Ensure that `PySide2` is chosen as the `GUI toolkit choice`.
+Your PySide2 application is now configured. You can jump to `Build the package`_.
+
+
+Set up your project
+===================
+
+Create a pyproject.toml
+-----------------------
+
+At the root level of your project, create a `pyproject.toml` file::
+
+ [tool.briefcase]
+ project_name = "MyPySideApp"
+ bundle = "com.example"
+ version = "0.0.1"
+ url = "https://somwhere/on/the/net"
+ license = "GNU General Public License v3 (GPLv3)"
+ author = 'MyName Firstname'
+ author_email = "cool@mailexample.com"
+
+ [tool.briefcase.app.mypysideapp]
+ formal_name = "A Cool App"
+ description = "The coolest app ever"
+ icon = "src/mypysideapp/resources/appicon" # Briecase will choose the right extension depending the os (png,ico,...)
+ sources = ['src/mypysideapp']
+ requires = ['pyside2==5.15.0',
+ 'pony>=0.7.11,<0.8',
+ 'dickens==1.0.1',
+ 'Pillow==7.1.2',
+ 'mako==1.1.2',
+ 'beautifulsoup4']
+
+
+ [tool.briefcase.app.mypysideapp.macOS]
+ requires = []
+
+ [tool.briefcase.app.mypysideapp.linux]
+ requires = []
+ system_requires = []
+
+ [tool.briefcase.app.mypysideapp.windows]
+ requires = []
+
+
+Write some code
+----------------
+
+Let's say your project tree is like this::
+
+ pyproject.toml
+ setup.cfg
+ pytest.ini
+ src/
+
+ mypysideapp/
+ resources/
+ appicon.png
+ appicon.ico
+ __init__.py
+ __main__.py
+ app.py
+
+
+Content of `__main__.py`::
+
+ import sys
+ from PySide2.QtWidgets import QApplication
+ from mypysideapp.app import MyWidget
+
+ if __name__ == "__main__":
+ app = QApplication(sys.argv)
+
+ widget = MyWidget()
+ widget.resize(800, 600)
+ widget.show()
+
+ sys.exit(app.exec_())
+
+
+Content of `app.py`::
+
+ import random
+ from PySide2.QtWidgets import (QLabel, QPushButton,
+ QVBoxLayout, QWidget)
+ from PySide2.QtCore import Slot, Qt
+
+ class MyWidget(QWidget):
+ def __init__(self):
+ QWidget.__init__(self)
+
+ self.hello = ["Hallo Welt", "你好,世界", "Hei maailma",
+ "Hola Mundo", "Привет мир"]
+
+ self.button = QPushButton("Click me!")
+ self.text = QLabel("Hello World")
+ self.text.setAlignment(Qt.AlignCenter)
+
+ self.layout = QVBoxLayout()
+ self.layout.addWidget(self.text)
+ self.layout.addWidget(self.button)
+ self.setLayout(self.layout)
+
+ # Connecting the signal
+ self.button.clicked.connect(self.magic)
+
+ @Slot()
+ def magic(self):
+ self.text.setText(random.choice(self.hello))
+
+
+Build the package
+==================
+
+Initialize the package
+------------------------
+
+Just run::
+
+ briefcase create
+
+Run the following command to initialize the building the packages for Windows, Linux, and macOS.
+It creates a subdirectory each for the different platforms.
+This step takes longer as it adds the packages listed in `requires` sections in the `pyproject.toml` file.
+
+Build the application
+---------------
+::
+
+ briefcase build
+
+You'll get::
+
+ macOS/A Cool App/A Cool App.app
+ or
+ linux/A Cool App-x86_64-0.0.1.AppImage
+ or
+ windows\A Cool App
+
+
+Run the application
+-----------
+::
+
+ briefcase run
+
+.. note:: You can run your project in `dev` mode (your source code not packaged) with `briefcase dev`
+
+
+Build the installer (only Windows and macOS)
+---------------------------------------------
+
+macOS::
+
+ briefcase package --no-sign
+
+It's possible to sign, see the `documentation <https://briefcase.readthedocs.io/en/latest/how-to/code-signing/index.html>`_. You get `macOS/A Cool App-0.0.1.dmg`
+
+Windows::
+
+ briefcase package
+
+You get `windows\A_Cool_App-0.0.1.msi`
diff --git a/sources/pyside2/doc/deployment.rst b/sources/pyside2/doc/deployment.rst
index 78d6058d..414a468e 100644
--- a/sources/pyside2/doc/deployment.rst
+++ b/sources/pyside2/doc/deployment.rst
@@ -12,6 +12,7 @@ Here are a few distribution options that you can use:
1. Send a normal ZIP file with the application's content.
2. Build a proper `Python package (wheel) <https://packaging.python.org/>`_.
3. Freeze the application into a single binary file or directory.
+ 4. Provide native installer (msi, dmg)
If you choose Option 3, consider using one of these tools:
* `fbs`_
@@ -19,12 +20,14 @@ If you choose Option 3, consider using one of these tools:
* `cx_Freeze`_
* `py2exe`_
* `py2app`_
+ * `briefcase`_
.. _fbs: https://build-system.fman.io/
.. _PyInstaller: https://www.pyinstaller.org/
.. _cx_Freeze: https://anthony-tuininga.github.io/cx_Freeze/
.. _py2exe: http://www.py2exe.org/
.. _py2app: https://py2app.readthedocs.io/en/latest/
+.. _briefcase: https://briefcase.readthedocs.io
Since |project| is a cross-platform framework, we focus on solutions for the three major
platforms that Qt supports: Windows, Linux, and macOS.
@@ -79,10 +82,17 @@ The following table summarizes the platform support for those packaging tools:
<td><p style="color: green;">yes</p></td>
<td><p style="color: red;">no</p></td>
</tr>
+ <tr>
+ <td><p>briefcase</p></td>
+ <td><p>BSD3</p></td>
+ <td><p style="color: green;">yes</p></td>
+ <td><p style="color: green;">yes</p></td>
+ <td><p style="color: green;">yes</p></td>
+ </tr>
</tbody>
</table>
-Notice that only *fbs*, *cx_Freeze*, and *PyInstaller* meet our cross-platform requirement.
+Notice that only *fbs*, *cx_Freeze*, *briefcase*, and *PyInstaller* meet our cross-platform requirement.
Since these are command-line tools, you'll need special hooks or scripts to handle resources
such as images, icons, and meta-information, before adding them to your package. Additionally,
@@ -107,3 +117,4 @@ Here's a set of tutorials on how to use these tools:
deployment-fbs.rst
deployment-pyinstaller.rst
deployment-cxfreeze.rst
+ deployment-briefcase.rst
diff --git a/sources/pyside2/doc/extras/QtCore.Property.rst b/sources/pyside2/doc/extras/QtCore.Property.rst
index 209704c4..a10c9f80 100644
--- a/sources/pyside2/doc/extras/QtCore.Property.rst
+++ b/sources/pyside2/doc/extras/QtCore.Property.rst
@@ -16,24 +16,24 @@ function:
.. code-block::
:linenos:
-from PySide2.QtCore import QObject, Property
+ from PySide2.QtCore import QObject, Property
-class MyObject(QObject):
- def __init__(self,startval=42):
- QObject.__init__(self)
- self.ppval = startval
+ class MyObject(QObject):
+ def __init__(self,startval=42):
+ QObject.__init__(self)
+ self.ppval = startval
- def readPP(self):
- return self.ppval
+ def readPP(self):
+ return self.ppval
- def setPP(self,val):
- self.ppval = val
+ def setPP(self,val):
+ self.ppval = val
- pp = Property(int, readPP, setPP)
+ pp = Property(int, readPP, setPP)
-obj = MyObject()
-obj.pp = 47
-print(obj.pp)
+ obj = MyObject()
+ obj.pp = 47
+ print(obj.pp)
Properties in QML expressions
-----------------------------
@@ -45,18 +45,18 @@ example illustrating how to do this:
.. code-block::
:linenos:
-from PySide2.QtCore import QObject, Signal, Property
+ from PySide2.QtCore import QObject, Signal, Property
-class Person(QObject):
- def __init__(self, name):
- QObject.__init__(self)
- self._person_name = name
+ class Person(QObject):
+ def __init__(self, name):
+ QObject.__init__(self)
+ self._person_name = name
- def _name(self):
- return self._person_name
+ def _name(self):
+ return self._person_name
- @Signal
- def name_changed(self):
- pass
+ @Signal
+ def name_changed(self):
+ pass
- name = Property(str, _name, notify=name_changed)
+ name = Property(str, _name, notify=name_changed)
diff --git a/sources/pyside2/doc/extras/QtCore.QEnum.rst b/sources/pyside2/doc/extras/QtCore.QEnum.rst
new file mode 100644
index 00000000..a5a2e31f
--- /dev/null
+++ b/sources/pyside2/doc/extras/QtCore.QEnum.rst
@@ -0,0 +1,92 @@
+.. currentmodule:: PySide2.QtCore
+.. _QEnum:
+
+QEnum/QFlag
+***********
+
+This class decorator is equivalent to the `Q_ENUM` macro from Qt.
+The decorator is used to register an Enum to the meta-object system,
+which is available via `QObject.staticMetaObject`.
+The enumerator must be in a QObject derived class to be registered.
+
+
+Example
+-------
+
+::
+
+ from enum import Enum, Flag, auto
+
+ from PySide2.QtCore import QEnum, QFlag, QObject
+
+ class Demo(QObject):
+
+ @QEnum
+ class Orientation(Enum):
+ North, East, South, West = range(4)
+
+ class Color(Flag):
+ RED = auto()
+ BLUE = auto()
+ GREEN = auto()
+ WHITE = RED | BLUE | GREEN
+
+ QFlag(Color) # identical to @QFlag usage
+
+
+Caution:
+--------
+
+QEnum registers a Python Enum derived class.
+QFlag treats a variation of the Python Enum, the Flag class.
+
+Please do not confuse that with the Qt QFlags concept. Python does
+not use that concept, it has its own class hierarchy, instead.
+For more details, see the `Python enum documentation <https://docs.python.org/3/library/enum.html>`_.
+
+
+Details about Qt Flags:
+-----------------------
+
+There are some small differences between Qt flags and Python flags.
+In Qt, we have for instance these declarations:
+
+::
+
+ enum QtGui::RenderHint { Antialiasing, TextAntialiasing, SmoothPixmapTransform,
+ HighQualityAntialiasing, NonCosmeticDefaultPen }
+ flags QtGui::RenderHints
+
+The equivalent Python notation would look like this:
+
+::
+
+ @QFlag
+ class RenderHints(enum.Flag)
+ Antialiasing = auto()
+ TextAntialiasing = auto()
+ SmoothPixmapTransform = auto()
+ HighQualityAntialiasing = auto()
+ NonCosmeticDefaultPen = auto()
+
+
+As another example, the Qt::AlignmentFlag flag has 'AlignmentFlag' as the enum
+name, but 'Alignment' as the type name. Non flag enums have the same type and
+enum names.
+
+::
+
+ enum Qt::AlignmentFlag
+ flags Qt::Alignment
+
+The Python way to specify this would be
+
+::
+
+ @QFlag
+ class Alignment(enum.Flag):
+ ...
+
+We are considering to map all builtin enums and flags to Python enums as well
+in a later release.
+
diff --git a/sources/pyside2/doc/extras/QtQml.qmlRegisterSingletonType.rst b/sources/pyside2/doc/extras/QtQml.qmlRegisterSingletonType.rst
new file mode 100644
index 00000000..2e0f8076
--- /dev/null
+++ b/sources/pyside2/doc/extras/QtQml.qmlRegisterSingletonType.rst
@@ -0,0 +1,44 @@
+.. currentmodule:: PySide2.QtQml
+.. _qmlRegisterSingletonType:
+
+qmlRegisterSingletonType
+************************
+
+.. py:function:: qmlRegisterSingletonType(pytype: type, uri: str, versionMajor: int, versionMinor: int, typeName: str) -> int
+
+ :param type pytype: Python class
+ :param str uri: uri to use while importing the component in QML
+ :param int versionMajor: major version
+ :param int versionMinor: minor version
+ :param str typeName: name exposed to QML
+ :return: int (the QML type id)
+
+ This function registers a Python type as a singleton in the QML system.
+
+.. py:function:: qmlRegisterSingletonType(pytype: type, uri: str, versionMajor: int, versionMinor: int, typeName: str, callback: object) -> int
+
+ :param type pytype: Python class
+ :param str uri: uri to use while importing the component in QML
+ :param int versionMajor: major version
+ :param int versionMinor: minor version
+ :param str typeName: name exposed to QML
+ :param object callback: Python callable (to handle Python type)
+ :return: int (the QML type id)
+
+ This function registers a Python type as a singleton in the QML system using
+ the provided callback (which gets a QQmlEngine as a parameter) to generate
+ the singleton.
+
+
+.. py:function:: qmlRegisterSingletonType(uri: str, versionMajor: int, versionMinor: int, typeName: str, callback: object) -> int
+
+ :param str uri: uri to use while importing the component in QML
+ :param int versionMajor: major version
+ :param int versionMinor: minor version
+ :param str typeName: name exposed to QML
+ :param object callback: Python callable (to handle QJSValue)
+ :return: int (the QML type id)
+
+ This function registers a QJSValue as a singleton in the QML system using
+ the provided callback (which gets a QQmlEngine as a parameter) to
+ generate the singleton.
diff --git a/sources/pyside2/doc/extras/QtQml.qmlRegisterType.rst b/sources/pyside2/doc/extras/QtQml.qmlRegisterType.rst
new file mode 100644
index 00000000..d8bd3acb
--- /dev/null
+++ b/sources/pyside2/doc/extras/QtQml.qmlRegisterType.rst
@@ -0,0 +1,41 @@
+.. currentmodule:: PySide2.QtQml
+.. _qmlRegisterType:
+
+qmlRegisterType
+***************
+
+.. py:function:: qmlRegisterType(pytype: type, uri: str, versionMajor: int, versionMinor: int, qmlName: str) -> int
+
+ :param type pytype: Python class
+ :param str uri: uri to use while importing the component in QML
+ :param int versionMajor: major version
+ :param int versionMinor: minor version
+ :param str qmlName: name exposed to QML
+ :return: int (the QML type id)
+
+ This function registers the Python *type* in the QML system with the
+ name *qmlName*, in the library imported from *uri* having the
+ version number composed from *versionMajor* and *versionMinor*.
+
+ For example, this registers a Python class 'MySliderItem' as a QML
+ type named 'Slider' for version '1.0' of a module called
+ 'com.mycompany.qmlcomponents':
+
+ ::
+
+ qmlRegisterType(MySliderItem, "com.mycompany.qmlcomponents", 1, 0, "Slider")
+
+ Once this is registered, the type can be used in QML by importing
+ the specified module name and version number:
+
+ ::
+
+ import com.mycompany.qmlcomponents 1.0
+
+ Slider { ... }
+
+ Note that it's perfectly reasonable for a library to register types
+ to older versions than the actual version of the library.
+ Indeed, it is normal for the new library to allow QML written to
+ previous versions to continue to work, even if more advanced
+ versions of some of its types are available.
diff --git a/sources/pyside2/doc/extras/QtQml.qmlRegisterUncreatableType.rst b/sources/pyside2/doc/extras/QtQml.qmlRegisterUncreatableType.rst
new file mode 100644
index 00000000..0e73f3d9
--- /dev/null
+++ b/sources/pyside2/doc/extras/QtQml.qmlRegisterUncreatableType.rst
@@ -0,0 +1,36 @@
+.. currentmodule:: PySide2.QtQml
+.. _qmlRegisterUncreatableType:
+
+
+qmlRegisterUncreatableType
+**************************
+
+
+.. py:function:: qmlRegisterUncreatableType(pytype: type, uri: str, versionMajor: int, versionMinor: int, qmlName: str, noCreationReason: str) -> int
+
+
+ :param type pytype: Python class
+ :param str uri: uri to use while importing the component in QML
+ :param int versionMajor: major version
+ :param int versionMinor: minor version
+ :param str qmlName: name exposed to QML
+ :param str noCreationReason: Error message shown when trying to create the QML type
+ :return: int (the QML type id)
+
+ This function registers the Python *type* in the QML system as an uncreatable type with the
+ name *qmlName*, in the library imported from *uri* having the
+ version number composed from *versionMajor* and *versionMinor*,
+ showing *noCreationReason* as an error message when creating the type is attempted.
+
+ For example, this registers a Python class 'MySliderItem' as a QML
+ type named 'Slider' for version '1.0' of a module called
+ 'com.mycompany.qmlcomponents':
+
+ ::
+ qmlRegisterUncreatableType(MySliderItem, "com.mycompany.qmlcomponents", 1, 0, "Slider", "Slider cannot be created.")
+
+ Note that it's perfectly reasonable for a library to register types
+ to older versions than the actual version of the library.
+ Indeed, it is normal for the new library to allow QML written to
+ previous versions to continue to work, even if more advanced
+ versions of some of its types are available.
diff --git a/sources/pyside2/doc/extras/QtUiTools.loadUiType.rst b/sources/pyside2/doc/extras/QtUiTools.loadUiType.rst
new file mode 100644
index 00000000..9ca330de
--- /dev/null
+++ b/sources/pyside2/doc/extras/QtUiTools.loadUiType.rst
@@ -0,0 +1,36 @@
+.. currentmodule:: PySide2.QtUiTools
+.. _loadUiType:
+
+loadUiType
+***********
+
+.. py:function:: loadUiType(uifile: str) -> tuple(object, object)
+
+ :param str uifile: The name of the `.ui` file
+ :return: tuple(object, object)
+
+ This function generates and loads a `.ui` file at runtime, and it returns
+ a `tuple` containing the reference to the Python class, and the base class.
+
+ We recommend not to use this approach as the workflow should be to generate a Python file
+ from the `.ui` file, and then import and load it to use it, but we do understand that
+ there are some corner cases when such functionality is required.
+
+ The internal process relies on `uic` being in the PATH.
+ The `pyside2-uic` wrapper uses a shipped `uic` that is located in the
+ `site-packages/PySide2/uic`, so PATH needs to be updated to use that if there
+ is no `uic` in the system.
+
+ A simple use case is::
+
+ from PySide2.QtUiTools import loadUiType
+
+ generated_class, base_class = loadUiType("themewidget.ui")
+ # the values will be:
+ # (<class '__main__.Ui_ThemeWidgetForm'>, <class 'PySide2.QtWidgets.QWidget'>)
+
+ widget = base_class()
+ form = generated_class()
+ form.setupUi(widget)
+ # form.a_widget_member.a_method_of_member()
+ widget.show()
diff --git a/sources/pyside2/doc/extras/QtUiTools.rst b/sources/pyside2/doc/extras/QtUiTools.rst
index 55322452..598d69dd 100644
--- a/sources/pyside2/doc/extras/QtUiTools.rst
+++ b/sources/pyside2/doc/extras/QtUiTools.rst
@@ -6,4 +6,4 @@ To include the definitions of the module's classes, use the following directive:
::
- import PySide..QtUiTools
+ import PySide.QtUiTools
diff --git a/sources/pyside2/doc/extras/QtWebKit.rst b/sources/pyside2/doc/extras/QtWebKit.rst
deleted file mode 100644
index 58f9230a..00000000
--- a/sources/pyside2/doc/extras/QtWebKit.rst
+++ /dev/null
@@ -1,94 +0,0 @@
-QtWebKit provides a Web browser engine that makes it easy to embed content from the World Wide Web into your Qt application. At the same time Web content can be enhanced with native controls.
-
-QtWebKit provides facilities for rendering of HyperText Markup Language (HTML), Extensible HyperText Markup Language (XHTML) and Scalable Vector Graphics (SVG) documents, styled using Cascading Style Sheets (CSS) and scripted with JavaScript.
-
-A bridge between the JavaScript execution environment and the Qt object model makes it possible for custom QObjects to be scripted. Integration with the Qt networking module enables Web pages to be transparently loaded from Web servers, the local file system or even the Qt resource system.
-
-In addition to providing pure rendering features, HTML documents can be made fully editable to the user through the use of the contenteditable attribute on HTML elements.
-
-QtWebKit is based on the Open Source WebKit engine. More information about WebKit itself can be found on the _`WebKit Open Source Project <http://webkit.org/>` Web site.
-
-Including In Your Project
--------------------------
-
-To include the definitions of the module's classes, use the following directive:
-
-::
-
- import PySide2.QtWebKit
-
-
-.. note:: Web site icons, also known as "FavIcons", are currently not supported on Windows. We plan to address this in a future release.
-
-Architecture
-------------
-
-The easiest way to render content is through the QWebView class. As a widget it can be embedded into your forms or a graphics view, and it provides convenience functions for downloading and rendering web sites.
-
-::
-
- view = QWebView(parent)
- view.load(QUrl("http://qt.nokia.com/"))
- view.show()
-
-QWebView is used to view Web pages. An instance of QWebView has one QWebPage. QWebPage provides access to the document structure in a page, describing features such as frames, the navigation history, and the undo/redo stack for editable content.
-
-HTML documents can be nested using frames in a frameset. An individual frame in HTML is represented using the QWebFrame class. This class includes the bridge to the JavaScript window object and can be painted using QPainter. Each QWebPage has one QWebFrame object as its main frame, and the main frame may contain many child frames.
-
-Individual elements of an HTML document can be accessed via DOM JavaScript interfaces from within a web page. The equivalent of this API in QtWebKit is represented by QWebElement. QWebElement objects are obtained using QWebFrame's findAllElements() and findFirstElement() functions with CSS selector queries.
-
-Common web browser features, defaults and other settings can be configured through the QWebSettings class. It is possible to provide defaults for all QWebPage instances through the default settings. Individual attributes can be overidden by the page specific settings object.
-
-Netscape Plugin Support
------------------------
-
-.. note:: Netscape plugin support is only available on desktop platforms.
-
-Since WebKit supports the Netscape Plugin API, Qt applications can display Web pages that embed common plugins on platforms for which those plugins are available. To enable plugin support, the user must have the appropriate binary files for those plugins installed and the ``QWebSettings.PluginsEnabled`` attribute must be enabled for the application.
-
-The following locations are searched for plugins:
-
-* Linux/Unix (X11)
- * .mozilla/plugins in the user's home directory
- * .netscape/plugins in the user's home directory
- * System locations, such as
- * /usr/lib/browser/plugins
- * /usr/local/lib/mozilla/plugins
- * /usr/lib/firefox/plugins
- * /usr/lib64/browser-plugins
- * /usr/lib/browser-plugins
- * /usr/lib/mozilla/plugins
- * /usr/local/netscape/plugins
- * /opt/mozilla/plugins
- * /opt/mozilla/lib/plugins
- * /opt/netscape/plugins
- * /opt/netscape/communicator/plugins
- * /usr/lib/netscape/plugins
- * /usr/lib/netscape/plugins-libc5
- * /usr/lib/netscape/plugins-libc6
- * /usr/lib64/netscape/plugins
- * /usr/lib64/mozilla/plugins
- * Locations specified by environment variables:
- * $MOZILLA_HOME/plugins
- * $MOZ_PLUGIN_PATH
- * $QTWEBKIT_PLUGIN_PATH
-* Windows
- * The user's Application Data\Mozilla\plugins directory
- * Standard system locations of plugins for Quicktime, Flash, etc.
-* Mac OS X
- * Library/Internet Plug-Ins in the user's home directory
- * The system /Library/Internet Plug-Ins directory
-
-License Information
--------------------
-
-Qt Commercial Edition licensees that wish to distribute applications that use the QtWebKit module need to be aware of their obligations under the GNU Library General Public License (LGPL).
-
-Developers using the Open Source Edition can choose to redistribute the module under the appropriate version of the GNU LGPL.
-WebKit is licensed under the GNU Library General Public License. Individual contributor names and copyright dates can be found inline in the code.
-
-This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 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 Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. \ No newline at end of file
diff --git a/sources/pyside2/doc/gettingstarted.rst b/sources/pyside2/doc/gettingstarted.rst
index dbe22a80..b8d6f9e4 100644
--- a/sources/pyside2/doc/gettingstarted.rst
+++ b/sources/pyside2/doc/gettingstarted.rst
@@ -63,7 +63,8 @@ Other important options to consider are:
* ``--reuse-build``, to rebuild only the modified files,
* ``--openssl=/path/to/openssl/bin``, to use a different path for OpenSSL,
* ``--standalone``, to copy over the Qt libraries into the final package
- to make it work on other machines.
+ to make it work on other machines,
+ * ``--doc-build-online``, to build documentation using the online template.
Testing the installation
-------------------------
@@ -110,7 +111,32 @@ directory, and run::
make apidoc
-Finally, you will get a ``html`` directory containing all the generated documentation.
+.. note:: The ``apidoc`` make target builds offline documenation in QCH (Qt Creator Help) format
+ by default. You can switch to building for the online use with the ``--doc-build-online``
+ configure option.
+
+Finally, you will get a ``html`` directory containing all the generated documentation. The offline
+help files, ``PySide.qch`` and ``Shiboken.qch``, can be moved to any directory of your choice. You
+can find ``Shiboken.qch`` in the build directory, ``*_build\*_release\shiboken2\doc\html``.
+
+Viewing offline documentation
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The offline documentation (QCH) can be viewed using the Qt Creator IDE or Qt Assistant, which is
+a standalone application for viewing QCH files.
+
+To view the QCH using Qt Creator, following the instructions outlined in
+`Using Qt Creator Help Mode <https://doc.qt.io/qtcreator/creator-help.html>`_. If you chose to
+use Qt Assistant instead, use the following command to register the QCH file before launching
+Qt Assistant:
+
+ assistant -register PySide.qch
+
+.. note:: Qt Assistant renders the QCH content using the QTextBrowser backend, which supports
+ a subset of the CSS styles, However, Qt Creator offers an alternative litehtml-based
+ backend, which offers better browsing experience. At the moment, this is not the default
+ backend, so you have to select the litehtml backend
+ explicitly under the ``General`` tab in ``Qt Creator >> Tools >> Options >> Help``.
Using the internal tools
------------------------
diff --git a/sources/pyside2/doc/index.rst b/sources/pyside2/doc/index.rst
index 96cbf2ab..72a26d19 100644
--- a/sources/pyside2/doc/index.rst
+++ b/sources/pyside2/doc/index.rst
@@ -1,45 +1,84 @@
|project|
*********
-**Qt for Python** offers the official Python bindings for `Qt`_ (`PySide2`_),
-so that you can use Qt5 APIs in your Python applications, and a binding generator tool (`Shiboken2`_)
-which can be used to expose C++ projects into Python.
+.. ifconfig:: output_format == 'html'
+
+ **Qt for Python** offers the official Python bindings for `Qt`_ (`PySide2`_),
+ so that you can use Qt5 APIs in your Python applications, and a binding generator tool
+ (`Shiboken2 <shiboken2/index.html>`_) which can be used to expose C++ projects into Python.
+
+.. ifconfig:: output_format == 'qthelp'
+
+ **Qt for Python** offers the official Python bindings for `Qt`_ (`PySide2`_),
+ so that you can use Qt5 APIs in your Python applications, and a binding generator tool
+ (`Shiboken2 <../shiboken2/index.html>`_) which can be used to expose C++ projects into Python.
|project| is available under the LGPLv3/GPLv3 and the Qt commercial license.
.. _Qt: https://doc.qt.io
.. _PySide2: quickstart.html
-.. _Shiboken2: shiboken2/index.html
+
Documentation
=============
-.. raw:: html
-
- <table class="special">
- <colgroup>
- <col style="width: 33%" />
- <col style="width: 33%" />
- <col style="width: 33%" />
- </colgroup>
- <tr>
- <td><a href="quickstart.html"><p><strong>Check It Out!</strong><br/>Write your first Qt app.</p></a></td>
- <td><a href="gettingstarted.html"><p><strong>Getting Started</strong><br/>Install and build from source.</p></a></td>
- <td><a href="api.html"><p><strong>API Docs</strong><br/>Qt for Python API reference.</p></a></td>
- </tr>
-
- <tr>
- <td><a href="tutorials/index.html"><p><strong>Tutorials</strong><br/>Learn with step-by-step guides.</p></a></td>
- <td><a href="examples/index.html"><p><strong>Examples</strong><br/>Check all the available examples.</p></a></td>
- <td><a href="videos.html"><p><strong>Videos</strong><br/>Watch webinars, Talks, and more.</p></a></td>
- </tr>
-
- <tr>
- <td><a href="deployment.html" style="display: block;"><p><strong>Deployment</strong><br/>Learn to deploy your apps.</p></a></td>
- <td><a href="considerations.html" style="display: block;"><p><strong>Considerations</strong><br/>API differences and known issues.</p></a></td>
- <td><a href="shiboken2/index.html" style="display: block;"><p><strong>Shiboken</strong><br/>Generate C++ to Python binding.</p></a></td>
- </tr>
- </table>
+.. ifconfig:: output_format == 'html'
+
+ .. raw:: html
+
+ <table class="special">
+ <colgroup>
+ <col style="width: 33%" />
+ <col style="width: 33%" />
+ <col style="width: 33%" />
+ </colgroup>
+ <tr>
+ <td><a href="quickstart.html"><p><strong>Check It Out!</strong><br/>Write your first Qt app.</p></a></td>
+ <td><a href="gettingstarted.html"><p><strong>Getting Started</strong><br/>Install and build from source.</p></a></td>
+ <td><a href="api.html"><p><strong>API Docs</strong><br/>Qt for Python API reference.</p></a></td>
+ </tr>
+
+ <tr>
+ <td><a href="tutorials/index.html"><p><strong>Tutorials</strong><br/>Learn with step-by-step guides.</p></a></td>
+ <td><a href="examples/index.html"><p><strong>Examples</strong><br/>Check all the available examples.</p></a></td>
+ <td><a href="videos.html"><p><strong>Videos</strong><br/>Watch webinars, Talks, and more.</p></a></td>
+ </tr>
+
+ <tr>
+ <td><a href="deployment.html" style="display: block;"><p><strong>Deployment</strong><br/>Learn to deploy your apps.</p></a></td>
+ <td><a href="considerations.html" style="display: block;"><p><strong>Considerations</strong><br/>API differences and known issues.</p></a></td>
+ <td><a href="shiboken2/index.html" style="display: block;"><p><strong>Shiboken</strong><br/>Generate C++ to Python binding.</p></a></td>
+ </tr>
+ </table>
+
+.. ifconfig :: output_format == 'qthelp'
+
+ .. raw:: html
+
+ <table class="special">
+ <colgroup>
+ <col style="width: 33%" />
+ <col style="width: 33%" />
+ <col style="width: 33%" />
+ </colgroup>
+ <tr>
+ <td><a href="quickstart.html"><p><strong>Check It Out!</strong><br/>Write your first Qt app.</p></a></td>
+ <td><a href="gettingstarted.html"><p><strong>Getting Started</strong><br/>Install and build from source.</p></a></td>
+ <td><a href="api.html"><p><strong>API Docs</strong><br/>Qt for Python API reference.</p></a></td>
+ </tr>
+
+ <tr>
+ <td><a href="tutorials/index.html"><p><strong>Tutorials</strong><br/>Learn with step-by-step guides.</p></a></td>
+ <td><a href="examples/index.html"><p><strong>Examples</strong><br/>Check all the available examples.</p></a></td>
+ <td><a href="videos.html"><p><strong>Videos</strong><br/>Watch webinars, Talks, and more.</p></a></td>
+ </tr>
+
+ <tr>
+ <td><a href="deployment.html" style="display: block;"><p><strong>Deployment</strong><br/>Learn to deploy your apps.</p></a></td>
+ <td><a href="considerations.html" style="display: block;"><p><strong>Considerations</strong><br/>API differences and known issues.</p></a></td>
+ <td><a href="../shiboken2/index.html" style="display: block;"><p><strong>Shiboken</strong><br/>Generate C++ to Python binding.</p></a></td>
+ </tr>
+ </table>
.. toctree::
:hidden:
diff --git a/sources/pyside2/doc/tutorials/basictutorial/style.qss b/sources/pyside2/doc/tutorials/basictutorial/style.qss
new file mode 100644
index 00000000..b84b98f0
--- /dev/null
+++ b/sources/pyside2/doc/tutorials/basictutorial/style.qss
@@ -0,0 +1,23 @@
+QListWidget {
+ color: #FFFFFF;
+ background-color: #33373B;
+}
+
+QListWidget::item {
+ height: 50px;
+}
+
+QListWidget::item:selected {
+ background-color: #2ABf9E;
+}
+
+QLabel {
+ background-color: #FFFFFF;
+ qproperty-alignment: AlignCenter;
+}
+
+QPushButton {
+ background-color: #2ABf9E;
+ padding: 20px;
+ font-size: 18px;
+}
diff --git a/sources/pyside2/doc/tutorials/basictutorial/uifiles.rst b/sources/pyside2/doc/tutorials/basictutorial/uifiles.rst
index 2a0d65e4..804905eb 100644
--- a/sources/pyside2/doc/tutorials/basictutorial/uifiles.rst
+++ b/sources/pyside2/doc/tutorials/basictutorial/uifiles.rst
@@ -158,7 +158,7 @@ The complete code of this example looks like this:
import sys
from PySide2.QtUiTools import QUiLoader
from PySide2.QtWidgets import QApplication
- from PySide2.QtCore import QFile
+ from PySide2.QtCore import QFile, QIODevice
if __name__ == "__main__":
app = QApplication(sys.argv)
diff --git a/sources/pyside2/doc/tutorials/basictutorial/widgetstyling-no.png b/sources/pyside2/doc/tutorials/basictutorial/widgetstyling-no.png
new file mode 100644
index 00000000..c30dd621
--- /dev/null
+++ b/sources/pyside2/doc/tutorials/basictutorial/widgetstyling-no.png
Binary files differ
diff --git a/sources/pyside2/doc/tutorials/basictutorial/widgetstyling-simple-no.png b/sources/pyside2/doc/tutorials/basictutorial/widgetstyling-simple-no.png
new file mode 100644
index 00000000..eb90e216
--- /dev/null
+++ b/sources/pyside2/doc/tutorials/basictutorial/widgetstyling-simple-no.png
Binary files differ
diff --git a/sources/pyside2/doc/tutorials/basictutorial/widgetstyling-simple-yes.png b/sources/pyside2/doc/tutorials/basictutorial/widgetstyling-simple-yes.png
new file mode 100644
index 00000000..5a714977
--- /dev/null
+++ b/sources/pyside2/doc/tutorials/basictutorial/widgetstyling-simple-yes.png
Binary files differ
diff --git a/sources/pyside2/doc/tutorials/basictutorial/widgetstyling-yes.png b/sources/pyside2/doc/tutorials/basictutorial/widgetstyling-yes.png
new file mode 100644
index 00000000..8ba49bd26
--- /dev/null
+++ b/sources/pyside2/doc/tutorials/basictutorial/widgetstyling-yes.png
Binary files differ
diff --git a/sources/pyside2/doc/tutorials/basictutorial/widgetstyling.py b/sources/pyside2/doc/tutorials/basictutorial/widgetstyling.py
new file mode 100644
index 00000000..41af464c
--- /dev/null
+++ b/sources/pyside2/doc/tutorials/basictutorial/widgetstyling.py
@@ -0,0 +1,95 @@
+#############################################################################
+##
+## Copyright (C) 2020 The Qt Company Ltd.
+## Contact: http://www.qt.io/licensing/
+##
+## This file is part of the Qt for Python examples of the Qt Toolkit.
+##
+## $QT_BEGIN_LICENSE:BSD$
+## You may use this file under the terms of the BSD license as follows:
+##
+## "Redistribution and use in source and binary forms, with or without
+## modification, are permitted provided that the following conditions are
+## met:
+## * Redistributions of source code must retain the above copyright
+## notice, this list of conditions and the following disclaimer.
+## * Redistributions in binary form must reproduce the above copyright
+## notice, this list of conditions and the following disclaimer in
+## the documentation and/or other materials provided with the
+## distribution.
+## * Neither the name of The Qt Company Ltd nor the names of its
+## contributors may be used to endorse or promote products derived
+## from this software without specific prior written permission.
+##
+##
+## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+##
+## $QT_END_LICENSE$
+##
+#############################################################################
+
+import sys
+
+from PySide2.QtCore import Qt
+from PySide2.QtWidgets import (QApplication, QHBoxLayout, QLabel, QListWidget,
+ QListWidgetItem, QPushButton, QVBoxLayout,
+ QWidget)
+
+_placeholder = """
+Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
+tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
+veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
+commodo consequat. Duis aute irure dolor in reprehenderit in voluptate
+velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
+occaecat cupidatat non proident, sunt in culpa qui officia deserunt
+mollit anim id est laborum
+"""
+
+
+class Widget(QWidget):
+ def __init__(self, parent=None):
+ super(Widget, self).__init__(parent)
+
+ menu_widget = QListWidget()
+ for i in range(10):
+ item = QListWidgetItem("Item {}".format(i))
+ item.setTextAlignment(Qt.AlignCenter)
+ menu_widget.addItem(item)
+
+ text_widget = QLabel(_placeholder)
+ button = QPushButton("Something")
+
+ content_layout = QVBoxLayout()
+ content_layout.addWidget(text_widget)
+ content_layout.addWidget(button)
+ main_widget = QWidget()
+ main_widget.setLayout(content_layout)
+
+ layout = QHBoxLayout()
+ layout.addWidget(menu_widget, 1)
+ layout.addWidget(main_widget, 4)
+ self.setLayout(layout)
+
+
+if __name__ == "__main__":
+ app = QApplication()
+
+ w = Widget()
+ w.show()
+
+ _style = None
+ with open("style.qss", "r") as f:
+ _style = f.read()
+ app.setStyleSheet(_style)
+
+ sys.exit(app.exec_())
diff --git a/sources/pyside2/doc/tutorials/basictutorial/widgetstyling.rst b/sources/pyside2/doc/tutorials/basictutorial/widgetstyling.rst
new file mode 100644
index 00000000..a79f9c89
--- /dev/null
+++ b/sources/pyside2/doc/tutorials/basictutorial/widgetstyling.rst
@@ -0,0 +1,169 @@
+Widget Styling
+**************
+
+Qt Widgets application use a default theme depending on the platform.
+In some cases, there are system-wide configurations that modify the Qt theme,
+and applications are displayed differently.
+
+However, you can take care of your own widgets and provide a custom style
+to each component. As an example, look at the following simple snippet:
+
+.. code-block:: python
+
+ import sys
+ from PySide2.QtCore import Qt
+ from PySide2.QtWidgets import QApplication, QLabel
+
+ if __name__ == "__main__":
+ app = QApplication()
+ w = QLabel("This is a placeholder text")
+ w.setAlignment(Qt.AlignCenter)
+ w.show()
+ sys.exit(app.exec_())
+
+When you execute this code, you will see a simple `QLabel` aligned at the
+center, and with a placeholder text.
+
+.. image:: widgetstyling-simple-no.png
+ :alt: Simple Widget with no style
+
+You can style your application using the CSS-like syntax.
+For more information, see `Qt Style Sheets Reference`_.
+
+A `QLabel` can be styled differently by setting some of its CSS
+properties, such as `background-color` and `font-family`,
+so let's see how does the code look like with these changes:
+
+.. code-block:: python
+
+ import sys
+ from PySide2.QtCore import Qt
+ from PySide2.QtWidgets import QApplication, QLabel
+
+ if __name__ == "__main__":
+ app = QApplication()
+ w = QLabel("This is a placeholder text")
+ w.setAlignment(Qt.AlignCenter)
+ w.setStyleSheet("""
+ background-color: #262626;
+ color: #FFFFFF;
+ font-family: Titillium;
+ font-size: 18px;
+ """)
+ w.show()
+ sys.exit(app.exec_())
+
+Now when you run the code, notice that the `QLabel` looks different with your
+custom style:
+
+.. image:: widgetstyling-simple-yes.png
+ :alt: Simple Widget with Style
+
+
+.. note::
+
+ If you don't have the font `Titillium` installed, you can try with any
+ other you prefer.
+ Remember you can list your installed fonts using `QFontDatabase`,
+ specifically the `families()` method.
+
+
+Styling each UI element separately like you did in the previous snippet is a
+lot of work. The easier alternative for this is to use Qt Style Sheets,
+which is one or more `.qss` files defining the style for the UI elements in
+your application.
+
+More examples can be found in the `Qt Style Sheet Examples`_ documentation
+page.
+
+
+.. _`Qt Style Sheets Reference`: https://doc.qt.io/qt-5/stylesheet-reference.html
+.. _`Qt Style Sheet Examples`: https://doc.qt.io/qt-5/stylesheet-examples.html
+
+Qt Style Sheets
+===============
+
+.. warning::
+
+ Before starting modifying your application, keep in mind that you will be
+ responsible for all the graphical details of the application.
+ Altering margins, and sizes might end up looking strange or incorrect, so you
+ need to be careful when altering the style.
+ It's recommended to create a full new Qt style to cover all the possible
+ corner cases.
+
+A `qss` file is quite similar to a CSS file, but you need to specify the Widget
+component and optionally the name of the object::
+
+ QLabel {
+ background-color: red;
+ }
+
+ QLabel#title {
+ font-size: 20px;
+ }
+
+The first style defines a `background-color` for all `QLabel` objects in your
+application, whereas the later one styles the `title` object only.
+
+.. note::
+
+ You can set object names with the `setObjectName(str)` function to any Qt
+ object, for example: for a `label = QLabel("Test")`, you can write
+ `label.setObjectName("title")`
+
+
+Once you have a `qss` file for your application, you can apply it by reading
+the file and using the `QApplication.setStyleSheet(str)` function:
+
+.. code-block:: python
+
+ if __name__ == "__main__":
+ app = QApplication()
+
+ w = Widget()
+ w.show()
+
+ with open("style.qss", "r") as f:
+ _style = f.read()
+ app.setStyleSheet(_style)
+
+ sys.exit(app.exec_())
+
+Having a general `qss` file allows you to decouple the styling aspects of
+the code, without mixing it in the middle of the general functionality, and you
+can simply enable it or disable it.
+
+Look at this new example, with more widgets components:
+
+.. literalinclude:: widgetstyling.py
+ :linenos:
+ :lines: 59-81
+
+This displays a two column widget, with a `QListWidget` on the left and a
+`QLabel` and a `QPushButton` on the right. It looks like this when you run the
+code:
+
+.. image:: widgetstyling-no.png
+ :alt: Widget with no style
+
+If you add content to the previously described `style.qss` file, you can modify
+the look-n-feel of the previous example:
+
+.. literalinclude:: style.qss
+ :linenos:
+
+The style changes mainly the color of the different widgets, alter the
+alignment, and includes some spacing.
+You can also use state-based styling on the QListWidget *items* for example, to
+style them differently depending on whether they are *selected* or not.
+
+After applying all the styling alternatives you explored in this topic, notice
+that the `QLabel` example looks a lot different now.
+Try running the code to check its new look:
+
+.. image:: widgetstyling-yes.png
+ :alt: Widget with style
+
+You have the freedom to tune your style sheets and provide a really nice
+look-n-feel to all your applications.
diff --git a/sources/pyside2/doc/tutorials/datavisualize/datavisualize3/main_window.py b/sources/pyside2/doc/tutorials/datavisualize/datavisualize3/main_window.py
index 64f831e5..656609a5 100644
--- a/sources/pyside2/doc/tutorials/datavisualize/datavisualize3/main_window.py
+++ b/sources/pyside2/doc/tutorials/datavisualize/datavisualize3/main_window.py
@@ -39,8 +39,8 @@
#############################################################################
from PySide2.QtCore import Slot, qApp
-from PySide2.QtGui import QKeySequence
-from PySide2.QtWidgets import QMainWindow, QAction
+from PySide2.QtGui import QAction, QKeySequence
+from PySide2.QtWidgets import QMainWindow
class MainWindow(QMainWindow):
diff --git a/sources/pyside2/doc/tutorials/datavisualize/datavisualize4/main_window.py b/sources/pyside2/doc/tutorials/datavisualize/datavisualize4/main_window.py
index 9f7c6814..2157b7b1 100644
--- a/sources/pyside2/doc/tutorials/datavisualize/datavisualize4/main_window.py
+++ b/sources/pyside2/doc/tutorials/datavisualize/datavisualize4/main_window.py
@@ -39,8 +39,8 @@
#############################################################################
from PySide2.QtCore import Slot, qApp
-from PySide2.QtGui import QKeySequence
-from PySide2.QtWidgets import QMainWindow, QAction
+from PySide2.QtGui import QAction, QKeySequence
+from PySide2.QtWidgets import QMainWindow
class MainWindow(QMainWindow):
diff --git a/sources/pyside2/doc/tutorials/datavisualize/datavisualize5/main_window.py b/sources/pyside2/doc/tutorials/datavisualize/datavisualize5/main_window.py
index 4786365e..30d6582b 100644
--- a/sources/pyside2/doc/tutorials/datavisualize/datavisualize5/main_window.py
+++ b/sources/pyside2/doc/tutorials/datavisualize/datavisualize5/main_window.py
@@ -39,8 +39,8 @@
#############################################################################
from PySide2.QtCore import Slot, qApp
-from PySide2.QtGui import QKeySequence
-from PySide2.QtWidgets import QMainWindow, QAction
+from PySide2.QtGui import QAction, QKeySequence
+from PySide2.QtWidgets import QMainWindow
class MainWindow(QMainWindow):
diff --git a/sources/pyside2/doc/tutorials/datavisualize/datavisualize6/main_window.py b/sources/pyside2/doc/tutorials/datavisualize/datavisualize6/main_window.py
index c223aa69..9e9ea847 100644
--- a/sources/pyside2/doc/tutorials/datavisualize/datavisualize6/main_window.py
+++ b/sources/pyside2/doc/tutorials/datavisualize/datavisualize6/main_window.py
@@ -39,8 +39,8 @@
#############################################################################
from PySide2.QtCore import Slot, qApp
-from PySide2.QtGui import QKeySequence
-from PySide2.QtWidgets import QMainWindow, QAction
+from PySide2.QtGui import QAction, QKeySequence
+from PySide2.QtWidgets import QMainWindow
class MainWindow(QMainWindow):
diff --git a/sources/pyside2/doc/tutorials/expenses/expenses.rst b/sources/pyside2/doc/tutorials/expenses/expenses.rst
index f643ec29..640feb48 100644
--- a/sources/pyside2/doc/tutorials/expenses/expenses.rst
+++ b/sources/pyside2/doc/tutorials/expenses/expenses.rst
@@ -3,12 +3,12 @@ Expenses Tool Tutorial
######################
In this tutorial you will learn the following concepts:
-* creating user interfaces programatically,
-* layouts and widgets,
-* overloading Qt classes,
-* connecting signal and slots,
-* interacting with QWidgets,
-* and building your own application.
+ * creating user interfaces programatically,
+ * layouts and widgets,
+ * overloading Qt classes,
+ * connecting signal and slots,
+ * interacting with QWidgets,
+ * and building your own application.
The requirements:
* A simple window for the application
diff --git a/sources/pyside2/doc/tutorials/expenses/main.py b/sources/pyside2/doc/tutorials/expenses/main.py
index 6cc91167..d927f126 100644
--- a/sources/pyside2/doc/tutorials/expenses/main.py
+++ b/sources/pyside2/doc/tutorials/expenses/main.py
@@ -40,8 +40,8 @@
import sys
from PySide2.QtCore import Qt, Slot
-from PySide2.QtGui import QPainter
-from PySide2.QtWidgets import (QAction, QApplication, QHeaderView, QHBoxLayout, QLabel, QLineEdit,
+from PySide2.QtGui import QAction, QPainter
+from PySide2.QtWidgets import (QApplication, QHeaderView, QHBoxLayout, QLabel, QLineEdit,
QMainWindow, QPushButton, QTableWidget, QTableWidgetItem,
QVBoxLayout, QWidget)
from PySide2.QtCharts import QtCharts
diff --git a/sources/pyside2/doc/tutorials/expenses/main_snake_case.py b/sources/pyside2/doc/tutorials/expenses/main_snake_case.py
new file mode 100644
index 00000000..154396b4
--- /dev/null
+++ b/sources/pyside2/doc/tutorials/expenses/main_snake_case.py
@@ -0,0 +1,209 @@
+#############################################################################
+##
+## Copyright (C) 2020 The Qt Company Ltd.
+## Contact: http://www.qt.io/licensing/
+##
+## This file is part of the Qt for Python examples of the Qt Toolkit.
+##
+## $QT_BEGIN_LICENSE:BSD$
+## You may use this file under the terms of the BSD license as follows:
+##
+## "Redistribution and use in source and binary forms, with or without
+## modification, are permitted provided that the following conditions are
+## met:
+## * Redistributions of source code must retain the above copyright
+## notice, this list of conditions and the following disclaimer.
+## * Redistributions in binary form must reproduce the above copyright
+## notice, this list of conditions and the following disclaimer in
+## the documentation and/or other materials provided with the
+## distribution.
+## * Neither the name of The Qt Company Ltd nor the names of its
+## contributors may be used to endorse or promote products derived
+## from this software without specific prior written permission.
+##
+##
+## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+##
+## $QT_END_LICENSE$
+##
+#############################################################################
+
+import sys
+from PySide2.QtCore import Qt, Slot
+from PySide2.QtGui import QPainter
+from PySide2.QtWidgets import (QAction, QApplication, QHeaderView, QHBoxLayout, QLabel, QLineEdit,
+ QMainWindow, QPushButton, QTableWidget, QTableWidgetItem,
+ QVBoxLayout, QWidget)
+from PySide2.QtCharts import QtCharts
+
+from __feature__ import snake_case
+
+
+class Widget(QWidget):
+ def __init__(self):
+ QWidget.__init__(self)
+ self.items = 0
+
+ # Example data
+ self._data = {"Water": 24.5, "Electricity": 55.1, "Rent": 850.0,
+ "Supermarket": 230.4, "Internet": 29.99, "Bars": 21.85,
+ "Public transportation": 60.0, "Coffee": 22.45, "Restaurants": 120}
+
+ # Left
+ self.table = QTableWidget()
+ self.table.set_column_count(2)
+ self.table.set_horizontal_header_labels(["Description", "Price"])
+ self.table.horizontal_header().set_section_resize_mode(QHeaderView.Stretch)
+
+ # Chart
+ self.chart_view = QtCharts.QChartView()
+ self.chart_view.set_render_hint(QPainter.Antialiasing)
+
+ # Right
+ self.description = QLineEdit()
+ self.price = QLineEdit()
+ self.add = QPushButton("Add")
+ self.clear = QPushButton("Clear")
+ self.quit = QPushButton("Quit")
+ self.plot = QPushButton("Plot")
+
+ # Disabling 'Add' button
+ self.add.setEnabled(False)
+
+ self.right = QVBoxLayout()
+ self.right.set_margin(10)
+ self.right.add_widget(QLabel("Description"))
+ self.right.add_widget(self.description)
+ self.right.add_widget(QLabel("Price"))
+ self.right.add_widget(self.price)
+ self.right.add_widget(self.add)
+ self.right.add_widget(self.plot)
+ self.right.add_widget(self.chart_view)
+ self.right.add_widget(self.clear)
+ self.right.add_widget(self.quit)
+
+ # QWidget Layout
+ self.layout = QHBoxLayout()
+
+ #self.table_view.setSizePolicy(size)
+ self.layout.add_widget(self.table)
+ self.layout.add_layout(self.right)
+
+ # Set the layout to the QWidget
+ self.set_layout(self.layout)
+
+ # Signals and Slots
+ self.add.clicked.connect(self.add_element)
+ self.quit.clicked.connect(self.quit_application)
+ self.plot.clicked.connect(self.plot_data)
+ self.clear.clicked.connect(self.clear_table)
+ self.description.textChanged[str].connect(self.check_disable)
+ self.price.textChanged[str].connect(self.check_disable)
+
+ # Fill example data
+ self.fill_table()
+
+ @Slot()
+ def add_element(self):
+ des = self.description.text()
+ price = self.price.text()
+
+ self.table.insert_row(self.items)
+ description_item = QTableWidgetItem(des)
+ price_item = QTableWidgetItem("{:.2f}".format(float(price)))
+ price_item.set_text_alignment(Qt.AlignRight)
+
+ self.table.set_item(self.items, 0, description_item)
+ self.table.set_item(self.items, 1, price_item)
+
+ self.description.set_text("")
+ self.price.set_text("")
+
+ self.items += 1
+
+ @Slot()
+ def check_disable(self, s):
+ if not self.description.text() or not self.price.text():
+ self.add.set_enabled(False)
+ else:
+ self.add.set_enabled(True)
+
+ @Slot()
+ def plot_data(self):
+ # Get table information
+ series = QtCharts.QPieSeries()
+ for i in range(self.table.row_count()):
+ text = self.table.item(i, 0).text()
+ number = float(self.table.item(i, 1).text())
+ series.append(text, number)
+
+ chart = QtCharts.QChart()
+ chart.add_series(series)
+ chart.legend().set_alignment(Qt.AlignLeft)
+ self.chart_view.set_chart(chart)
+
+ @Slot()
+ def quit_application(self):
+ QApplication.quit()
+
+ def fill_table(self, data=None):
+ data = self._data if not data else data
+ for desc, price in data.items():
+ description_item = QTableWidgetItem(desc)
+ price_item = QTableWidgetItem("{:.2f}".format(price))
+ price_item.set_text_alignment(Qt.AlignRight)
+ self.table.insert_row(self.items)
+ self.table.set_item(self.items, 0, description_item)
+ self.table.set_item(self.items, 1, price_item)
+ self.items += 1
+
+ @Slot()
+ def clear_table(self):
+ self.table.set_row_count(0)
+ self.items = 0
+
+
+class MainWindow(QMainWindow):
+ def __init__(self, widget):
+ QMainWindow.__init__(self)
+ self.setWindowTitle("Tutorial")
+
+ # Menu
+ self.menu = self.menu_bar()
+ self.file_menu = self.menu.add_menu("File")
+
+ # Exit QAction
+ exit_action = QAction("Exit", self)
+ exit_action.set_shortcut("Ctrl+Q")
+ exit_action.triggered.connect(self.exit_app)
+
+ self.file_menu.add_action(exit_action)
+ self.set_central_widget(widget)
+
+ @Slot()
+ def exit_app(self, checked):
+ QApplication.quit()
+
+
+if __name__ == "__main__":
+ # Qt Application
+ app = QApplication(sys.argv)
+ # QWidget
+ widget = Widget()
+ # QMainWindow using QWidget as central widget
+ window = MainWindow(widget)
+ window.resize(800, 600)
+ window.show()
+
+ # Execute application
+ sys.exit(app.exec_())
diff --git a/sources/pyside2/doc/tutorials/expenses/steps/02-expenses.py b/sources/pyside2/doc/tutorials/expenses/steps/02-expenses.py
index 0546bc9f..9ffb2f9d 100644
--- a/sources/pyside2/doc/tutorials/expenses/steps/02-expenses.py
+++ b/sources/pyside2/doc/tutorials/expenses/steps/02-expenses.py
@@ -39,7 +39,8 @@
#############################################################################
import sys
-from PySide2.QtWidgets import QAction, QApplication, QMainWindow
+from PySide2.QtGui import QAction
+from PySide2.QtWidgets import QApplication, QMainWindow
class MainWindow(QMainWindow):
diff --git a/sources/pyside2/doc/tutorials/expenses/steps/03-expenses.py b/sources/pyside2/doc/tutorials/expenses/steps/03-expenses.py
index bc753309..1cb2f003 100644
--- a/sources/pyside2/doc/tutorials/expenses/steps/03-expenses.py
+++ b/sources/pyside2/doc/tutorials/expenses/steps/03-expenses.py
@@ -40,7 +40,8 @@
import sys
from PySide2.QtCore import Slot
-from PySide2.QtWidgets import QAction, QApplication, QMainWindow
+from PySide2.QtGui import QAction
+from PySide2.QtWidgets import QApplication, QMainWindow
from PySide2.QtCharts import QtCharts
diff --git a/sources/pyside2/doc/tutorials/expenses/steps/04-expenses.py b/sources/pyside2/doc/tutorials/expenses/steps/04-expenses.py
index 78e9b1d1..80a5cb16 100644
--- a/sources/pyside2/doc/tutorials/expenses/steps/04-expenses.py
+++ b/sources/pyside2/doc/tutorials/expenses/steps/04-expenses.py
@@ -40,7 +40,8 @@
import sys
from PySide2.QtCore import Slot
-from PySide2.QtWidgets import QAction, QApplication, QMainWindow, QWidget
+from PySide2.QtGui import QAction
+from PySide2.QtWidgets import QApplication, QMainWindow, QWidget
class Widget(QWidget):
diff --git a/sources/pyside2/doc/tutorials/expenses/steps/05-expenses.py b/sources/pyside2/doc/tutorials/expenses/steps/05-expenses.py
index 6fd515f4..a72f8d99 100644
--- a/sources/pyside2/doc/tutorials/expenses/steps/05-expenses.py
+++ b/sources/pyside2/doc/tutorials/expenses/steps/05-expenses.py
@@ -40,7 +40,8 @@
import sys
from PySide2.QtCore import Slot
-from PySide2.QtWidgets import (QAction, QApplication, QHeaderView, QHBoxLayout, QMainWindow,
+from PySide2.QtGui import QAction
+from PySide2.QtWidgets import (QApplication, QHeaderView, QHBoxLayout, QMainWindow,
QTableWidget, QTableWidgetItem, QWidget)
diff --git a/sources/pyside2/doc/tutorials/expenses/steps/06-expenses.py b/sources/pyside2/doc/tutorials/expenses/steps/06-expenses.py
index 38fa881b..e2c32e5c 100644
--- a/sources/pyside2/doc/tutorials/expenses/steps/06-expenses.py
+++ b/sources/pyside2/doc/tutorials/expenses/steps/06-expenses.py
@@ -40,7 +40,8 @@
import sys
from PySide2.QtCore import Slot
-from PySide2.QtWidgets import (QAction, QApplication, QHeaderView, QHBoxLayout, QLabel, QLineEdit,
+from PySide2.QtGui import QAction
+from PySide2.QtWidgets import (QApplication, QHeaderView, QHBoxLayout, QLabel, QLineEdit,
QMainWindow, QPushButton, QTableWidget, QTableWidgetItem,
QVBoxLayout, QWidget)
diff --git a/sources/pyside2/doc/tutorials/expenses/steps/07-expenses.py b/sources/pyside2/doc/tutorials/expenses/steps/07-expenses.py
index 6b915806..acc7edc7 100644
--- a/sources/pyside2/doc/tutorials/expenses/steps/07-expenses.py
+++ b/sources/pyside2/doc/tutorials/expenses/steps/07-expenses.py
@@ -40,7 +40,8 @@
import sys
from PySide2.QtCore import Slot
-from PySide2.QtWidgets import (QAction, QApplication, QHeaderView, QHBoxLayout, QLabel, QLineEdit,
+from PySide2.QtGui import QAction
+from PySide2.QtWidgets import (QApplication, QHeaderView, QHBoxLayout, QLabel, QLineEdit,
QMainWindow, QPushButton, QTableWidget, QTableWidgetItem,
QVBoxLayout, QWidget)
diff --git a/sources/pyside2/doc/tutorials/expenses/steps/08-expenses.py b/sources/pyside2/doc/tutorials/expenses/steps/08-expenses.py
index 2f18dff9..a6003cb3 100644
--- a/sources/pyside2/doc/tutorials/expenses/steps/08-expenses.py
+++ b/sources/pyside2/doc/tutorials/expenses/steps/08-expenses.py
@@ -40,7 +40,8 @@
import sys
from PySide2.QtCore import Slot
-from PySide2.QtWidgets import (QAction, QApplication, QHeaderView, QHBoxLayout, QLabel, QLineEdit,
+from PySide2.QtGui import QAction
+from PySide2.QtWidgets import (QApplication, QHeaderView, QHBoxLayout, QLabel, QLineEdit,
QMainWindow, QPushButton, QTableWidget, QTableWidgetItem,
QVBoxLayout, QWidget)
diff --git a/sources/pyside2/doc/tutorials/expenses/steps/09-expenses.py b/sources/pyside2/doc/tutorials/expenses/steps/09-expenses.py
index 6b5d87e2..3f1aed2c 100644
--- a/sources/pyside2/doc/tutorials/expenses/steps/09-expenses.py
+++ b/sources/pyside2/doc/tutorials/expenses/steps/09-expenses.py
@@ -40,8 +40,8 @@
import sys
from PySide2.QtCore import Slot
-from PySide2.QtGui import QPainter
-from PySide2.QtWidgets import (QAction, QApplication, QHeaderView, QHBoxLayout, QLabel, QLineEdit,
+from PySide2.QtGui import QAction, QPainter
+from PySide2.QtWidgets import (QApplication, QHeaderView, QHBoxLayout, QLabel, QLineEdit,
QMainWindow, QPushButton, QTableWidget, QTableWidgetItem,
QVBoxLayout, QWidget)
from PySide2.QtCharts import QtCharts
diff --git a/sources/pyside2/doc/tutorials/expenses/steps/10-expenses.py b/sources/pyside2/doc/tutorials/expenses/steps/10-expenses.py
index 6cc91167..2a7bddab 100644
--- a/sources/pyside2/doc/tutorials/expenses/steps/10-expenses.py
+++ b/sources/pyside2/doc/tutorials/expenses/steps/10-expenses.py
@@ -40,8 +40,8 @@
import sys
from PySide2.QtCore import Qt, Slot
-from PySide2.QtGui import QPainter
-from PySide2.QtWidgets import (QAction, QApplication, QHeaderView, QHBoxLayout, QLabel, QLineEdit,
+from PySide2.QtGui import QAction, QPainter
+from PySide2.QtWidgets import (QQApplication, QHeaderView, QHBoxLayout, QLabel, QLineEdit,
QMainWindow, QPushButton, QTableWidget, QTableWidgetItem,
QVBoxLayout, QWidget)
from PySide2.QtCharts import QtCharts
diff --git a/sources/pyside2/doc/tutorials/index.rst b/sources/pyside2/doc/tutorials/index.rst
index 598b42ca..9739eee9 100644
--- a/sources/pyside2/doc/tutorials/index.rst
+++ b/sources/pyside2/doc/tutorials/index.rst
@@ -19,6 +19,7 @@ Basic tutorials
basictutorial/dialog.rst
basictutorial/uifiles.rst
basictutorial/qrcfiles.rst
+ basictutorial/widgetstyling.rst
Real use-cases applications
---------------------------
diff --git a/sources/pyside2/doc/tutorials/portingguide/chapter3/bookwindow.py b/sources/pyside2/doc/tutorials/portingguide/chapter3/bookwindow.py
index 4bc4cf48..8b0c7a6a 100644
--- a/sources/pyside2/doc/tutorials/portingguide/chapter3/bookwindow.py
+++ b/sources/pyside2/doc/tutorials/portingguide/chapter3/bookwindow.py
@@ -40,7 +40,8 @@
from __future__ import print_function, absolute_import
-from PySide2.QtWidgets import (QAction, QAbstractItemView, qApp, QDataWidgetMapper,
+from PySide2.QtGui import QAction
+from PySide2.QtWidgets import (QAbstractItemView, qApp, QDataWidgetMapper,
QHeaderView, QMainWindow, QMessageBox)
from PySide2.QtGui import QKeySequence
from PySide2.QtSql import (QSqlRelation, QSqlRelationalTableModel, QSqlTableModel,
diff --git a/sources/pyside2/libpyside/CMakeLists.txt b/sources/pyside2/libpyside/CMakeLists.txt
index 11342ec7..d6b20c45 100644
--- a/sources/pyside2/libpyside/CMakeLists.txt
+++ b/sources/pyside2/libpyside/CMakeLists.txt
@@ -40,9 +40,11 @@ endif()
set(libpyside_SRC
dynamicqmetaobject.cpp
+ feature_select.cpp
signalmanager.cpp
globalreceiverv2.cpp
pysideclassinfo.cpp
+ pysideqenum.cpp
pysidemetafunction.cpp
pysidesignal.cpp
pysideslot.cpp
@@ -124,7 +126,9 @@ endif()
set(libpyside_HEADERS
dynamicqmetaobject.h
+ feature_select.h
pysideclassinfo.h
+ pysideqenum.h
pysidemacros.h
signalmanager.h
pyside.h
diff --git a/sources/pyside2/libpyside/dynamicqmetaobject.cpp b/sources/pyside2/libpyside/dynamicqmetaobject.cpp
index dae9e205..efdf33ac 100644
--- a/sources/pyside2/libpyside/dynamicqmetaobject.cpp
+++ b/sources/pyside2/libpyside/dynamicqmetaobject.cpp
@@ -44,6 +44,7 @@
#include "pysideproperty.h"
#include "pysideproperty_p.h"
#include "pysideslot_p.h"
+#include "pysideqenum.h"
#include <shiboken.h>
@@ -91,6 +92,10 @@ public:
int addProperty(const QByteArray &property, PyObject *data);
void addInfo(const QByteArray &key, const QByteArray &value);
void addInfo(const QMap<QByteArray, QByteArray> &info);
+ void addEnumerator(const char *name,
+ bool flag,
+ bool scoped,
+ const QVector<QPair<QByteArray, int> > &entries);
void removeProperty(int index);
const QMetaObject *update();
@@ -357,6 +362,28 @@ void MetaObjectBuilder::addInfo(const QMap<QByteArray, QByteArray> &info)
m_d->addInfo(info);
}
+void MetaObjectBuilder::addEnumerator(const char *name, bool flag, bool scoped,
+ const QVector<QPair<QByteArray, int> > &entries)
+{
+ m_d->addEnumerator(name, flag, scoped, entries);
+}
+
+void MetaObjectBuilderPrivate::addEnumerator(const char *name, bool flag, bool scoped,
+ const QVector<QPair<QByteArray, int> > &entries)
+{
+ auto builder = ensureBuilder();
+ int have_already = builder->indexOfEnumerator(name);
+ if (have_already >= 0)
+ builder->removeEnumerator(have_already);
+ auto enumbuilder = builder->addEnumerator(name);
+ enumbuilder.setIsFlag(flag);
+ enumbuilder.setIsScoped(scoped);
+
+ for (auto item : entries)
+ enumbuilder.addKey(item.first, item.second);
+ m_dirty = true;
+}
+
void MetaObjectBuilderPrivate::removeProperty(int index)
{
index -= m_baseObject->propertyCount();
@@ -430,6 +457,8 @@ const QMetaObject *MetaObjectBuilder::update()
return m_d->update();
}
+using namespace Shiboken;
+
void MetaObjectBuilderPrivate::parsePythonType(PyTypeObject *type)
{
// Get all non-QObject-derived base types in method resolution order, filtering out the types
@@ -439,7 +468,7 @@ void MetaObjectBuilderPrivate::parsePythonType(PyTypeObject *type)
// existing connections.
const PyObject *mro = type->tp_mro;
const Py_ssize_t basesCount = PyTuple_GET_SIZE(mro);
- PyTypeObject *qObjectType = Shiboken::Conversions::getPythonTypeObject("QObject*");
+ PyTypeObject *qObjectType = Conversions::getPythonTypeObject("QObject*");
std::vector<PyTypeObject *> basesToCheck;
// Prepend the actual type that we are parsing.
@@ -470,7 +499,7 @@ void MetaObjectBuilderPrivate::parsePythonType(PyTypeObject *type)
// Register signals.
auto data = reinterpret_cast<PySideSignal *>(value);
if (data->data->signalName.isEmpty())
- data->data->signalName = Shiboken::String::toCString(key);
+ data->data->signalName = String::toCString(key);
for (const auto &s : data->data->signatures) {
const auto sig = data->data->signalName + '(' + s.signature + ')';
if (m_baseObject->indexOfSignal(sig) == -1) {
@@ -489,7 +518,7 @@ void MetaObjectBuilderPrivate::parsePythonType(PyTypeObject *type)
}
}
- Shiboken::AutoDecRef slotAttrName(Shiboken::String::fromCString(PYSIDE_SLOT_LIST_ATTR));
+ AutoDecRef slotAttrName(String::fromCString(PYSIDE_SLOT_LIST_ATTR));
// PYSIDE-315: Now take care of the rest.
// Signals and slots should be separated, unless the types are modified, later.
// We check for this using "is_sorted()". Sorting no longer happens at all.
@@ -501,16 +530,16 @@ void MetaObjectBuilderPrivate::parsePythonType(PyTypeObject *type)
while (PyDict_Next(attrs, &pos, &key, &value)) {
if (Property::checkType(value)) {
- const int index = m_baseObject->indexOfProperty(Shiboken::String::toCString(key));
+ const int index = m_baseObject->indexOfProperty(String::toCString(key));
if (index == -1)
- addProperty(Shiboken::String::toCString(key), value);
+ addProperty(String::toCString(key), value);
} else if (PyFunction_Check(value)) {
// Register slots.
if (PyObject_HasAttr(value, slotAttrName)) {
PyObject *signatureList = PyObject_GetAttr(value, slotAttrName);
for (Py_ssize_t i = 0, i_max = PyList_Size(signatureList); i < i_max; ++i) {
PyObject *pySignature = PyList_GET_ITEM(signatureList, i);
- QByteArray signature(Shiboken::String::toCString(pySignature));
+ QByteArray signature(String::toCString(pySignature));
// Split the slot type and its signature.
QByteArray type;
const int spacePos = signature.indexOf(' ');
@@ -530,4 +559,29 @@ void MetaObjectBuilderPrivate::parsePythonType(PyTypeObject *type)
}
}
}
+ // PYSIDE-957: Collect the delayed QEnums
+ auto collectedEnums = PySide::QEnum::resolveDelayedQEnums(type);
+ for (PyObject *obEnumType : collectedEnums) {
+ bool isFlag = PySide::QEnum::isFlag(obEnumType);
+ AutoDecRef obName(PyObject_GetAttr(obEnumType, PyMagicName::name()));
+ // Everything has been checked already in resolveDelayedQEnums.
+ // Therefore, we don't need to error-check here again.
+ auto name = String::toCString(obName);
+ AutoDecRef members(PyObject_GetAttr(obEnumType, PyMagicName::members()));
+ AutoDecRef items(PepMapping_Items(members));
+ Py_ssize_t nr_items = PySequence_Length(items);
+
+ QVector<QPair<QByteArray, int> > entries;
+ for (Py_ssize_t idx = 0; idx < nr_items; ++idx) {
+ AutoDecRef item(PySequence_GetItem(items, idx));
+ AutoDecRef key(PySequence_GetItem(item, 0));
+ AutoDecRef member(PySequence_GetItem(item, 1));
+ AutoDecRef value(PyObject_GetAttr(member, Shiboken::PyName::value()));
+ auto ckey = String::toCString(key);
+ auto ivalue = PyInt_AsSsize_t(value); // int/long cheating
+ auto thing = QPair<QByteArray, int>(ckey, int(ivalue));
+ entries.push_back(thing);
+ }
+ addEnumerator(name, isFlag, true, entries);
+ }
}
diff --git a/sources/pyside2/libpyside/dynamicqmetaobject.h b/sources/pyside2/libpyside/dynamicqmetaobject.h
index 1fbe73ea..7279d5c2 100644
--- a/sources/pyside2/libpyside/dynamicqmetaobject.h
+++ b/sources/pyside2/libpyside/dynamicqmetaobject.h
@@ -68,7 +68,10 @@ public:
int addProperty(const char *property, PyObject *data);
void addInfo(const char *key, const char *value);
void addInfo(const QMap<QByteArray, QByteArray> &info);
-
+ void addEnumerator(const char *name,
+ bool flag,
+ bool scoped,
+ const QVector<QPair<QByteArray, int> > &entries);
void removeProperty(int index);
const QMetaObject *update();
diff --git a/sources/pyside2/libpyside/feature_select.cpp b/sources/pyside2/libpyside/feature_select.cpp
new file mode 100644
index 00000000..7b98b03f
--- /dev/null
+++ b/sources/pyside2/libpyside/feature_select.cpp
@@ -0,0 +1,496 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt for Python.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "feature_select.h"
+
+#include <shiboken.h>
+#include <sbkstaticstrings.h>
+
+#include <QtCore/QtGlobal>
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// PYSIDE-1019: Support switchable extensions
+//
+// This functionality is no longer implemented in the signature module, since
+// the PyCFunction getsets do not have to be modified any longer.
+// Instead, we simply exchange the complete class dicts. This is done in the
+// basewrapper.cpp file.
+//
+// This is the general framework of the switchable extensions.
+// A maximum of eight features is planned so far. This seems to be enough.
+// More features are possible, but then we must somehow register the
+// extra `select_id`s above 255.
+//
+
+/*****************************************************************************
+
+ How Does This Feature Selection Work?
+ -------------------------------------
+
+The basic idea is to replace the `tp_dict` of a QObject derived type.
+This way, we can replace the methods of the dict in no time.
+
+The crucial point to understand is how the `tp_dict` is actually accessed:
+When you type "QObject.__dict__", the descriptor of SbkObjectType_Type
+is called. This descriptor is per default unassigned, so the base class
+PyType_Type provides the tp_getset method `type_dict`:
+
+ static PyObject *
+ type_dict(PyTypeObject *type, void *context)
+ {
+ if (type->tp_dict == NULL) {
+ Py_RETURN_NONE;
+ }
+ return PyDictProxy_New(type->tp_dict);
+ }
+
+In order to change that, we need to insert our own version into SbkObjectType:
+
+ static PyObject *Sbk_TypeGet___dict__(PyTypeObject *type, void *context)
+ {
+ auto dict = type->tp_dict;
+ if (dict == NULL)
+ Py_RETURN_NONE;
+ if (SelectFeatureSet != nullptr)
+ dict = SelectFeatureSet(type);
+ return PyDictProxy_New(dict);
+ }
+
+This way, the Python function `type_ready()` does not fill in the default,
+but uses our modified version. It a similar way, we overwrite type_getattro
+with our own version, again in SbkObjectType, replacing the default of
+PyType_Type.
+
+Now we can exchange the dict with a customized version.
+We have our own derived type `ChameleonDict` with additional attributes.
+These allow us to create a ring of dicts which can be rotated to the actual
+needed dict version:
+
+Every dict has a field `select_id` which is selected by the `from __feature__`
+import. The dicts are cyclic connected by the `dict_ring` field.
+
+When a class dict is required, now always `SelectFeatureSet` is called, which
+looks into the `__name__` attribute of the active module and decides which
+version of `tp_dict` is needed. Then the right dict is searched in the ring
+and created if not already there.
+
+Furthermore, we need to overwrite every `tp_getattro` and `tp_setattro`
+with a version that switches dicts before looking up methods.
+The dict changing must follow the `tp_mro` in order to change all names.
+
+This is everything that the following code does.
+
+*****************************************************************************/
+
+
+namespace PySide { namespace Feature {
+
+using namespace Shiboken;
+
+static PyObject *getFeatureSelectID()
+{
+ static PyObject *zero = PyInt_FromLong(0);
+ static PyObject *feature_dict = GetFeatureDict();
+ // these things are all borrowed
+ PyObject *globals = PyEval_GetGlobals();
+ if (globals == nullptr)
+ return zero;
+ PyObject *modname = PyDict_GetItem(globals, PyMagicName::name());
+ if (modname == nullptr)
+ return zero;
+ PyObject *flag = PyDict_GetItem(feature_dict, modname);
+ if (flag == nullptr || !PyInt_Check(flag)) // int/long cheating
+ return zero;
+ return flag;
+}
+
+// Create a derived dict class
+static PyTypeObject *
+createDerivedDictType()
+{
+ // It is not easy to create a compatible dict object with the
+ // limited API. Easier is to use Python to create a derived
+ // type and to modify that a bit from the C code.
+ PyObject *ChameleonDict = PepRun_GetResult(R"CPP(if True:
+
+ class ChameleonDict(dict):
+ __slots__ = ("dict_ring", "select_id")
+
+ result = ChameleonDict
+
+ )CPP");
+ return reinterpret_cast<PyTypeObject *>(ChameleonDict);
+}
+
+static PyTypeObject *new_dict_type = nullptr;
+
+static void ensureNewDictType()
+{
+ if (new_dict_type == nullptr) {
+ new_dict_type = createDerivedDictType();
+ if (new_dict_type == nullptr)
+ Py_FatalError("PySide2: Problem creating ChameleonDict");
+ }
+}
+
+static inline PyObject *nextInCircle(PyObject *dict)
+{
+ // returns a borrowed ref
+ AutoDecRef next_dict(PyObject_GetAttr(dict, PyName::dict_ring()));
+ return next_dict;
+}
+
+static inline void setNextDict(PyObject *dict, PyObject *next_dict)
+{
+ PyObject_SetAttr(dict, PyName::dict_ring(), next_dict);
+}
+
+static inline void setSelectId(PyObject *dict, PyObject *select_id)
+{
+ PyObject_SetAttr(dict, PyName::select_id(), select_id);
+}
+
+static inline PyObject *getSelectId(PyObject *dict)
+{
+ auto select_id = PyObject_GetAttr(dict, PyName::select_id());
+ return select_id;
+}
+
+static bool replaceClassDict(PyTypeObject *type)
+{
+ /*
+ * Replace the type dict by the derived ChameleonDict.
+ * This is mandatory for all type dicts when they are touched.
+ */
+ ensureNewDictType();
+ PyObject *dict = type->tp_dict;
+ auto ob_ndt = reinterpret_cast<PyObject *>(new_dict_type);
+ PyObject *new_dict = PyObject_CallObject(ob_ndt, nullptr);
+ if (new_dict == nullptr || PyDict_Update(new_dict, dict) < 0)
+ return false;
+ // Insert the default id. Cannot fail for small numbers.
+ AutoDecRef select_id(PyInt_FromLong(0));
+ setSelectId(new_dict, select_id);
+ // insert the dict into itself as ring
+ setNextDict(new_dict, new_dict);
+ // We have now an exact copy of the dict with a new type.
+ // Replace `__dict__` which usually has refcount 1 (but see cyclic_test.py)
+ Py_DECREF(type->tp_dict);
+ type->tp_dict = new_dict;
+ return true;
+}
+
+static bool addNewDict(PyTypeObject *type, PyObject *select_id)
+{
+ /*
+ * Add a new dict to the ring and set it as `type->tp_dict`.
+ * A 'false' return is fatal.
+ */
+ auto dict = type->tp_dict;
+ auto ob_ndt = reinterpret_cast<PyObject *>(new_dict_type);
+ auto new_dict = PyObject_CallObject(ob_ndt, nullptr);
+ if (new_dict == nullptr)
+ return false;
+ setSelectId(new_dict, select_id);
+ // insert the dict into the ring
+ auto next_dict = nextInCircle(dict);
+ setNextDict(dict, new_dict);
+ setNextDict(new_dict, next_dict);
+ type->tp_dict = new_dict;
+ return true;
+}
+
+static bool moveToFeatureSet(PyTypeObject *type, PyObject *select_id)
+{
+ /*
+ * Rotate the ring to the given `select_id` and return `true`.
+ * If not found, stay at the current position and return `false`.
+ */
+ auto initial_dict = type->tp_dict;
+ auto dict = initial_dict;
+ do {
+ dict = nextInCircle(dict);
+ AutoDecRef current_id(getSelectId(dict));
+ // This works because small numbers are singleton objects.
+ if (current_id == select_id) {
+ type->tp_dict = dict;
+ return true;
+ }
+ } while (dict != initial_dict);
+ type->tp_dict = initial_dict;
+ return false;
+}
+
+typedef bool(*FeatureProc)(PyTypeObject *type, PyObject *prev_dict);
+
+static FeatureProc *featurePointer = nullptr;
+
+static bool createNewFeatureSet(PyTypeObject *type, PyObject *select_id)
+{
+ /*
+ * Create a new feature set.
+ * A `false` return value is a fatal error.
+ *
+ * A FeatureProc sees an empty `type->tp_dict` and the previous dict
+ * content in `prev_dict`. It is responsible of filling `type->tp_dict`
+ * with modified content.
+ */
+ static auto small_1 = PyInt_FromLong(255);
+ Q_UNUSED(small_1);
+ static auto small_2 = PyInt_FromLong(255);
+ Q_UNUSED(small_2);
+ // make sure that small integers are cached
+ assert(small_1 != nullptr && small_1 == small_2);
+
+ static auto zero = PyInt_FromLong(0);
+ bool ok = moveToFeatureSet(type, zero);
+ Q_UNUSED(ok);
+ assert(ok);
+
+ AutoDecRef prev_dict(type->tp_dict);
+ Py_INCREF(prev_dict);
+ if (!addNewDict(type, select_id))
+ return false;
+ auto id = PyInt_AsSsize_t(select_id);
+ if (id == -1)
+ return false;
+ FeatureProc *proc = featurePointer;
+ for (int idx = id; *proc != nullptr; ++proc, idx >>= 1) {
+ if (idx & 1) {
+ // clear the tp_dict that will get new content
+ PyDict_Clear(type->tp_dict);
+ // let the proc re-fill the tp_dict
+ if (!(*proc)(type, prev_dict))
+ return false;
+ // if there is still a step, prepare `prev_dict`
+ if (idx >> 1) {
+ prev_dict.reset(PyDict_Copy(type->tp_dict));
+ if (prev_dict.isNull())
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
+static bool SelectFeatureSetSubtype(PyTypeObject *type, PyObject *select_id)
+{
+ if (Py_TYPE(type->tp_dict) == Py_TYPE(PyType_Type.tp_dict)) {
+ // PYSIDE-1019: On first touch, we initialize the dynamic naming.
+ // The dict type will be replaced after the first call.
+ if (!replaceClassDict(type)) {
+ Py_FatalError("failed to replace class dict!");
+ return false;
+ }
+ }
+ if (!moveToFeatureSet(type, select_id)) {
+ if (!createNewFeatureSet(type, select_id)) {
+ Py_FatalError("failed to create a new feature set!");
+ return false;
+ }
+ }
+ return true;
+}
+
+static PyObject *SelectFeatureSet(PyTypeObject *type)
+{
+ /*
+ * This is the main function of the module.
+ * Generated functions call this directly.
+ * Shiboken will assign it via a public hook of `basewrapper.cpp`.
+ */
+ if (Py_TYPE(type->tp_dict) == Py_TYPE(PyType_Type.tp_dict)) {
+ // PYSIDE-1019: On first touch, we initialize the dynamic naming.
+ // The dict type will be replaced after the first call.
+ if (!replaceClassDict(type))
+ return nullptr;
+ }
+ PyObject *select_id = getFeatureSelectID(); // borrowed
+ AutoDecRef current_id(getSelectId(type->tp_dict));
+ if (select_id != current_id) {
+ PyObject *mro = type->tp_mro;
+ Py_ssize_t idx, n = PyTuple_GET_SIZE(mro);
+ // We leave 'Shiboken.Object' and 'object' alone, therefore "n - 2".
+ for (idx = 0; idx < n - 2; idx++) {
+ auto *sub_type = reinterpret_cast<PyTypeObject *>(PyTuple_GET_ITEM(mro, idx));
+ // When any subtype is already resolved (false), we can stop.
+ if (!SelectFeatureSetSubtype(sub_type, select_id))
+ break;
+ }
+ }
+ return type->tp_dict;
+}
+
+// For cppgenerator:
+void Select(PyObject *obj)
+{
+ auto type = Py_TYPE(obj);
+ type->tp_dict = SelectFeatureSet(type);
+}
+
+static bool feature_01_addLowerNames(PyTypeObject *type, PyObject *prev_dict);
+static bool feature_02_addDummyNames(PyTypeObject *type, PyObject *prev_dict);
+static bool feature_04_addDummyNames(PyTypeObject *type, PyObject *prev_dict);
+static bool feature_08_addDummyNames(PyTypeObject *type, PyObject *prev_dict);
+static bool feature_10_addDummyNames(PyTypeObject *type, PyObject *prev_dict);
+static bool feature_20_addDummyNames(PyTypeObject *type, PyObject *prev_dict);
+static bool feature_40_addDummyNames(PyTypeObject *type, PyObject *prev_dict);
+static bool feature_80_addDummyNames(PyTypeObject *type, PyObject *prev_dict);
+
+static FeatureProc featureProcArray[] = {
+ feature_01_addLowerNames,
+ feature_02_addDummyNames,
+ feature_04_addDummyNames,
+ feature_08_addDummyNames,
+ feature_10_addDummyNames,
+ feature_20_addDummyNames,
+ feature_40_addDummyNames,
+ feature_80_addDummyNames,
+ nullptr
+};
+
+void init()
+{
+ featurePointer = featureProcArray;
+ initSelectableFeature(SelectFeatureSet);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// PYSIDE-1019: Support switchable extensions
+//
+// Feature 0x01: Allow snake_case instead of camelCase
+//
+// This functionality is no longer implemented in the signature module, since
+// the PyCFunction getsets do not have to be modified any longer.
+// Instead, we simply exchange the complete class dicts. This is done in the
+// basewrapper.cpp file.
+//
+
+static PyObject *methodWithLowerName(PyTypeObject *type,
+ PyMethodDef *meth,
+ const char *new_name)
+{
+ /*
+ * Create a method with a lower case name.
+ */
+ auto obtype = reinterpret_cast<PyObject *>(type);
+ int len = strlen(new_name);
+ auto name = new char[len + 1];
+ strcpy(name, new_name);
+ auto new_meth = new PyMethodDef;
+ new_meth->ml_name = name;
+ new_meth->ml_meth = meth->ml_meth;
+ new_meth->ml_flags = meth->ml_flags;
+ new_meth->ml_doc = meth->ml_doc;
+ PyObject *descr = nullptr;
+ if (new_meth->ml_flags & METH_STATIC) {
+ AutoDecRef cfunc(PyCFunction_NewEx(new_meth, obtype, nullptr));
+ if (cfunc.isNull())
+ return nullptr;
+ descr = PyStaticMethod_New(cfunc);
+ }
+ else {
+ descr = PyDescr_NewMethod(type, new_meth);
+ }
+ return descr;
+}
+
+static bool feature_01_addLowerNames(PyTypeObject *type, PyObject *prev_dict)
+{
+ /*
+ * Add objects with lower names to `type->tp_dict` from 'prev_dict`.
+ */
+ PyObject *lower_dict = type->tp_dict;
+ PyObject *key, *value;
+ Py_ssize_t pos = 0;
+
+ // We first copy the things over which will not be changed:
+ while (PyDict_Next(prev_dict, &pos, &key, &value)) {
+ if ( Py_TYPE(value) != PepMethodDescr_TypePtr
+ && Py_TYPE(value) != PepStaticMethod_TypePtr) {
+ if (PyDict_SetItem(lower_dict, key, value))
+ return false;
+ continue;
+ }
+ }
+ // Then we walk over the tp_methods to get all methods and insert
+ // them with changed names.
+ PyMethodDef *meth = type->tp_methods;
+ for (; meth != nullptr && meth->ml_name != nullptr; ++meth) {
+ const char *name = String::toCString(String::getSnakeCaseName(meth->ml_name, true));
+ AutoDecRef new_method(methodWithLowerName(type, meth, name));
+ if (new_method.isNull())
+ return false;
+ if (PyDict_SetItemString(lower_dict, name, new_method) < 0)
+ return false;
+ }
+ return true;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// PYSIDE-1019: Support switchable extensions
+//
+// Feature 0x02..0x80: A fake switchable option for testing
+//
+
+#define SIMILAR_FEATURE(xx) \
+static bool feature_##xx##_addDummyNames(PyTypeObject *type, PyObject *prev_dict) \
+{ \
+ PyObject *dict = type->tp_dict; \
+ if (PyDict_Update(dict, prev_dict) < 0) \
+ return false; \
+ Py_INCREF(Py_None); \
+ if (PyDict_SetItemString(dict, "fake_feature_" #xx, Py_None) < 0) \
+ return false; \
+ return true; \
+}
+
+SIMILAR_FEATURE(02)
+SIMILAR_FEATURE(04)
+SIMILAR_FEATURE(08)
+SIMILAR_FEATURE(10)
+SIMILAR_FEATURE(20)
+SIMILAR_FEATURE(40)
+SIMILAR_FEATURE(80)
+
+} // namespace PySide
+} // namespace Feature
diff --git a/sources/pyside2/libpyside/feature_select.h b/sources/pyside2/libpyside/feature_select.h
new file mode 100644
index 00000000..32abffac
--- /dev/null
+++ b/sources/pyside2/libpyside/feature_select.h
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt for Python.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef FEATURE_SELECT_H
+#define FEATURE_SELECT_H
+
+#include "pysidemacros.h"
+#include <sbkpython.h>
+
+namespace PySide {
+namespace Feature {
+
+PYSIDE_API void init();
+PYSIDE_API void Select(PyObject *obj);
+
+} // namespace Feature
+} // namespace PySide
+
+#endif // FEATURE_SELECT_H
diff --git a/sources/pyside2/libpyside/pyside.cpp b/sources/pyside2/libpyside/pyside.cpp
index aa0833d6..c1ddfc27 100644
--- a/sources/pyside2/libpyside/pyside.cpp
+++ b/sources/pyside2/libpyside/pyside.cpp
@@ -50,6 +50,7 @@
#include "pysidemetafunction_p.h"
#include "pysidemetafunction.h"
#include "dynamicqmetaobject.h"
+#include "feature_select.h"
#include <autodecref.h>
#include <basewrapper.h>
@@ -93,6 +94,7 @@ void init(PyObject *module)
MetaFunction::init(module);
// Init signal manager, so it will register some meta types used by QVariant.
SignalManager::instance();
+ Feature::init();
initQApp();
}
@@ -223,8 +225,7 @@ std::size_t getSizeOfQObject(SbkObjectType *type)
void initDynamicMetaObject(SbkObjectType *type, const QMetaObject *base, std::size_t cppObjSize)
{
//create DynamicMetaObject based on python type
- auto userData =
- new TypeUserData(reinterpret_cast<PyTypeObject *>(type), base, cppObjSize);
+ auto userData = new TypeUserData(reinterpret_cast<PyTypeObject *>(type), base, cppObjSize);
userData->mo.update();
Shiboken::ObjectType::setTypeUserData(type, userData, Shiboken::callCppDestructor<TypeUserData>);
@@ -320,7 +321,6 @@ PyObject *getMetaDataFromQObject(QObject *cppSelf, PyObject *self, PyObject *nam
Py_DECREF(attr);
if (!value)
return 0;
- Py_INCREF(value);
attr = value;
}
diff --git a/sources/pyside2/libpyside/pyside.h b/sources/pyside2/libpyside/pyside.h
index 95abaeeb..e241ac74 100644
--- a/sources/pyside2/libpyside/pyside.h
+++ b/sources/pyside2/libpyside/pyside.h
@@ -62,7 +62,7 @@ PYSIDE_API void init(PyObject *module);
* Hash function used to enable hash on objects not supported on native Qt library which has toString function.
*/
template<class T>
-inline uint hash(const T& value)
+inline Py_ssize_t hash(const T& value)
{
return qHash(value.toString());
}
@@ -144,9 +144,11 @@ PYSIDE_API PyObject *getWrapperForQObject(QObject *cppSelf, SbkObjectType *sbk_t
#ifdef PYSIDE_QML_SUPPORT
// Used by QtQuick module to notify QtQml that custom QtQuick items can be registered.
-typedef bool (*QuickRegisterItemFunction)(PyObject *pyObj, const char *uri, int versionMajor,
- int versionMinor, const char *qmlName,
- QQmlPrivate::RegisterType *);
+using QuickRegisterItemFunction =
+ bool (*)(PyObject *pyObj, const char *uri, int versionMajor,
+ int versionMinor, const char *qmlName,
+ bool creatable, const char *noCreationReason,
+ QQmlPrivate::RegisterType *);
PYSIDE_API QuickRegisterItemFunction getQuickRegisterItemFunction();
PYSIDE_API void setQuickRegisterItemFunction(QuickRegisterItemFunction function);
#endif // PYSIDE_QML_SUPPORT
@@ -169,4 +171,3 @@ PYSIDE_API bool registerInternalQtConf();
#endif // PYSIDE_H
-
diff --git a/sources/pyside2/libpyside/pysideproperty.cpp b/sources/pyside2/libpyside/pysideproperty.cpp
index e9548dc2..85db745a 100644
--- a/sources/pyside2/libpyside/pysideproperty.cpp
+++ b/sources/pyside2/libpyside/pysideproperty.cpp
@@ -139,12 +139,17 @@ static void qpropertyMetaCall(PySideProperty *pp, PyObject *self, QMetaObject::C
break;
}
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+ case QMetaObject::RegisterQPropertyObserver:
+ case QMetaObject::SetQPropertyBinding:
+#else
case QMetaObject::QueryPropertyDesignable:
case QMetaObject::QueryPropertyScriptable:
case QMetaObject::QueryPropertyStored:
case QMetaObject::QueryPropertyEditable:
case QMetaObject::QueryPropertyUser:
// just to avoid gcc warnings
+#endif
case QMetaObject::InvokeMetaMethod:
case QMetaObject::CreateInstance:
case QMetaObject::IndexOfMethod:
diff --git a/sources/pyside2/libpyside/pysideqenum.cpp b/sources/pyside2/libpyside/pysideqenum.cpp
new file mode 100644
index 00000000..f46b5536
--- /dev/null
+++ b/sources/pyside2/libpyside/pysideqenum.cpp
@@ -0,0 +1,258 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt for Python.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <shiboken.h>
+
+#include "pysideqenum.h"
+#include "dynamicqmetaobject.h"
+#include "pyside_p.h"
+
+
+///////////////////////////////////////////////////////////////
+//
+// PYSIDE-957: Create QEnum dynamically from Python Enum
+//
+//
+extern "C" {
+
+using namespace Shiboken;
+
+static PyObject *analyzePyEnum(PyObject *pyenum, PyObject *container = nullptr)
+{
+ /*
+ * This is the straight-forward implementation of QEnum/QFlag. It does no
+ * longer create an equivalent Qt enum but takes the Python enum as-is.
+ *
+ * It parses an Enum/Flag derived Python enum completely so that
+ * registering can be done without error checks. This would be impossible
+ * in MetaObjectBuilderPrivate::parsePythonType.
+ */
+ AutoDecRef members(PyObject_GetAttr(pyenum, Shiboken::PyMagicName::members()));
+ if (members.isNull())
+ return nullptr;
+ AutoDecRef items(PepMapping_Items(members));
+ if (items.isNull())
+ return nullptr;
+ int iflag = PySide::QEnum::isFlag(pyenum);
+ if (iflag < 0)
+ return nullptr;
+ Py_ssize_t nr_items = PySequence_Length(items);
+ if (nr_items < 0)
+ return nullptr;
+
+ for (Py_ssize_t idx = 0; idx < nr_items; ++idx) {
+ AutoDecRef item(PySequence_GetItem(items, idx));
+ if (item.isNull())
+ return nullptr;
+
+ // The item should be a 2-element sequence of the key name and an
+ // object containing the value.
+ AutoDecRef key(PySequence_GetItem(item, 0));
+ AutoDecRef member(PySequence_GetItem(item, 1));
+ if (key.isNull() || member.isNull())
+ return nullptr;
+ if (!Shiboken::String::check(key)) {
+ // '%.200s' is the safety stringbuffer size of most CPython functions.
+ PyErr_Format(PyExc_TypeError,
+ "QEnum expected a string mapping as __members__, got '%.200s'",
+ Py_TYPE(key)->tp_name);
+ return nullptr;
+ }
+
+ // Get the value.
+ AutoDecRef value(PyObject_GetAttr(member, Shiboken::PyName::value()));
+ if (value.isNull())
+ return nullptr;
+ if (!PyInt_Check(value)) { // int/long cheating
+ PyErr_Format(PyExc_TypeError,
+ "QEnum expected an int value as '%.200s', got '%.200s'",
+ Shiboken::String::toCString(key), Py_TYPE(value)->tp_name);
+ return nullptr;
+ }
+ }
+ Py_RETURN_NONE;
+}
+
+static Py_ssize_t get_lineno()
+{
+ PyObject *frame = reinterpret_cast<PyObject *>(PyEval_GetFrame()); // borrowed ref
+ AutoDecRef ob_lineno(PyObject_GetAttr(frame, Shiboken::PyName::f_lineno()));
+ if (ob_lineno.isNull() || !PyInt_Check(ob_lineno)) // int/long cheating
+ return -1;
+ return PyInt_AsSsize_t(ob_lineno); // int/long cheating
+}
+
+static bool is_module_code()
+{
+ PyObject *frame = reinterpret_cast<PyObject *>(PyEval_GetFrame()); // borrowed ref
+ AutoDecRef ob_code(PyObject_GetAttr(frame, Shiboken::PyName::f_code()));
+ if (ob_code.isNull())
+ return false;
+ AutoDecRef ob_name(PyObject_GetAttr(ob_code, Shiboken::PyName::co_name()));
+ if (ob_name.isNull())
+ return false;
+ const char *codename = Shiboken::String::toCString(ob_name);
+ return strcmp(codename, "<module>") == 0;
+}
+
+} // extern "C"
+
+namespace PySide { namespace QEnum {
+
+static std::map<int, PyObject *> enumCollector;
+
+int isFlag(PyObject *obType)
+{
+ /*
+ * Find out if this is an Enum or a Flag derived class.
+ * It checks also if things come from the enum module and if it is
+ * an Enum or Flag class at all.
+ *
+ * The function is called in MetaObjectBuilderPrivate::parsePythonType
+ * again to obtain the flag value.
+ */
+ if (!PyType_Check(obType)) {
+ PyErr_Format(PyExc_TypeError, "a class argument was expected, not a '%.200s' instance",
+ Py_TYPE(obType)->tp_name);
+ return -1;
+ };
+ auto *type = reinterpret_cast<PyTypeObject *>(obType);
+ PyObject *mro = type->tp_mro;
+ Py_ssize_t i, n = PyTuple_GET_SIZE(mro);
+ bool right_module = false;
+ bool have_enum = false;
+ bool have_flag = false;
+ bool have_members = PyObject_HasAttr(obType, PyMagicName::members());
+ for (i = 0; i < n; i++) {
+ obType = PyTuple_GET_ITEM(mro, i);
+ type = reinterpret_cast<PyTypeObject *>(obType);
+ AutoDecRef mod(PyObject_GetAttr(obType, PyMagicName::module()));
+ QByteArray cmod = String::toCString(mod);
+ QByteArray cname = type->tp_name;
+ if (cmod == "enum") {
+ right_module = true;
+ if (cname == "Enum")
+ have_enum = true;
+ else if (cname == "Flag")
+ have_flag = true;
+ }
+ }
+ if (!right_module || !(have_enum || have_flag) || !have_members) {
+ PyErr_Format(PyExc_TypeError, "type %.200s does not inherit from 'Enum' or 'Flag'",
+ type->tp_name);
+ return -1;
+ }
+ return bool(have_flag);
+}
+
+PyObject *QEnumMacro(PyObject *pyenum, bool flag)
+{
+ /*
+ * This is the official interface of 'QEnum'. It first calls 'analyzePyEnum'.
+ * When called as toplevel enum, it simply returns after some checks.
+ * Otherwise, 'pyenum' is stored for later use by the meta class registation.
+ */
+ int computedFlag = isFlag(pyenum);
+ if (computedFlag < 0)
+ return nullptr;
+ if (bool(computedFlag) != flag) {
+ AutoDecRef name(PyObject_GetAttr(pyenum, PyMagicName::qualname()));
+ auto cname = String::toCString(name);
+ const char *e = "Enum";
+ const char *f = "Flag";
+ PyErr_Format(PyExc_TypeError, "expected '%s' but got '%s' (%.200s)",
+ flag ? f : e, flag ? e : f, cname);
+ return nullptr;
+ }
+ auto ok = analyzePyEnum(pyenum);
+ if (ok == nullptr)
+ return nullptr;
+ if (is_module_code()) {
+ // This is a toplevel enum which we resolve immediately.
+ Py_INCREF(pyenum);
+ return pyenum;
+ }
+
+ Py_ssize_t lineno = get_lineno();
+ if (lineno < 0)
+ return nullptr;
+ // Handle the rest via line number and the meta class.
+ Py_INCREF(pyenum);
+ Py_XDECREF(enumCollector[lineno]);
+ enumCollector[lineno] = pyenum;
+ Py_RETURN_NONE;
+}
+
+std::vector<PyObject *> resolveDelayedQEnums(PyTypeObject *containerType)
+{
+ /*
+ * This is the internal interface of 'QEnum'.
+ * It is called at the end of the meta class call 'SbkObjectTypeTpNew' via
+ * MetaObjectBuilderPrivate::parsePythonType and resolves the collected
+ * Python Enum arguments. The result is then registered.
+ */
+ if (enumCollector.empty())
+ return {};
+ PyObject *obContainerType = reinterpret_cast<PyObject *>(containerType);
+ Py_ssize_t lineno = get_lineno();
+
+ std::vector<PyObject *> result;
+
+ auto it = enumCollector.begin();
+ while (it != enumCollector.end()) {
+ int nr = it->first;
+ PyObject *pyenum = it->second;
+ if (nr >= lineno) {
+ AutoDecRef name(PyObject_GetAttr(pyenum, PyMagicName::name()));
+ if (name.isNull() || PyObject_SetAttr(obContainerType, name, pyenum) < 0)
+ return {};
+ result.push_back(pyenum);
+ it = enumCollector.erase(it);
+ } else {
+ ++it;
+ }
+ }
+ return result;
+}
+
+} // namespace Enum
+} // namespace Shiboken
+
+//
+///////////////////////////////////////////////////////////////
diff --git a/sources/pyside2/libpyside/pysideqenum.h b/sources/pyside2/libpyside/pysideqenum.h
new file mode 100644
index 00000000..fc4e5598
--- /dev/null
+++ b/sources/pyside2/libpyside/pysideqenum.h
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt for Python.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef PYSIDE_QENUM_H
+#define PYSIDE_QENUM_H
+
+#include <pysidemacros.h>
+#include <vector>
+
+namespace PySide { namespace QEnum {
+
+// PYSIDE-957: Support the QEnum macro
+PYSIDE_API PyObject *QEnumMacro(PyObject *, bool);
+PYSIDE_API int isFlag(PyObject *);
+PYSIDE_API std::vector<PyObject *> resolveDelayedQEnums(PyTypeObject *);
+PYSIDE_API void init();
+
+} // namespace QEnum
+} // namespace PySide
+
+#endif
diff --git a/sources/pyside2/libpyside/pysideqflags.cpp b/sources/pyside2/libpyside/pysideqflags.cpp
index d7e6b4f4..b141ce15 100644
--- a/sources/pyside2/libpyside/pysideqflags.cpp
+++ b/sources/pyside2/libpyside/pysideqflags.cpp
@@ -175,18 +175,18 @@ namespace QFlags
// PYSIDE-747: Here we insert now the full class name.
strcpy(qualname, name);
// Careful: SbkType_FromSpec does not allocate the string.
- PyType_Spec *newspec = new PyType_Spec;
- newspec->name = strdup(qualname);
- newspec->basicsize = SbkNewQFlagsType_spec.basicsize;
- newspec->itemsize = SbkNewQFlagsType_spec.itemsize;
- newspec->flags = SbkNewQFlagsType_spec.flags;
+ PyType_Spec newspec;
+ newspec.name = strdup(qualname);
+ newspec.basicsize = SbkNewQFlagsType_spec.basicsize;
+ newspec.itemsize = SbkNewQFlagsType_spec.itemsize;
+ newspec.flags = SbkNewQFlagsType_spec.flags;
int idx = -1;
while (numberMethods[++idx].slot) {
assert(SbkNewQFlagsType_slots[idx].slot == numberMethods[idx].slot);
SbkNewQFlagsType_slots[idx].pfunc = numberMethods[idx].pfunc;
}
- newspec->slots = SbkNewQFlagsType_spec.slots;
- PyTypeObject *type = (PyTypeObject *)SbkType_FromSpec(newspec);
+ newspec.slots = SbkNewQFlagsType_spec.slots;
+ PyTypeObject *type = (PyTypeObject *)SbkType_FromSpec(&newspec);
Py_TYPE(type) = &PyType_Type;
PySideQFlagsType *flagsType = reinterpret_cast<PySideQFlagsType *>(type);
diff --git a/sources/pyside2/libpyside/pysidesignal.cpp b/sources/pyside2/libpyside/pysidesignal.cpp
index 39ed1a6b..f11f5a12 100644
--- a/sources/pyside2/libpyside/pysidesignal.cpp
+++ b/sources/pyside2/libpyside/pysidesignal.cpp
@@ -54,7 +54,6 @@
#include <utility>
#define QT_SIGNAL_SENTINEL '2'
-#define PyEnumMeta_Check(x) (strcmp(Py_TYPE(arg)->tp_name, "EnumMeta") == 0)
namespace PySide {
namespace Signal {
@@ -900,20 +899,22 @@ const char *getSignature(PySideSignalInstance *signal)
QStringList getArgsFromSignature(const char *signature, bool *isShortCircuit)
{
- const QString qsignature = QLatin1String(signature);
+ QString qsignature = QString::fromLatin1(signature).trimmed();
QStringList result;
- QRegExp splitRegex(QLatin1String("\\s*,\\s*"));
if (isShortCircuit)
*isShortCircuit = !qsignature.contains(QLatin1Char('('));
if (qsignature.contains(QLatin1String("()")) || qsignature.contains(QLatin1String("(void)")))
return result;
- if (qsignature.contains(QLatin1Char('('))) {
- static QRegExp regex(QLatin1String(".+\\((.*)\\)"));
- //get args types
- QString types = qsignature;
- types.replace(regex, QLatin1String("\\1"));
- result = types.split(splitRegex);
+ if (qsignature.endsWith(QLatin1Char(')'))) {
+ const int paren = qsignature.indexOf(QLatin1Char('('));
+ if (paren >= 0) {
+ qsignature.chop(1);
+ qsignature.remove(0, paren + 1);
+ result = qsignature.split(QLatin1Char(','));
+ for (QString &type : result)
+ type = type.trimmed();
+ }
}
return result;
}
diff --git a/sources/pyside2/libpyside/signalmanager.cpp b/sources/pyside2/libpyside/signalmanager.cpp
index 8e8cc9f0..93847e06 100644
--- a/sources/pyside2/libpyside/signalmanager.cpp
+++ b/sources/pyside2/libpyside/signalmanager.cpp
@@ -411,11 +411,13 @@ int SignalManager::qt_metacall(QObject *object, QMetaObject::Call call, int id,
case QMetaObject::ReadProperty:
case QMetaObject::WriteProperty:
case QMetaObject::ResetProperty:
+# if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
case QMetaObject::QueryPropertyDesignable:
case QMetaObject::QueryPropertyScriptable:
case QMetaObject::QueryPropertyStored:
case QMetaObject::QueryPropertyEditable:
case QMetaObject::QueryPropertyUser:
+# endif // < Qt 6
pp->d->metaCallHandler(pp, pySelf, call, args);
break;
#endif
diff --git a/sources/pyside2/plugins/CMakeLists.txt b/sources/pyside2/plugins/CMakeLists.txt
index c9e65280..9be98519 100644
--- a/sources/pyside2/plugins/CMakeLists.txt
+++ b/sources/pyside2/plugins/CMakeLists.txt
@@ -1,21 +1,20 @@
project(plugins)
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(CMAKE_AUTOMOC ON)
+
+find_package(Qt6 COMPONENTS Core)
+find_package(Qt6 COMPONENTS Gui)
+find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 COMPONENTS UiPlugin)
+
set(ui_plugin_src
customwidgets.cpp
customwidget.cpp
)
-set(ui_plugin_moc
- customwidget.h
- customwidgets.h
-)
-include_directories(${Qt${QT_MAJOR_VERSION}Designer_INCLUDE_DIRS})
-
-if (${QT_MAJOR_VERSION} GREATER_EQUAL 6)
- qt6_wrap_cpp(MOC_FILES ${ui_plugin_moc})
-else()
- qt5_wrap_cpp(MOC_FILES ${ui_plugin_moc})
-endif()
+qt_wrap_cpp(MOC_FILES ${ui_plugin_moc})
add_library(uiplugin STATIC ${ui_plugin_src} ${MOC_FILES})
if(CMAKE_HOST_UNIX AND NOT CYGWIN)
@@ -30,7 +29,10 @@ else()
endif()
target_link_libraries(uiplugin
- ${Qt${QT_MAJOR_VERSION}UiTools_LIBRARY}
+ Qt::Core
+ Qt::Gui
+ Qt::UiPlugin
+ Qt::Widgets
Shiboken2::libshiboken)
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
set(LIBRARY_OUTPUT_SUFFIX ${CMAKE_DEBUG_POSTFIX})
diff --git a/sources/pyside2/plugins/customwidget.cpp b/sources/pyside2/plugins/customwidget.cpp
index 6a6d7a3b..3c54b02e 100644
--- a/sources/pyside2/plugins/customwidget.cpp
+++ b/sources/pyside2/plugins/customwidget.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt for Python.
@@ -37,26 +37,15 @@
**
****************************************************************************/
-
#include "customwidget.h"
+#include <QtCore/qdebug.h>
-
-struct PyCustomWidgetPrivate
-{
- PyObject *pyObject;
- bool initialized;
-};
-
-PyCustomWidget::PyCustomWidget(PyObject *objectType)
- : m_data(new PyCustomWidgetPrivate())
+// Part of the static plugin linked to the QtUiLoader Python module,
+// allowing it to create a custom widget written in Python.
+PyCustomWidget::PyCustomWidget(PyObject *objectType) :
+ m_pyObject(objectType),
+ m_name(QString::fromUtf8(reinterpret_cast<PyTypeObject *>(objectType)->tp_name))
{
- m_data->pyObject = objectType;
- m_name = QString(reinterpret_cast<PyTypeObject *>(objectType)->tp_name);
-}
-
-PyCustomWidget::~PyCustomWidget()
-{
- delete m_data;
}
bool PyCustomWidget::isContainer() const
@@ -66,7 +55,7 @@ bool PyCustomWidget::isContainer() const
bool PyCustomWidget::isInitialized() const
{
- return m_data->initialized;
+ return m_initialized;
}
QIcon PyCustomWidget::icon() const
@@ -106,9 +95,9 @@ QString PyCustomWidget::whatsThis() const
QWidget *PyCustomWidget::createWidget(QWidget *parent)
{
- //Create a python instance and return cpp object
- PyObject *pyParent;
- bool unkowParent = false;
+ // Create a python instance and return cpp object
+ PyObject *pyParent = nullptr;
+ bool unknownParent = false;
if (parent) {
pyParent = reinterpret_cast<PyObject *>(Shiboken::BindingManager::instance().retrieveWrapper(parent));
if (pyParent) {
@@ -116,7 +105,7 @@ QWidget *PyCustomWidget::createWidget(QWidget *parent)
} else {
static Shiboken::Conversions::SpecificConverter converter("QWidget*");
pyParent = converter.toPython(&parent);
- unkowParent = true;
+ unknownParent = true;
}
} else {
Py_INCREF(Py_None);
@@ -124,25 +113,26 @@ QWidget *PyCustomWidget::createWidget(QWidget *parent)
}
Shiboken::AutoDecRef pyArgs(PyTuple_New(1));
- PyTuple_SET_ITEM(pyArgs, 0, pyParent); //tuple will keep pyParent reference
-
- //Call python constructor
- auto result = reinterpret_cast<SbkObject *>(PyObject_CallObject(m_data->pyObject, pyArgs));
-
- QWidget *widget = nullptr;
- if (result) {
- if (unkowParent) //if parent does not exists in python, transfer the ownership to cpp
- Shiboken::Object::releaseOwnership(result);
- else
- Shiboken::Object::setParent(pyParent, reinterpret_cast<PyObject *>(result));
-
- widget = reinterpret_cast<QWidget *>(Shiboken::Object::cppPointer(result, Py_TYPE(result)));
+ PyTuple_SET_ITEM(pyArgs, 0, pyParent); // tuple will keep pyParent reference
+
+ // Call python constructor
+ auto result = reinterpret_cast<SbkObject *>(PyObject_CallObject(m_pyObject, pyArgs));
+ if (!result) {
+ qWarning("Unable to create a Python custom widget of type \"%s\".",
+ qPrintable(m_name));
+ PyErr_Print();
+ return nullptr;
}
- return widget;
+ if (unknownParent) // if parent does not exist in python, transfer the ownership to cpp
+ Shiboken::Object::releaseOwnership(result);
+ else
+ Shiboken::Object::setParent(pyParent, reinterpret_cast<PyObject *>(result));
+
+ return reinterpret_cast<QWidget *>(Shiboken::Object::cppPointer(result, Py_TYPE(result)));
}
void PyCustomWidget::initialize(QDesignerFormEditorInterface *core)
{
- m_data->initialized = true;
+ m_initialized = true;
}
diff --git a/sources/pyside2/plugins/customwidget.h b/sources/pyside2/plugins/customwidget.h
index fc7d0894..b84a967b 100644
--- a/sources/pyside2/plugins/customwidget.h
+++ b/sources/pyside2/plugins/customwidget.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt for Python.
@@ -42,15 +42,9 @@
#include <shiboken.h>
-#include <QtCore/QtGlobal>
-#if (QT_VERSION < QT_VERSION_CHECK(5, 5, 0))
- #include <QtDesigner/QDesignerCustomWidgetInterface>
-#else
- #include <QtUiPlugin/QDesignerCustomWidgetInterface>
-#endif
+#include <QtUiPlugin/QDesignerCustomWidgetInterface>
-
-struct PyCustomWidgetPrivate;
+#include <QtCore/qglobal.h>
class PyCustomWidget: public QObject, public QDesignerCustomWidgetInterface
{
@@ -58,24 +52,24 @@ class PyCustomWidget: public QObject, public QDesignerCustomWidgetInterface
Q_INTERFACES(QDesignerCustomWidgetInterface)
public:
- PyCustomWidget(PyObject* objectType);
- ~PyCustomWidget();
+ explicit PyCustomWidget(PyObject *objectType);
- bool isContainer() const;
- bool isInitialized() const;
- QIcon icon() const;
- QString domXml() const;
- QString group() const;
- QString includeFile() const;
- QString name() const;
- QString toolTip() const;
- QString whatsThis() const;
- QWidget *createWidget(QWidget *parent);
- void initialize(QDesignerFormEditorInterface *core);
+ bool isContainer() const override;
+ bool isInitialized() const override;
+ QIcon icon() const override;
+ QString domXml() const override;
+ QString group() const override;
+ QString includeFile() const override;
+ QString name() const override;
+ QString toolTip() const override;
+ QString whatsThis() const override;
+ QWidget *createWidget(QWidget *parent) override;
+ void initialize(QDesignerFormEditorInterface *core) override;
private:
- PyCustomWidgetPrivate* m_data;
- QString m_name;
+ PyObject *m_pyObject = nullptr;
+ const QString m_name;
+ bool m_initialized = false;
};
-#endif
+#endif // _PY_CUSTOM_WIDGET_H_
diff --git a/sources/pyside2/plugins/customwidgets.cpp b/sources/pyside2/plugins/customwidgets.cpp
index e78dde20..28a2a6cf 100644
--- a/sources/pyside2/plugins/customwidgets.cpp
+++ b/sources/pyside2/plugins/customwidgets.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt for Python.
@@ -37,47 +37,25 @@
**
****************************************************************************/
-#include "customwidget.h"
#include "customwidgets.h"
-
-
-struct PyCustomWidgetPrivate
-{
- PyObject *pyObject;
- bool initialized;
-};
-
-struct PyCustomWidgetsPrivate
-{
- QList<QDesignerCustomWidgetInterface *> widgets;
- ~PyCustomWidgetsPrivate();
-};
-
-
-PyCustomWidgetsPrivate::~PyCustomWidgetsPrivate()
-{
- qDeleteAll(widgets);
- widgets.clear();
-}
+#include "customwidget.h"
PyCustomWidgets::PyCustomWidgets(QObject *parent)
- : QObject(parent), m_data(new PyCustomWidgetsPrivate)
+ : QObject(parent)
{
}
PyCustomWidgets::~PyCustomWidgets()
{
- delete m_data;
+ qDeleteAll(m_widgets);
}
void PyCustomWidgets::registerWidgetType(PyObject *widget)
{
- m_data->widgets.append(new PyCustomWidget(widget));
+ m_widgets.append(new PyCustomWidget(widget));
}
QList<QDesignerCustomWidgetInterface *> PyCustomWidgets::customWidgets() const
{
- return m_data->widgets;
+ return m_widgets;
}
-
-
diff --git a/sources/pyside2/plugins/customwidgets.h b/sources/pyside2/plugins/customwidgets.h
index 5c52d1d2..aec817cd 100644
--- a/sources/pyside2/plugins/customwidgets.h
+++ b/sources/pyside2/plugins/customwidgets.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt for Python.
@@ -42,16 +42,11 @@
#include <shiboken.h>
-#include <QtCore/QtGlobal>
-#if (QT_VERSION < QT_VERSION_CHECK(5, 5, 0))
- #include <QtDesigner/QDesignerCustomWidgetInterface>
-#else
- #include <QtUiPlugin/QDesignerCustomWidgetInterface>
-#endif
-
+#include <QtUiPlugin/QDesignerCustomWidgetInterface>
-struct PyCustomWidgetsPrivate;
+#include <QtCore/qlist.h>
+// A static plugin linked to the QtUiLoader Python module
class PyCustomWidgets: public QObject, public QDesignerCustomWidgetCollectionInterface
{
Q_OBJECT
@@ -59,13 +54,16 @@ class PyCustomWidgets: public QObject, public QDesignerCustomWidgetCollectionInt
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.PySide.PyCustomWidgetsInterface")
public:
- PyCustomWidgets(QObject *parent = 0);
+ explicit PyCustomWidgets(QObject *parent = nullptr);
~PyCustomWidgets();
- virtual QList<QDesignerCustomWidgetInterface*> customWidgets() const;
+
+ QList<QDesignerCustomWidgetInterface*> customWidgets() const override;
+
+ // Called from added function QUiLoader::registerCustomWidget()
void registerWidgetType(PyObject* widget);
private:
- PyCustomWidgetsPrivate* m_data;
+ QList<QDesignerCustomWidgetInterface *> m_widgets;
};
#endif
diff --git a/sources/pyside2/tests/QtCore/CMakeLists.txt b/sources/pyside2/tests/QtCore/CMakeLists.txt
index a151e6d1..3af239c8 100644
--- a/sources/pyside2/tests/QtCore/CMakeLists.txt
+++ b/sources/pyside2/tests/QtCore/CMakeLists.txt
@@ -26,6 +26,7 @@ PYSIDE_TEST(bug_1019.py)
PYSIDE_TEST(bug_1031.py)
PYSIDE_TEST(bug_1063.py)
PYSIDE_TEST(bug_1069.py)
+PYSIDE_TEST(bug_1313.py)
PYSIDE_TEST(bug_PYSIDE-42.py)
PYSIDE_TEST(bug_PYSIDE-164.py)
PYSIDE_TEST(blocking_signals_test.py)
@@ -41,6 +42,7 @@ PYSIDE_TEST(inherits_test.py)
PYSIDE_TEST(max_signals.py)
PYSIDE_TEST(missing_symbols_test.py)
PYSIDE_TEST(mockclass_test.py)
+PYSIDE_TEST(multiple_feature_test.py)
PYSIDE_TEST(python_conversion.py)
PYSIDE_TEST(qabs_test.py)
PYSIDE_TEST(qabstractitemmodel_test.py)
@@ -97,7 +99,6 @@ PYSIDE_TEST(qpoint_test.py)
PYSIDE_TEST(qprocess_test.py)
PYSIDE_TEST(qproperty_decorator.py)
PYSIDE_TEST(qrect_test.py)
-PYSIDE_TEST(qregexp_test.py)
PYSIDE_TEST(qregularexpression_test.py)
PYSIDE_TEST(qresource_test.py)
PYSIDE_TEST(qsettings_test.py)
@@ -111,7 +112,6 @@ PYSIDE_TEST(qstate_test.py)
PYSIDE_TEST(qstorageinfo_test.py)
PYSIDE_TEST(qstring_test.py)
PYSIDE_TEST(qsysinfo_test.py)
-PYSIDE_TEST(qtext_codec_test.py)
PYSIDE_TEST(qtextstream_test.py)
PYSIDE_TEST(qthread_prod_cons_test.py)
PYSIDE_TEST(qthread_signal_test.py)
@@ -126,6 +126,7 @@ PYSIDE_TEST(quuid_test.py)
PYSIDE_TEST(qversionnumber_test.py)
PYSIDE_TEST(repr_test.py)
PYSIDE_TEST(setprop_on_ctor_test.py)
+PYSIDE_TEST(snake_case_feature_test.py)
PYSIDE_TEST(staticMetaObject_test.py)
PYSIDE_TEST(static_method_test.py)
PYSIDE_TEST(thread_signals_test.py)
diff --git a/sources/pyside2/tests/QtOpenGL/qglwidget_test.py b/sources/pyside2/tests/QtCore/bug_1313.py
index c3bb7e27..a24c53b9 100644
--- a/sources/pyside2/tests/QtOpenGL/qglwidget_test.py
+++ b/sources/pyside2/tests/QtCore/bug_1313.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2020 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -26,6 +26,8 @@
##
#############################################################################
+''' unit test for BUG #1313 '''
+
import os
import sys
import unittest
@@ -34,20 +36,49 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from init_paths import init_test_paths
init_test_paths(False)
-from PySide2.QtGui import *
-from PySide2.QtWidgets import *
-from PySide2.QtOpenGL import *
+from PySide2 import QtCore
+import py3kcompat as py3k
+
+
+class MyQObject(QtCore.QObject):
+ sig = QtCore.Signal()
+
+
+demo_coroutine_definition_code = """
+async def demo_coroutine():
+ my_qobject = MyQObject()
+ my_qobject.sig.connect(lambda: None)
+"""
+
+
+if py3k.IS_PY3K:
+ exec(demo_coroutine_definition_code)
+
+
+@unittest.skipIf(not py3k.IS_PY3K, "Requires Python 3 due to use of async def")
+class CoroutineRaisesStopIterationTestCase(unittest.TestCase):
+ def setUp(self):
+ self.coroutine = demo_coroutine()
+
+ def testCoroutine(self):
+ with self.assertRaises(StopIteration):
+ self.coroutine.send(None)
+
-class TestQGLWidget (unittest.TestCase):
- def testIt(self):
- """Just test if the bindTexture(*, GLenum, GLint) methods overloads exists"""
- app = QApplication([])
- img = QImage()
- w = QGLWidget()
- a = w.bindTexture(img, 0, 0) # ok if it throws nothing.. :-)
+def demo_generator():
+ my_qobject = MyQObject()
+ my_qobject.sig.connect(lambda: None)
+ return
+ yield # to make it a generator
+class GeneratorRaisesStopIterationTestCase(unittest.TestCase):
+ def setUp(self):
+ self.generator = demo_generator()
+ def testGenerator(self):
+ with self.assertRaises(StopIteration):
+ self.generator.send(None)
if __name__ == "__main__":
diff --git a/sources/pyside2/tests/QtCore/multiple_feature_test.py b/sources/pyside2/tests/QtCore/multiple_feature_test.py
new file mode 100644
index 00000000..26488326
--- /dev/null
+++ b/sources/pyside2/tests/QtCore/multiple_feature_test.py
@@ -0,0 +1,127 @@
+#############################################################################
+##
+## Copyright (C) 2020 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of Qt for Python.
+##
+## $QT_BEGIN_LICENSE:LGPL$
+## Commercial License Usage
+## Licensees holding valid commercial Qt licenses may use this file in
+## accordance with the commercial license agreement provided with the
+## Software or, alternatively, in accordance with the terms contained in
+## a written agreement between you and The Qt Company. For licensing terms
+## and conditions see https://www.qt.io/terms-conditions. For further
+## information use the contact form at https://www.qt.io/contact-us.
+##
+## GNU Lesser General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU Lesser
+## General Public License version 3 as published by the Free Software
+## Foundation and appearing in the file LICENSE.LGPL3 included in the
+## packaging of this file. Please review the following information to
+## ensure the GNU Lesser General Public License version 3 requirements
+## will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+##
+## GNU General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU
+## General Public License version 2.0 or (at your option) the GNU General
+## Public license version 3 or any later version approved by the KDE Free
+## Qt Foundation. The licenses are as published by the Free Software
+## Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+## included in the packaging of this file. Please review the following
+## information to ensure the GNU General Public License requirements will
+## be met: https://www.gnu.org/licenses/gpl-2.0.html and
+## https://www.gnu.org/licenses/gpl-3.0.html.
+##
+## $QT_END_LICENSE$
+##
+#############################################################################
+
+from __future__ import print_function, absolute_import
+
+import os
+import sys
+import unittest
+
+sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from init_paths import init_test_paths
+init_test_paths(False)
+
+from PySide2 import QtCore
+from PySide2.support.__feature__ import _really_all_feature_names
+from textwrap import dedent
+
+"""
+multiple_feature_test.py
+------------------------
+
+This tests the selectable features in PySide.
+
+The first feature is `snake_case` instead of `camelCase`.
+There is much more to come.
+"""
+
+class FeaturesTest(unittest.TestCase):
+
+ def testAllFeatureCombinations(self):
+ """
+ Test for all 256 possible combinations of `__feature__` imports.
+ """
+ global __name__
+
+ def tst_bit0(flag, self):
+ if flag == 0:
+ QtCore.QCborArray.isEmpty
+ QtCore.QCborArray.__dict__["isEmpty"]
+ with self.assertRaises(AttributeError):
+ QtCore.QCborArray.is_empty
+ with self.assertRaises(KeyError):
+ QtCore.QCborArray.__dict__["is_empty"]
+ else:
+ QtCore.QCborArray.is_empty
+ QtCore.QCborArray.__dict__["is_empty"]
+ with self.assertRaises(AttributeError):
+ QtCore.QCborArray.isEmpty
+ with self.assertRaises(KeyError):
+ QtCore.QCborArray.__dict__["isEmpty"]
+
+ edict = {}
+ for bit in range(1, 8):
+ # We are cheating here, since the functions are in the globals.
+
+ eval(compile(dedent("""
+
+ def tst_bit{0}(flag, self):
+ if flag == 0:
+ with self.assertRaises(AttributeError):
+ QtCore.QCborArray.fake_feature_{1:02x}
+ with self.assertRaises(KeyError):
+ QtCore.QCborArray.__dict__["fake_feature_{1:02x}"]
+ else:
+ QtCore.QCborArray.fake_feature_{1:02x}
+ QtCore.QCborArray.__dict__["fake_feature_{1:02x}"]
+
+ """).format(bit, 1 << bit), "<string>", "exec"), globals(), edict)
+ globals().update(edict)
+ feature_list = _really_all_feature_names
+ func_list = [tst_bit0, tst_bit1, tst_bit2, tst_bit3,
+ tst_bit4, tst_bit5, tst_bit6, tst_bit7]
+
+ for idx in range(0x100):
+ __name__ = "feature_{:02x}".format(idx)
+ print()
+ print("--- Feature Test Module `{}` ---".format(__name__))
+ print("Imports:")
+ for bit in range(8):
+ if idx & 1 << bit:
+ feature = feature_list[bit]
+ text = "from __feature__ import {}".format(feature)
+ print(text)
+ eval(compile(text, "<string>", "exec"), globals(), edict)
+ for bit in range(8):
+ value = idx & 1 << bit
+ func_list[bit](value, self=self)
+
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/sources/pyside2/tests/QtCore/qbytearray_test.py b/sources/pyside2/tests/QtCore/qbytearray_test.py
index 8f1c9c20..c17b7efb 100644
--- a/sources/pyside2/tests/QtCore/qbytearray_test.py
+++ b/sources/pyside2/tests/QtCore/qbytearray_test.py
@@ -75,6 +75,14 @@ class QByteArrayTestToNumber(unittest.TestCase):
b.setNum(-0.5)
self.assertEqual(b, "-0.5")
+ def testNumber(self):
+ b = QByteArray.number(py3k.long(-124124))
+ self.assertEqual(b, "-124124")
+ b = QByteArray.number(-124124)
+ self.assertEqual(b, "-124124")
+ b = QByteArray.number(-0.5)
+ self.assertEqual(b, "-0.5")
+
def testAppend(self):
b = QByteArray()
b.append(py3k.b("A"))
diff --git a/sources/pyside2/tests/QtCore/qenum_test.py b/sources/pyside2/tests/QtCore/qenum_test.py
index 1edb8981..f99a893d 100644
--- a/sources/pyside2/tests/QtCore/qenum_test.py
+++ b/sources/pyside2/tests/QtCore/qenum_test.py
@@ -2,7 +2,7 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2020 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -40,7 +40,7 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from init_paths import init_test_paths
init_test_paths(False)
-from PySide2.QtCore import Qt, QIODevice
+from PySide2.QtCore import Qt, QIODevice, QObject, QEnum, QFlag
class TestEnum(unittest.TestCase):
@@ -68,28 +68,30 @@ class TestEnum(unittest.TestCase):
# Floats
with self.assertRaises(TypeError):
- a = k+2.0
+ a = k + 2.0
with self.assertRaises(TypeError):
- a = k-2.0
+ a = k - 2.0
with self.assertRaises(TypeError):
- a = k*2.0
+ a = k * 2.0
- @unittest.skipUnless(getattr(sys, "getobjects", None), "requires debug build")
+ @unittest.skipUnless(getattr(sys, "getobjects", None), "requires --with-trace-refs")
+ @unittest.skipUnless(getattr(sys, "gettotalrefcount", None), "requires --with-pydebug")
def testEnumNew_NoLeak(self):
gc.collect()
total = sys.gettotalrefcount()
for idx in range(1000):
ret = Qt.Key(42)
+
gc.collect()
delta = sys.gettotalrefcount() - total
print("delta total refcount =", delta)
if abs(delta) >= 10:
- all = sys.getobjects(0)
- all.sort(key=lambda x: sys.getrefcount(x), reverse=True)
+ all = [(sys.getrefcount(x), x) for x in sys.getobjects(0)]
+ all.sort(key=lambda x: x[0], reverse=True)
for ob in all[:10]:
- print(sys.getrefcount(ob), ob)
+ print(ob)
self.assertTrue(abs(delta) < 10)
@@ -141,6 +143,105 @@ class TestEnumPickling(unittest.TestCase):
else:
func()
+# PYSIDE-957: The QEnum macro
+
+try:
+ import enum
+ HAVE_ENUM = True
+except ImportError:
+ HAVE_ENUM = False
+ QEnum = QFlag = lambda x: x
+ import types
+ class Enum: pass
+ enum = types.ModuleType("enum")
+ enum.Enum = enum.Flag = enum.IntEnum = enum.IntFlag = Enum
+ Enum.__module__ = "enum"
+ Enum.__members__ = {}
+ del Enum
+ enum.auto = lambda: 42
+
+HAVE_FLAG = hasattr(enum, "Flag")
+
+@QEnum
+class OuterEnum(enum.Enum):
+ A = 1
+ B = 2
+
+class SomeClass(QObject):
+
+ @QEnum
+ class SomeEnum(enum.Enum):
+ A = 1
+ B = 2
+ C = 3
+
+ @QEnum
+ class OtherEnum(enum.IntEnum):
+ A = 1
+ B = 2
+ C = 3
+
+ class InnerClass(QObject):
+
+ @QEnum
+ class InnerEnum(enum.Enum):
+ X = 42
+
+ class SomeEnum(enum.Enum):
+ A = 4
+ B = 5
+ C = 6
+
+ QEnum(SomeEnum) # works even without the decorator assignment
+
+
+@unittest.skipUnless(HAVE_ENUM, "requires 'enum' module (use 'pip install enum34' for Python 2)")
+class TestQEnumMacro(unittest.TestCase):
+ def testTopLevel(self):
+ self.assertEqual(type(OuterEnum).__module__, "enum")
+ self.assertEqual(type(OuterEnum).__name__, "EnumMeta")
+ self.assertEqual(len(OuterEnum.__members__), 2)
+
+ def testSomeClass(self):
+ self.assertEqual(type(SomeClass.SomeEnum).__module__, "enum")
+ self.assertEqual(type(SomeClass.SomeEnum).__name__, "EnumMeta")
+ self.assertEqual(len(SomeClass.SomeEnum.__members__), 3)
+ with self.assertRaises(TypeError):
+ int(SomeClass.SomeEnum.C) == 6
+ self.assertEqual(SomeClass.OtherEnum.C, 3)
+
+ @unittest.skipIf(sys.version_info[0] < 3, "we cannot support nested classes in Python 2")
+ def testInnerClass(self):
+ self.assertEqual(SomeClass.InnerClass.InnerEnum.__qualname__,
+ "SomeClass.InnerClass.InnerEnum")
+ with self.assertRaises(TypeError):
+ int(SomeClass.InnerClass.InnerEnum.X) == 42
+
+ @unittest.skipUnless(HAVE_FLAG, "some older Python versions have no 'Flag'")
+ def testEnumFlag(self):
+ with self.assertRaises(TypeError):
+ class WrongFlagForEnum(QObject):
+ @QEnum
+ class Bad(enum.Flag):
+ pass
+ with self.assertRaises(TypeError):
+ class WrongEnuForFlag(QObject):
+ @QFlag
+ class Bad(enum.Enum):
+ pass
+
+ def testIsRegistered(self):
+ mo = SomeClass.staticMetaObject
+ self.assertEqual(mo.enumeratorCount(), 2)
+ self.assertEqual(mo.enumerator(0).name(), "OtherEnum")
+ self.assertEqual(mo.enumerator(0).scope(), "SomeClass")
+ self.assertEqual(mo.enumerator(1).name(), "SomeEnum")
+ moi = SomeClass.InnerClass.staticMetaObject
+ self.assertEqual(moi.enumerator(0).name(), "InnerEnum")
+ ## Question: Should that scope not better be "SomeClass.InnerClass"?
+ ## But we have __qualname__ already:
+ self.assertEqual(moi.enumerator(0).scope(), "InnerClass")
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside2/tests/QtCore/qobject_parent_test.py b/sources/pyside2/tests/QtCore/qobject_parent_test.py
index 7e98100a..386209e8 100644
--- a/sources/pyside2/tests/QtCore/qobject_parent_test.py
+++ b/sources/pyside2/tests/QtCore/qobject_parent_test.py
@@ -144,11 +144,10 @@ class ParentCase(unittest.TestCase):
res = parent.findChildren(QTimer)
self.assertEqual(len(res), 20)
- # test findChildre with a regex
- res = parent.findChildren(QObject, QRegExp("^fo+"))
+ # test findChildren with a QRegularExpression
+ res = parent.findChildren(QObject, QRegularExpression("^fo+"))
self.assertEqual(res, test_children)
-
def testParentEquality(self):
#QObject.parent() == parent
parent = QObject()
diff --git a/sources/pyside2/tests/QtCore/qregexp_test.py b/sources/pyside2/tests/QtCore/qregexp_test.py
deleted file mode 100644
index a031137f..00000000
--- a/sources/pyside2/tests/QtCore/qregexp_test.py
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/usr/bin/python
-
-#############################################################################
-##
-## Copyright (C) 2016 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 os
-import sys
-import unittest
-
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from init_paths import init_test_paths
-init_test_paths(False)
-
-from PySide2.QtCore import QRegExp
-
-class QRegExpTest(unittest.TestCase):
-
- def testReplace1(self):
- re = QRegExp('a[mn]')
- string = re.replace('Banana', 'ox')
- self.assertEqual(string, 'Boxoxa')
-
- def testReplace2(self):
- re = QRegExp('<i>([^<]*)</i>')
- string = re.replace('A <i>bon mot</i>.', '\\emph{\\1}')
- self.assertEqual(string, 'A \\emph{bon mot}.')
-
-if __name__ == '__main__':
- unittest.main()
-
diff --git a/sources/pyside2/tests/QtCore/qtext_codec_test.py b/sources/pyside2/tests/QtCore/qtext_codec_test.py
deleted file mode 100644
index 9e41c38c..00000000
--- a/sources/pyside2/tests/QtCore/qtext_codec_test.py
+++ /dev/null
@@ -1,54 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2016 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 gc
-import os
-import sys
-import unittest
-
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from init_paths import init_test_paths
-init_test_paths(False)
-
-from PySide2.QtCore import QTextCodec
-
-class TestCodecGetters(unittest.TestCase):
-
- def testCodecsNames(self):
- for codec_name in QTextCodec.availableCodecs():
- codec = QTextCodec.codecForName(codec_name)
- self.assertTrue(type(codec), QTextCodec)
-
- def testCodecsMibs(self):
- for codec_num in QTextCodec.availableMibs():
- codec = QTextCodec.codecForMib(codec_num)
- self.assertTrue(type(codec), QTextCodec)
-
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside2/tests/QtCore/qtextstream_test.py b/sources/pyside2/tests/QtCore/qtextstream_test.py
index bd25367c..d4bbd847 100644
--- a/sources/pyside2/tests/QtCore/qtextstream_test.py
+++ b/sources/pyside2/tests/QtCore/qtextstream_test.py
@@ -38,7 +38,7 @@ init_test_paths(False)
import py3kcompat as py3k
-from PySide2.QtCore import QByteArray, QTextStream, QIODevice, QTextCodec, QFile
+from PySide2.QtCore import QByteArray, QTextStream, QIODevice, QFile
class QTextStreamShiftTest(unittest.TestCase):
@@ -61,14 +61,6 @@ class QTextStreamGetSet(unittest.TestCase):
def setUp(self):
self.obj = QTextStream()
-
- def testCodec(self):
- '''QTextStream set/get Codec'''
-
- codec = QTextCodec.codecForName('ISO8859-1')
- self.obj.setCodec(codec)
- self.assertEqual(codec, self.obj.codec())
-
def testDevice(self):
'''QTextStream get/set Device'''
device = QFile()
@@ -83,7 +75,6 @@ class QTextStreamInitialization(unittest.TestCase):
'''QTextStream construction'''
obj = QTextStream()
- self.assertEqual(obj.codec(), QTextCodec.codecForLocale())
self.assertEqual(obj.device(), None)
self.assertEqual(obj.string(), None)
diff --git a/sources/pyside2/tests/QtCore/qurlquery_test.py b/sources/pyside2/tests/QtCore/qurlquery_test.py
index ac7ab69b..6e538c91 100644
--- a/sources/pyside2/tests/QtCore/qurlquery_test.py
+++ b/sources/pyside2/tests/QtCore/qurlquery_test.py
@@ -45,8 +45,6 @@ class QUrlQueryTest(unittest.TestCase):
def testConstructing(self):
empty = QUrlQuery()
self.assertTrue(empty.isEmpty())
- self.assertEqual(empty.queryPairDelimiter(), QUrlQuery.defaultQueryPairDelimiter())
- self.assertEqual(empty.queryValueDelimiter(), QUrlQuery.defaultQueryValueDelimiter())
empty.clear();
self.assertTrue(empty.isEmpty())
diff --git a/sources/pyside2/tests/QtCore/snake_case_feature_test.py b/sources/pyside2/tests/QtCore/snake_case_feature_test.py
new file mode 100644
index 00000000..b7f23396
--- /dev/null
+++ b/sources/pyside2/tests/QtCore/snake_case_feature_test.py
@@ -0,0 +1,86 @@
+#############################################################################
+##
+## Copyright (C) 2020 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of Qt for Python.
+##
+## $QT_BEGIN_LICENSE:LGPL$
+## Commercial License Usage
+## Licensees holding valid commercial Qt licenses may use this file in
+## accordance with the commercial license agreement provided with the
+## Software or, alternatively, in accordance with the terms contained in
+## a written agreement between you and The Qt Company. For licensing terms
+## and conditions see https://www.qt.io/terms-conditions. For further
+## information use the contact form at https://www.qt.io/contact-us.
+##
+## GNU Lesser General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU Lesser
+## General Public License version 3 as published by the Free Software
+## Foundation and appearing in the file LICENSE.LGPL3 included in the
+## packaging of this file. Please review the following information to
+## ensure the GNU Lesser General Public License version 3 requirements
+## will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+##
+## GNU General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU
+## General Public License version 2.0 or (at your option) the GNU General
+## Public license version 3 or any later version approved by the KDE Free
+## Qt Foundation. The licenses are as published by the Free Software
+## Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+## included in the packaging of this file. Please review the following
+## information to ensure the GNU General Public License requirements will
+## be met: https://www.gnu.org/licenses/gpl-2.0.html and
+## https://www.gnu.org/licenses/gpl-3.0.html.
+##
+## $QT_END_LICENSE$
+##
+#############################################################################
+
+import os
+import sys
+import unittest
+
+sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from init_paths import init_test_paths
+init_test_paths(False)
+
+from PySide2 import QtWidgets
+
+"""
+snake_case_feature_test.py
+--------------------------
+
+Test the snake_case feature.
+
+This works now. More tests needed!
+"""
+
+class RenamingTest(unittest.TestCase):
+ def setUp(self):
+ qApp or QtWidgets.QApplication()
+
+ def tearDown(self):
+ qApp.shutdown()
+
+ def testRenamedFunctions(self):
+
+ class Window(QtWidgets.QWidget):
+ def __init__(self):
+ super(Window, self).__init__()
+
+ window = Window()
+ window.setWindowTitle('camelCase')
+
+ # and now the same with snake_case enabled
+ from __feature__ import snake_case
+
+ class Window(QtWidgets.QWidget):
+ def __init__(self):
+ super(Window, self).__init__()
+
+ window = Window()
+ window.set_window_title('snake_case')
+
+if __name__ == '__main__':
+ unittest.main()
diff --git a/sources/pyside2/tests/QtGui/CMakeLists.txt b/sources/pyside2/tests/QtGui/CMakeLists.txt
index 172703ab..179e88fd 100644
--- a/sources/pyside2/tests/QtGui/CMakeLists.txt
+++ b/sources/pyside2/tests/QtGui/CMakeLists.txt
@@ -26,8 +26,6 @@ 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)
-PYSIDE_TEST(qopenglbuffer_test.py)
PYSIDE_TEST(qpainter_test.py)
PYSIDE_TEST(qpdfwriter_test.py)
PYSIDE_TEST(qpixelformat_test.py)
@@ -37,7 +35,6 @@ PYSIDE_TEST(qpolygonf_test.py)
PYSIDE_TEST(qkeysequence_test.py)
PYSIDE_TEST(qradialgradient_test.py)
PYSIDE_TEST(qrasterwindow_test.py)
-PYSIDE_TEST(qopenglwindow_test.py)
PYSIDE_TEST(qregion_test.py)
PYSIDE_TEST(qstylehints_test.py)
PYSIDE_TEST(qtextdocument_functions.py)
diff --git a/sources/pyside2/tests/QtGui/deepcopy_test.py b/sources/pyside2/tests/QtGui/deepcopy_test.py
index d4dcdd64..0fa82150 100644
--- a/sources/pyside2/tests/QtGui/deepcopy_test.py
+++ b/sources/pyside2/tests/QtGui/deepcopy_test.py
@@ -36,7 +36,6 @@ from init_paths import init_test_paths
init_test_paths(False)
from PySide2.QtCore import QPoint
-from PySide2.QtGui import QMatrix
from PySide2.QtGui import QMatrix2x2, QMatrix2x3, QMatrix2x4
from PySide2.QtGui import QMatrix3x2, QMatrix3x3, QMatrix3x4
from PySide2.QtGui import QMatrix4x2, QMatrix4x3, QMatrix4x4
@@ -81,7 +80,7 @@ class QColorCMYKDeepCopy(DeepCopyColorHelperF, unittest.TestCase):
class QTransformDeepCopy(DeepCopyHelper, unittest.TestCase):
def setUp(self):
- self.original = QTransform(1, 2, 3, 4, 5, 6, 7, 8)
+ self.original = QTransform(1, 2, 3, 4, 5, 6, 7, 8, 9)
class QKeySequenceDeepCopy(DeepCopyHelper, unittest.TestCase):
def setUp(self):
@@ -107,10 +106,6 @@ class QPolygonDeepCopy(DeepCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QPolygon([QPoint(1, 2), QPoint(3, 4), QPoint(5, 6)])
-class QMatrixDeepCopy(DeepCopyHelper, unittest.TestCase):
- def setUp(self):
- self.original = QMatrix(1, 2, 3, 4, 5, 6)
-
# Avoid these tests until get gcc fixed
# Related bug: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43247
diff --git a/sources/pyside2/tests/QtGui/qfontmetrics_test.py b/sources/pyside2/tests/QtGui/qfontmetrics_test.py
index cbf0b069..4380eae8 100644
--- a/sources/pyside2/tests/QtGui/qfontmetrics_test.py
+++ b/sources/pyside2/tests/QtGui/qfontmetrics_test.py
@@ -226,7 +226,7 @@ class QCharTest(QFontMetricsFTest):
self.assertEqual(type(retCh), QRectF)
def testWith(self):
- retCh = self.metrics.widthChar('a')
+ retCh = self.metrics.horizontalAdvance('a')
self.assertTrue(retCh > 0)
if __name__ == '__main__':
diff --git a/sources/pyside2/tests/QtGui/qmatrix_test.py b/sources/pyside2/tests/QtGui/qmatrix_test.py
deleted file mode 100644
index 48380faf..00000000
--- a/sources/pyside2/tests/QtGui/qmatrix_test.py
+++ /dev/null
@@ -1,106 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2016 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 os
-import sys
-import unittest
-
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from init_paths import init_test_paths
-init_test_paths(False)
-
-from PySide2.QtCore import QPoint
-from PySide2.QtGui import QMatrix, QMatrix2x2, QMatrix4x4
-
-
-def qpointTimesQMatrix(point, matrix):
- '''As seen in "QPoint QMatrix::map(const QPoint &p) const" C++ implementation.'''
- return QPoint(matrix.m11() * point.x() + matrix.m21() * point.y() + matrix.dx(),
- matrix.m12() * point.x() + matrix.m22() * point.y() + matrix.dy())
-
-class QMatrixTest(unittest.TestCase):
-
- def testMatrix(self):
- matrix = QMatrix(11, 12, 21, 22, 100, 200)
- point = QPoint(3, 3)
- self.assertEqual(matrix.map(point), qpointTimesQMatrix(point, matrix))
-
- def testMatrixWithWrongType(self):
- matrix = QMatrix(11, 12, 21, 22, 100, 200)
- point = QPoint(3, 3)
- # This exception may move from a TypeError to a ValueError.
- self.assertRaises((TypeError, ValueError), matrix.__mul__, point)
-
- def testMatrix2x2(self):
- matrix = QMatrix2x2([1.0, 2.0, 3.0, 4.0])
-
- expectedTransposed = QMatrix2x2([1.0, 3.0, 2.0, 4.0])
- self.assertEqual(matrix.transposed(), expectedTransposed)
-
- expectedMultiplied = QMatrix2x2([2.0, 4.0, 6.0, 8.0])
- matrix *= 2.0
- self.assertEqual(matrix, expectedMultiplied)
-
- matrix.setToIdentity()
- self.assertTrue(matrix.isIdentity())
-
- def testMatrix4x4(self):
- self.assertRaises(TypeError, QMatrix4x4, [0.0, 1.0, 2.0, 3.0])
- self.assertRaises(TypeError, QMatrix4x4, [0.0, 1.0, 2.0, 'I',
- 4.0, 5.0, 6.0, 7.0,
- 8.0, 9.0, 'N', 11.0,
- 12.0, 'd', 14.0, 'T'])
-
- my_data = [0.0, 1.0, 2.0, 3.0,
- 4.0, 5.0, 6.0, 7.0,
- 8.0, 9.0, 10.0, 11.0,
- 12.0, 13.0, 14.0, 15.0]
- my_datac = [0.0, 4.0, 8.0, 12.0,
- 1.0, 5.0, 9.0, 13.0,
- 2.0, 6.0, 10.0, 14.0,
- 3.0, 7.0, 11.0, 15.0]
-
- m = QMatrix4x4(my_data)
- d = m.data()
- self.assertTrue(my_datac, d)
-
- d = m.copyDataTo()
- self.assertTrue(my_data == list(d))
-
- def testMatrixMapping(self):
- m = QMatrix(1.0, 2.0, 1.0, 3.0, 100.0, 200.0)
- res = m.map(5, 5)
- self.assertAlmostEqual(res[0], 5 * 1.0 + 5 * 1.0 + 100.0)
- self.assertAlmostEqual(res[1], 5 * 2.0 + 5 * 3.0 + 200.0)
- res = m.map(5.0, 5.0)
- self.assertAlmostEqual(res[0], 5.0 * 1.0 + 5.0 * 1.0 + 100.0)
- self.assertAlmostEqual(res[1], 5.0 * 2.0 + 5.0 * 3.0 + 200.0)
-
-if __name__ == '__main__':
- unittest.main()
-
diff --git a/sources/pyside2/tests/QtGui/qtextdocument_functions.py b/sources/pyside2/tests/QtGui/qtextdocument_functions.py
index 765a6b5b..bd146204 100644
--- a/sources/pyside2/tests/QtGui/qtextdocument_functions.py
+++ b/sources/pyside2/tests/QtGui/qtextdocument_functions.py
@@ -35,7 +35,6 @@ from init_paths import init_test_paths
init_test_paths(False)
from PySide2.QtGui import Qt
-from PySide2.QtCore import QTextCodec
class QTextDocumentFunctions(unittest.TestCase):
@@ -45,8 +44,6 @@ class QTextDocumentFunctions(unittest.TestCase):
self.assertTrue(Qt.mightBeRichText('<html><head/><body><p>bla</p></body></html>'))
html = Qt.convertFromPlainText("A & B", Qt.WhiteSpaceNormal)
self.assertEqual(html, '<p>A &amp; B</p>')
- codec = Qt.codecForHtml(b'bla')
- self.assertTrue(codec)
if __name__ == '__main__':
diff --git a/sources/pyside2/tests/QtGui/repr_test.py b/sources/pyside2/tests/QtGui/repr_test.py
index e06f4d48..770c9d5b 100644
--- a/sources/pyside2/tests/QtGui/repr_test.py
+++ b/sources/pyside2/tests/QtGui/repr_test.py
@@ -36,7 +36,6 @@ init_test_paths(False)
import PySide2
from PySide2.QtCore import QPoint
-from PySide2.QtGui import QMatrix
from PySide2.QtGui import QMatrix2x2, QMatrix2x3, QMatrix2x4
from PySide2.QtGui import QMatrix3x2, QMatrix3x3, QMatrix3x4
from PySide2.QtGui import QMatrix4x2, QMatrix4x3, QMatrix4x4
@@ -52,7 +51,7 @@ class ReprCopyHelper:
class QTransformReprCopy(ReprCopyHelper, unittest.TestCase):
def setUp(self):
- self.original = QTransform(1, 2, 3, 4, 5, 6, 7, 8)
+ self.original = QTransform(1, 2, 3, 4, 5, 6, 7, 8, 9)
class QKeySequenceReprCopy(ReprCopyHelper, unittest.TestCase):
def setUp(self):
@@ -74,10 +73,6 @@ class QVector4DReprCopy(ReprCopyHelper, unittest.TestCase):
def setUp(self):
self.original = QVector4D(1, 2, 3, 4)
-class QMatrixReprCopy(ReprCopyHelper, unittest.TestCase):
- def setUp(self):
- self.original = QMatrix(1, 2, 3, 4, 5, 6)
-
# Avoid these tests until get gcc fixed
# Related bug: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43247
diff --git a/sources/pyside2/tests/QtNetwork/bug_446.py b/sources/pyside2/tests/QtNetwork/bug_446.py
index f15ff01f..e94bef51 100644
--- a/sources/pyside2/tests/QtNetwork/bug_446.py
+++ b/sources/pyside2/tests/QtNetwork/bug_446.py
@@ -49,7 +49,7 @@ class HttpSignalsCase(UsesQCoreApplication):
def onNewConnection(self):
self.serverConnection = self.server.nextPendingConnection()
- self.serverConnection.error.connect(self.onError)
+ self.serverConnection.errorOccurred.connect(self.onError)
self.serverConnection.write(HttpSignalsCase.DATA)
self.server.close()
diff --git a/sources/pyside2/tests/QtOpenGL/CMakeLists.txt b/sources/pyside2/tests/QtOpenGL/CMakeLists.txt
index b37a9ddc..92b4afba 100644
--- a/sources/pyside2/tests/QtOpenGL/CMakeLists.txt
+++ b/sources/pyside2/tests/QtOpenGL/CMakeLists.txt
@@ -1,2 +1,2 @@
-PYSIDE_TEST(qglbuffer_test.py)
-PYSIDE_TEST(qglwidget_test.py)
+PYSIDE_TEST(qopenglbuffer_test.py)
+PYSIDE_TEST(qopenglwindow_test.py)
diff --git a/sources/pyside2/tests/QtOpenGL/qglbuffer_test.py b/sources/pyside2/tests/QtOpenGL/qglbuffer_test.py
deleted file mode 100644
index e633d6ee..00000000
--- a/sources/pyside2/tests/QtOpenGL/qglbuffer_test.py
+++ /dev/null
@@ -1,78 +0,0 @@
-#!/usr/bin/python
-
-#############################################################################
-##
-## Copyright (C) 2016 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 QGLBuffer'''
-
-import os
-import sys
-import unittest
-
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from init_paths import init_test_paths
-init_test_paths(False)
-
-from PySide2.QtCore import QByteArray
-from PySide2.QtOpenGL import QGLBuffer, QGLWidget
-import py3kcompat as py3k
-from helper.usesqapplication import UsesQApplication
-
-class QGLBufferTest(UsesQApplication):
- def testIt(self):
- w = QGLWidget()
- w.makeCurrent()
-
- b = QGLBuffer()
- b.setUsagePattern(QGLBuffer.DynamicDraw)
-
- self.assertTrue(b.create())
- self.assertTrue(b.bufferId() != 0)
- self.assertTrue(b.bind())
-
- data = QByteArray(py3k.b("12345"))
- b.allocate(data)
- self.assertEqual(b.size(), data.size())
-
- m = b.map(QGLBuffer.ReadOnly)
- if m:
- self.assertEqual(m, py3k.buffer(py3k.b(data.data())))
- b.unmap()
-
- m = b.map(QGLBuffer.ReadWrite)
- m[3] = py3k.b('A')[0]
- b.unmap()
- result, rdata = b.read(3, 1)
- self.assertTrue(result)
- self.assertEqual(py3k.b('A'), rdata.data())
- else:
- print(" memory mapping is not possible in this OpenGL implementation.")
- b.release()
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside2/tests/QtGui/qopenglbuffer_test.py b/sources/pyside2/tests/QtOpenGL/qopenglbuffer_test.py
index a5d8385c..a5d8385c 100644
--- a/sources/pyside2/tests/QtGui/qopenglbuffer_test.py
+++ b/sources/pyside2/tests/QtOpenGL/qopenglbuffer_test.py
diff --git a/sources/pyside2/tests/QtGui/qopenglwindow_test.py b/sources/pyside2/tests/QtOpenGL/qopenglwindow_test.py
index e39cfb19..22f7fd20 100644
--- a/sources/pyside2/tests/QtGui/qopenglwindow_test.py
+++ b/sources/pyside2/tests/QtOpenGL/qopenglwindow_test.py
@@ -40,7 +40,9 @@ from helper.usesqapplication import UsesQApplication
from PySide2.QtCore import QSize, QTimer, Qt
from PySide2.QtGui import (QColor, QGuiApplication, QImage, QOpenGLContext,
- QOpenGLTexture, QSurfaceFormat, QOpenGLWindow)
+ QSurfaceFormat)
+from PySide2.QtOpenGL import (QOpenGLTexture, QOpenGLWindow)
+
try:
from OpenGL import GL
diff --git a/sources/pyside2/tests/QtWebKitWidgets/CMakeLists.txt b/sources/pyside2/tests/QtOpenGLWidgets/CMakeLists.txt
index 2f7cb08b..2f7cb08b 100644
--- a/sources/pyside2/tests/QtWebKitWidgets/CMakeLists.txt
+++ b/sources/pyside2/tests/QtOpenGLWidgets/CMakeLists.txt
diff --git a/sources/pyside2/tests/QtPrintSupport/returnquadruplesofnumbers_test.py b/sources/pyside2/tests/QtPrintSupport/returnquadruplesofnumbers_test.py
index 573ca994..0a3a72fc 100644
--- a/sources/pyside2/tests/QtPrintSupport/returnquadruplesofnumbers_test.py
+++ b/sources/pyside2/tests/QtPrintSupport/returnquadruplesofnumbers_test.py
@@ -71,12 +71,6 @@ class ReturnsQuadruplesOfNumbers(UsesQApplication):
obj = GraphicsLayoutItem()
self.assertTrue(self.compareTuples(obj.getContentsMargins(), (0.0, 0.0, 0.0, 0.0)))
- def testQWidgetGetContentsMargins(self):
- obj = QWidget()
- values = (10, 20, 30, 40)
- obj.setContentsMargins(*values)
- self.assertTrue(self.compareTuples(obj.getContentsMargins(), values))
-
def testQLayoutGetContentsMargins(self):
obj = Layout()
values = (10, 20, 30, 40)
diff --git a/sources/pyside2/tests/QtWebKit/bug_694.py b/sources/pyside2/tests/QtQml/registersingletontype.py
index b18d658f..fe3f749f 100644
--- a/sources/pyside2/tests/QtWebKit/bug_694.py
+++ b/sources/pyside2/tests/QtQml/registersingletontype.py
@@ -1,6 +1,6 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2020 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -34,51 +34,53 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from init_paths import init_test_paths
init_test_paths(False)
-from PySide2.QtCore import *
-from PySide2.QtWidgets import *
-from PySide2.QtWebKit import *
+from helper.helper import adjust_filename
-class ErrorPage (QWebPage):
+from PySide2.QtCore import Property, Signal, QTimer, QUrl, QObject
+from PySide2.QtGui import QGuiApplication
+from PySide2.QtQml import qmlRegisterSingletonType
+from PySide2.QtQuick import QQuickView
- def __init__(self):
- QWebPage.__init__(self)
- self.rcv_extension = None
- self.rcv_url = None
- self.rcv_url_copy = None
- self.rcv_option_type = None
- self.rcv_output_type = None
+finalResult = 0
+class SingletonQObject(QObject):
+ def __init__(self, parent = None):
+ QObject.__init__(self, parent)
+ self._data = 100
- def supportsExtension(self, extension):
- return extension == QWebPage.ErrorPageExtension
+ def getData(self):
+ return self._data
- def extension(self, extension, option, output):
- self.rcv_extension = extension
- self.rcv_url = option.url
- self.rcv_url_copy = QUrl(option.url)
- self.rcv_option_type = type(option)
- self.rcv_output_type = type(output)
- return True
+ def setData(self, data):
+ global finalResult
+ finalResult = self._data = data
-class TestWebPageExtension(unittest.TestCase):
+ data = Property(int, getData, setData)
+
+def singletonQObjectCallback(engine):
+ obj = SingletonQObject()
+ obj.setData(50)
+ return obj
+
+def singletonQJSValueCallback(engine):
+ return engine.evaluate("new Object({data: 50})")
+
+class TestQmlSupport(unittest.TestCase):
def testIt(self):
- app = QApplication([])
- ep = ErrorPage()
- view = QWebView()
- view.setPage(ep)
- view.load("foo://bar") # Some malformmed url
- view.show()
+ app = QGuiApplication([])
- # If the timeout is 0 the webpage isn't even loaded on Qt4.6-i386, so we use 100 :-)
- QTimer.singleShot(100, app.quit)
- app.exec_()
+ qmlRegisterSingletonType(SingletonQObject, 'Singletons', 1, 0, 'SingletonQObjectNoCallback')
+ qmlRegisterSingletonType(SingletonQObject, 'Singletons', 1, 0, 'SingletonQObjectCallback',
+ singletonQObjectCallback)
- self.assertEqual(ep.rcv_extension, QWebPage.ErrorPageExtension)
- self.assertRaises(RuntimeError, ep.rcv_url.__str__)
+ qmlRegisterSingletonType('Singletons', 1, 0, 'SingletonQJSValue', singletonQJSValueCallback)
- self.assertEqual(ep.rcv_url_copy, "foo://bar")
- self.assertEqual(ep.rcv_option_type, QWebPage.ErrorPageExtensionOption)
- self.assertEqual(ep.rcv_output_type, QWebPage.ErrorPageExtensionReturn)
+ view = QQuickView()
+ view.setSource(QUrl.fromLocalFile(adjust_filename('registersingletontype.qml', __file__)))
+ view.show()
+ QTimer.singleShot(250, view.close)
+ app.exec_()
+ self.assertEqual(finalResult, 200)
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside2/tests/QtQml/registersingletontype.qml b/sources/pyside2/tests/QtQml/registersingletontype.qml
new file mode 100644
index 00000000..c8b34e69
--- /dev/null
+++ b/sources/pyside2/tests/QtQml/registersingletontype.qml
@@ -0,0 +1,36 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 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 QtQuick 2.0
+import Singletons 1.0
+
+Item {
+ Component.onCompleted: {
+ SingletonQObjectCallback.data += SingletonQObjectNoCallback.data + SingletonQJSValue.data
+ }
+}
diff --git a/sources/pyside2/tests/QtQml/registertype.py b/sources/pyside2/tests/QtQml/registertype.py
index 7e6fe8d2..53425b1b 100644
--- a/sources/pyside2/tests/QtQml/registertype.py
+++ b/sources/pyside2/tests/QtQml/registertype.py
@@ -36,11 +36,26 @@ init_test_paths(False)
from helper.helper import adjust_filename
-from PySide2.QtCore import Property, QTimer, QUrl
+from PySide2.QtCore import Property, QObject, QTimer, QUrl
from PySide2.QtGui import QGuiApplication, QPen, QColor, QPainter
-from PySide2.QtQml import qmlRegisterType, ListProperty
+from PySide2.QtQml import qmlRegisterType, qmlRegisterUncreatableType, ListProperty
from PySide2.QtQuick import QQuickView, QQuickItem, QQuickPaintedItem
+noCreationReason = 'Cannot create an item of type: Uncreatable (expected)';
+
+class Uncreatable(QObject):
+ def __init__(self, parent = None):
+ QObject.__init__(self, parent)
+ self._name = 'uncreatable'
+
+ def getName(self):
+ return self._name
+
+ def setName(self, value):
+ self._name = value
+
+ name = Property(str, getName, setName)
+
class PieSlice (QQuickPaintedItem):
def __init__(self, parent = None):
QQuickPaintedItem.__init__(self, parent)
@@ -108,8 +123,10 @@ class TestQmlSupport(unittest.TestCase):
def testIt(self):
app = QGuiApplication([])
- qmlRegisterType(PieChart, 'Charts', 1, 0, 'PieChart');
- qmlRegisterType(PieSlice, "Charts", 1, 0, "PieSlice");
+ qmlRegisterType(PieChart, 'Charts', 1, 0, 'PieChart')
+ self.assertTrue(qmlRegisterType(PieSlice, "Charts", 1, 0, "PieSlice") > 0);
+ self.assertTrue(qmlRegisterUncreatableType(Uncreatable, 'Charts', 1, 0,
+ 'Uncreatable', noCreationReason) > 0);
view = QQuickView()
view.setSource(QUrl.fromLocalFile(adjust_filename('registertype.qml', __file__)))
@@ -119,5 +136,16 @@ class TestQmlSupport(unittest.TestCase):
self.assertTrue(appendCalled)
self.assertTrue(paintCalled)
+ # Check that the uncreatable item produces the correct error
+ view.setSource(QUrl.fromLocalFile(helper.adjust_filename('registeruncreatable.qml', __file__)))
+ self.assertEqual(view.status(), QQuickView.Error)
+ errorFound = False
+ for e in view.errors():
+ if noCreationReason in e.toString():
+ errorFound = True
+ break
+ self.assertTrue(errorFound)
+
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside2/tests/QtQml/registeruncreatable.qml b/sources/pyside2/tests/QtQml/registeruncreatable.qml
new file mode 100644
index 00000000..347a8117
--- /dev/null
+++ b/sources/pyside2/tests/QtQml/registeruncreatable.qml
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 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 QtQuick 2.0
+import Charts 1.0
+
+Item {
+ width: 300; height: 200
+
+ Uncreatable {
+ name : 'uncreatable'
+ }
+
+ PieChart {
+ anchors.centerIn: parent
+ width: 100; height: 100
+ }
+}
diff --git a/sources/pyside2/tests/QtQml/signal_arguments.py b/sources/pyside2/tests/QtQml/signal_arguments.py
index 98b52c05..16257a22 100644
--- a/sources/pyside2/tests/QtQml/signal_arguments.py
+++ b/sources/pyside2/tests/QtQml/signal_arguments.py
@@ -68,6 +68,7 @@ class TestConnectionWithQml(TimedQApplication):
root = view.rootObject()
self.assertTrue(root)
button = root.findChild(QObject, "button")
+ self.assertTrue(button)
view.show()
button.clicked.emit()
self.assertEqual(obj.value, 42)
diff --git a/sources/pyside2/tests/QtQml/signal_arguments.qml b/sources/pyside2/tests/QtQml/signal_arguments.qml
index 0c65b947..73a1715f 100644
--- a/sources/pyside2/tests/QtQml/signal_arguments.qml
+++ b/sources/pyside2/tests/QtQml/signal_arguments.qml
@@ -28,14 +28,14 @@
import QtQuick 2.5
-import QtQuick.Controls 1.4
+import QtQuick.Controls 2.12
import QtQuick.Layouts 1.2
Rectangle {
visible: true
GridLayout {
Button {
- id: "button"
+ id: button
objectName: "button"
text: "sum!"
onClicked: {
diff --git a/sources/pyside2/tests/QtSvg/CMakeLists.txt b/sources/pyside2/tests/QtSvg/CMakeLists.txt
index 4f5e2805..53d15e85 100644
--- a/sources/pyside2/tests/QtSvg/CMakeLists.txt
+++ b/sources/pyside2/tests/QtSvg/CMakeLists.txt
@@ -1,3 +1,2 @@
PYSIDE_TEST(qsvggenerator_test.py)
PYSIDE_TEST(qsvgrenderer_test.py)
-PYSIDE_TEST(qsvgwidget_test.py)
diff --git a/sources/pyside2/tests/QtSvg/qsvgrenderer_test.py b/sources/pyside2/tests/QtSvg/qsvgrenderer_test.py
index 88537edf..3dd5b61f 100644
--- a/sources/pyside2/tests/QtSvg/qsvgrenderer_test.py
+++ b/sources/pyside2/tests/QtSvg/qsvgrenderer_test.py
@@ -2,7 +2,7 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2020 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -36,15 +36,15 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from init_paths import init_test_paths
init_test_paths(False)
-from PySide2.QtCore import *
-from PySide2.QtWidgets import *
-from PySide2.QtSvg import *
+from PySide2.QtCore import QFile
+from PySide2.QtGui import QGuiApplication
+from PySide2.QtSvg import QSvgRenderer
class QSvgRendererTest(unittest.TestCase):
def testLoad(self):
tigerPath = os.path.join(os.path.dirname(__file__), 'tiger.svg')
- app = QApplication([])
+ app = QGuiApplication([])
fromFile = QSvgRenderer(tigerPath)
self.assertTrue(fromFile.isValid())
diff --git a/sources/pyside2/tests/QtSvgWidgets/CMakeLists.txt b/sources/pyside2/tests/QtSvgWidgets/CMakeLists.txt
new file mode 100644
index 00000000..61952169
--- /dev/null
+++ b/sources/pyside2/tests/QtSvgWidgets/CMakeLists.txt
@@ -0,0 +1 @@
+PYSIDE_TEST(qsvgwidget_test.py)
diff --git a/sources/pyside2/tests/QtSvg/qsvgwidget_test.py b/sources/pyside2/tests/QtSvgWidgets/qsvgwidget_test.py
index 17bf6527..a3749c0e 100644
--- a/sources/pyside2/tests/QtSvg/qsvgwidget_test.py
+++ b/sources/pyside2/tests/QtSvgWidgets/qsvgwidget_test.py
@@ -2,7 +2,7 @@
#############################################################################
##
-## Copyright (C) 2016 The Qt Company Ltd.
+## Copyright (C) 2020 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the test suite of Qt for Python.
@@ -36,14 +36,16 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from init_paths import init_test_paths
init_test_paths(False)
-from PySide2.QtCore import *
-from PySide2.QtWidgets import *
-from PySide2.QtSvg import *
+from PySide2.QtCore import QFile, QFileInfo, QDir
+from PySide2.QtWidgets import QApplication
+from PySide2.QtSvgWidgets import QSvgWidget
class QSvgWidgetTest(unittest.TestCase):
def testLoad(self):
- tigerPath = os.path.join(os.path.dirname(__file__), 'tiger.svg')
+ dir = os.path.dirname(__file__)
+ tigerPath = QDir.cleanPath("{}/../QtSvg/tiger.svg".format(dir))
+ self.assertTrue(QFileInfo.exists(tigerPath))
app = QApplication([])
fromFile = QSvgWidget()
diff --git a/sources/pyside2/tests/QtUiTools/bug_392.py b/sources/pyside2/tests/QtUiTools/bug_392.py
index 2439e720..1a049b89 100644
--- a/sources/pyside2/tests/QtUiTools/bug_392.py
+++ b/sources/pyside2/tests/QtUiTools/bug_392.py
@@ -36,29 +36,31 @@ init_test_paths(False)
from helper.usesqapplication import UsesQApplication
-from PySide2 import QtWidgets
+from PySide2.QtGui import QAction
+from PySide2.QtWidgets import QComboBox, QWidget
from PySide2.QtUiTools import QUiLoader
-class MyWidget(QtWidgets.QComboBox):
+class MyWidget(QComboBox):
def __init__(self, parent=None):
- QtWidgets.QComboBox.__init__(self, parent)
+ QComboBox.__init__(self, parent)
def isPython(self):
return True
class BugTest(UsesQApplication):
def testCase(self):
- w = QtWidgets.QWidget()
+ w = QWidget()
loader = QUiLoader()
filePath = os.path.join(os.path.dirname(__file__), 'action.ui')
result = loader.load(filePath, w)
- self.assertTrue(isinstance(result.actionFoo, QtWidgets.QAction))
+ self.assertTrue(isinstance(result.actionFoo, QAction))
def testPythonCustomWidgets(self):
- w = QtWidgets.QWidget()
+ w = QWidget()
loader = QUiLoader()
loader.registerCustomWidget(MyWidget)
+ self.assertTrue('MyWidget' in loader.availableWidgets())
filePath = os.path.join(os.path.dirname(__file__), 'pycustomwidget.ui')
result = loader.load(filePath, w)
@@ -66,9 +68,10 @@ class BugTest(UsesQApplication):
self.assertTrue(result.custom.isPython())
def testPythonCustomWidgetsTwice(self):
- w = QtWidgets.QWidget()
+ w = QWidget()
loader = QUiLoader()
loader.registerCustomWidget(MyWidget)
+ self.assertTrue('MyWidget' in loader.availableWidgets())
filePath = os.path.join(os.path.dirname(__file__), 'pycustomwidget2.ui')
result = loader.load(filePath, w)
diff --git a/sources/pyside2/tests/QtUiTools/bug_426.py b/sources/pyside2/tests/QtUiTools/bug_426.py
index e84da038..488ba5c8 100644
--- a/sources/pyside2/tests/QtUiTools/bug_426.py
+++ b/sources/pyside2/tests/QtUiTools/bug_426.py
@@ -34,19 +34,22 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from init_paths import init_test_paths
init_test_paths(False)
-from PySide2 import QtCore, QtWidgets
+from PySide2.QtCore import QTimer
+from PySide2.QtGui import QAction, QActionGroup
+from PySide2.QtWidgets import QApplication, QWidget
from PySide2.QtUiTools import QUiLoader
+
class Window(object):
def __init__(self):
loader = QUiLoader()
filePath = os.path.join(os.path.dirname(__file__), 'bug_426.ui')
self.widget = loader.load(filePath)
- self.group = QtWidgets.QActionGroup(self.widget)
+ self.group = QActionGroup(self.widget)
self.widget.show()
- QtCore.QTimer.singleShot(0, self.widget.close)
+ QTimer.singleShot(0, self.widget.close)
if __name__ == "__main__":
- app = QtWidgets.QApplication(sys.argv)
+ app = QApplication(sys.argv)
win = Window()
sys.exit(app.exec_())
diff --git a/sources/pyside2/tests/QtWebKit/CMakeLists.txt b/sources/pyside2/tests/QtWebKit/CMakeLists.txt
deleted file mode 100644
index 7fab6477..00000000
--- a/sources/pyside2/tests/QtWebKit/CMakeLists.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-PYSIDE_TEST(bug_448.py)
-PYSIDE_TEST(bug_694.py)
-PYSIDE_TEST(bug_803.py)
-PYSIDE_TEST(bug_899.py)
-PYSIDE_TEST(bug_959.py)
-PYSIDE_TEST(qvariantlist_property_test.py)
-PYSIDE_TEST(qml_plugin_test.py)
-PYSIDE_TEST(shouldInterruptjavascript_test.py)
-PYSIDE_TEST(webpage_test.py)
-PYSIDE_TEST(webview_test.py)
-PYSIDE_TEST(webframe_test.py)
diff --git a/sources/pyside2/tests/QtWebKit/bug_448.py b/sources/pyside2/tests/QtWebKit/bug_448.py
deleted file mode 100644
index 98ebb195..00000000
--- a/sources/pyside2/tests/QtWebKit/bug_448.py
+++ /dev/null
@@ -1,52 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2016 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 bug: http://bugs.openbossa.org/show_bug.cgi?id=448'''
-
-import os
-import sys
-import unittest
-
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from init_paths import init_test_paths
-init_test_paths(False)
-
-from PySide2.QtWidgets import QApplication
-from PySide2.QtWebKit import QWebView
-
-class Bug448(unittest.TestCase):
- def onError(self, erros):
- pass
-
- def testReturnOwnership(self):
- app = QApplication(sys.argv)
- webview = QWebView()
- webview.page().networkAccessManager().sslErrors.connect(self.onError)
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside2/tests/QtWebKit/bug_803.py b/sources/pyside2/tests/QtWebKit/bug_803.py
deleted file mode 100644
index ec6f93c3..00000000
--- a/sources/pyside2/tests/QtWebKit/bug_803.py
+++ /dev/null
@@ -1,53 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2016 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 os
-import sys
-import unittest
-
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from init_paths import init_test_paths
-init_test_paths(False)
-
-from PySide2.QtWidgets import *
-from PySide2.QtWebKit import *
-
-class TestBug803 (unittest.TestCase):
-
- def testIt(self):
- app = QApplication([])
- page = QWebPage()
- frame = page.mainFrame()
- frame.setHtml("<html><head></head><body><p>1</p><p>2</p></body></html>")
- elems = frame.findAllElements("p")
- self.assertEqual(len(elems), 2)
- self.assertEqual(elems[0].toPlainText(), "1")
- self.assertEqual(elems[1].toPlainText(), "2")
-
-if __name__ == "__main__":
- unittest.main()
diff --git a/sources/pyside2/tests/QtWebKit/bug_899.py b/sources/pyside2/tests/QtWebKit/bug_899.py
deleted file mode 100644
index cb8e7678..00000000
--- a/sources/pyside2/tests/QtWebKit/bug_899.py
+++ /dev/null
@@ -1,71 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2016 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 os
-import sys
-import unittest
-
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from init_paths import init_test_paths
-init_test_paths(False)
-
-from PySide2.QtCore import Property, QObject
-from PySide2.QtWebKit import QWebView
-from helper.timedqapplication import TimedQApplication
-
-class TestLambdaPropery(TimedQApplication):
-
- def testBug899(self):
- html = '''
- <html><body>
- <script type="text/javascript">
- document.write("<p>"+py_obj.list1+"</p>")
- document.write("<p>"+py_obj.list2+"</p>")
- </script>
- </body></html>
- '''
-
- class Obj(object):
- list1 = ['foo', 'bar', 'baz']
- list2 = ['fi', 'fo', 'fum']
-
- obj = Obj()
-
- wrapper_dict = {}
- for name in ('list1', 'list2'):
- getter = lambda arg=None, name=name: getattr(obj, name)
- wrapper_dict[name] = Property('QVariantList', getter)
- wrapper = type('PyObj', (QObject,), wrapper_dict)
-
- view = QWebView()
- view.page().mainFrame().addToJavaScriptWindowObject('py_obj', wrapper())
- view.setHtml(html)
-
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside2/tests/QtWebKit/bug_959.py b/sources/pyside2/tests/QtWebKit/bug_959.py
deleted file mode 100644
index 5214ee1e..00000000
--- a/sources/pyside2/tests/QtWebKit/bug_959.py
+++ /dev/null
@@ -1,133 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2016 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$
-##
-#############################################################################
-
-from PySide2.QtCore import QObject, Slot, QTimer
-from PySide2.QtWebKit import QWebView
-from PySide2.QtWidgets import QApplication
-from PySide2 import QtCore
-
-import os
-import sys
-import unittest
-
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from init_paths import init_test_paths
-init_test_paths(False)
-
-from helper.usesqapplication import UsesQApplication
-
-functionID = -1
-currentWebView = None
-
-class JSFuncs(QObject):
- @Slot(str,result=str)
- def slot_str_str(self, x):
- global functionID
- functionID = 0
- return x.upper()
-
- @Slot(str,result='QVariant')
- def slot_str_list(self, x):
- global functionID
- functionID = 1
- return [x, x]
-
- @Slot('QStringList',result=str)
- def slot_strlist_str(self, x):
- global functionID
- functionID = 2
- return x[-1]
-
- @Slot('QVariant',result=str)
- def slot_variant_str(self, x):
- global functionID
- functionID = 3
- return str(x)
-
- @Slot('QVariantList',result=str)
- def slot_variantlist_str(self, x):
- global functionID
- functionID = 4
- return str(x[-1])
-
- @Slot('QVariantMap',result=str)
- def slot_variantmap_str(self, x):
- global functionID
- functionID = 5
- return str(x["foo"])
-
-
-
-PAGE_DATA = "data:text/html,<!doctype html><html><body onload='%s'></body></html>"
-FUNCTIONS_LIST = ['jsfuncs.slot_str_str("hello")',
- 'jsfuncs.slot_str_list("hello")',
- 'jsfuncs.slot_strlist_str(["hello","world"])',
- 'jsfuncs.slot_variant_str("hello")',
- 'jsfuncs.slot_variantlist_str(["hello","world"])',
- 'jsfuncs.slot_variantmap_str({"foo": "bar"})']
-
-
-def onLoadFinished( result ):
- QTimer.singleShot( 100, createNextWebView )
-
-def createNextWebView():
- global functionID
-
- nListCount = len(FUNCTIONS_LIST) - 1
- functionID = functionID + 1
- print functionID
-
- if functionID < nListCount:
- createWebView( functionID )
- else:
- QTimer.singleShot(300, QApplication.instance().quit)
-
-
-def createWebView( nIndex ):
- global functionID
- global currentWebView
-
- functionID = nIndex
- currentWebView = QWebView()
- currentWebView._jsfuncs = JSFuncs()
- currentWebView.page().mainFrame().addToJavaScriptWindowObject("jsfuncs", currentWebView._jsfuncs)
- QObject.connect( currentWebView, QtCore.SIGNAL('loadFinished( bool )'), onLoadFinished )
- currentWebView.load(PAGE_DATA % FUNCTIONS_LIST[ nIndex ])
- currentWebView.show()
-
-class Bug959(UsesQApplication):
-
- def testJavaScriptInWebViewForCrash( self ):
- # wait for the webview load to be finished before creating the next webview
- # don't create the webview inside of onLoadFinished
- # also call onLoadFinished with the correct number of variables
- createNextWebView()
- self.app.exec_()
-
-if __name__ == "__main__":
- unittest.main()
diff --git a/sources/pyside2/tests/QtWebKit/fox.html b/sources/pyside2/tests/QtWebKit/fox.html
deleted file mode 100644
index da873b1c..00000000
--- a/sources/pyside2/tests/QtWebKit/fox.html
+++ /dev/null
@@ -1,7 +0,0 @@
-<html>
-<title>Title</title>
-<meta name="description" content="PySide Test METADATA." />
-<body>
-<p>The quick <b>brown</b> fox <i>jumps</i> over the lazy dog.</p>
-</body>
-</html>
diff --git a/sources/pyside2/tests/QtWebKit/qml_plugin_test.py b/sources/pyside2/tests/QtWebKit/qml_plugin_test.py
deleted file mode 100644
index 33497bdc..00000000
--- a/sources/pyside2/tests/QtWebKit/qml_plugin_test.py
+++ /dev/null
@@ -1,92 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2016 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 os
-import sys
-import unittest
-
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from init_paths import init_test_paths
-init_test_paths(False)
-
-from PySide2.QtCore import QUrl, QTimer
-from PySide2.QtWidgets import QApplication, QLabel
-from PySide2.QtWebKit import QWebPluginFactory, QWebView, QWebSettings
-
-from helper.usesqapplication import UsesQApplication
-
-class PluginFactory(QWebPluginFactory):
-
- def plugins(self):
- plugins = []
-
- mime = self.MimeType()
- mime.name = 'DummyFile'
- mime.fileExtensions = ['.pys']
-
- plugin = self.Plugin()
- plugin.name = 'DummyPlugin'
- plugin.mimeTypes = [mime]
-
- plugins.append(plugin)
-
- return plugins
-
- def create(self, mimeType, url, argumentNames, argumentValues):
- if mimeType != 'application/x-dummy':
- return None
-
- for name, value in zip(argumentNames, argumentValues):
- if name == 'text':
- text = value
- else:
- text = "Webkit plugins!"
-
- widget = QLabel(text)
- return widget
-
-class TestPlugin(UsesQApplication):
-
- def testPlugin(self):
- view = QWebView()
- fac = PluginFactory()
- view.page().setPluginFactory(fac)
- QWebSettings.globalSettings().setAttribute(QWebSettings.PluginsEnabled, True)
-
- view.load(QUrl(os.path.join(os.path.abspath(os.path.dirname(__file__)), 'qmlplugin', 'index.html')))
-
- view.resize(840, 600)
- view.show()
-
- QTimer.singleShot(500, self.app.quit)
-
- self.app.exec_()
-
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside2/tests/QtWebKit/qmlplugin/dummy.pys b/sources/pyside2/tests/QtWebKit/qmlplugin/dummy.pys
deleted file mode 100644
index 0b7469da..00000000
--- a/sources/pyside2/tests/QtWebKit/qmlplugin/dummy.pys
+++ /dev/null
@@ -1 +0,0 @@
-Foobar!
diff --git a/sources/pyside2/tests/QtWebKit/qmlplugin/index.html b/sources/pyside2/tests/QtWebKit/qmlplugin/index.html
deleted file mode 100644
index db0d6b5b..00000000
--- a/sources/pyside2/tests/QtWebKit/qmlplugin/index.html
+++ /dev/null
@@ -1,5 +0,0 @@
-<html><body>
- <h1>Custom Plugin</h1>
- <object type="application/x-dummy" data="./dummy.pys" text="My text">
- </object>
-</body></html>
diff --git a/sources/pyside2/tests/QtWebKit/qvariantlist_property_test.py b/sources/pyside2/tests/QtWebKit/qvariantlist_property_test.py
deleted file mode 100644
index 6a51a648..00000000
--- a/sources/pyside2/tests/QtWebKit/qvariantlist_property_test.py
+++ /dev/null
@@ -1,78 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2016 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 os
-import sys
-import unittest
-
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from init_paths import init_test_paths
-init_test_paths(False)
-
-from PySide2.QtCore import Property, QObject
-from PySide2.QtWebKit import QWebView
-from helper.timedqapplication import TimedQApplication
-
-class TestLoadFinished(TimedQApplication):
-
- def setUp(self):
- TimedQApplication.setUp(self, timeout=1000)
-
- def tearDown(self):
- TimedQApplication.tearDown(self)
-
- def testQVariantListProperty(self):
- class Obj(object):
- list = ['foo', 'bar', 'baz']
-
- obj = Obj()
-
- wrapper_dict = {}
- for name in ['list']:
- getter = lambda arg=None, name=name: getattr(obj, name)
- wrapper_dict[name] = Property('QVariantList', getter)
- wrapper = type('PyObj', (QObject,), wrapper_dict)
-
- view = QWebView()
- frame = view.page().mainFrame()
- frame.addToJavaScriptWindowObject('py_obj', wrapper())
-
- html = '''
- <html><body>
- <script type="text/javascript">
- document.write(py_obj.list)
- </script>
- </body></html>
- '''
- view.setHtml(html)
- view.show()
- self.app.exec_()
-
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside2/tests/QtWebKit/shouldInterruptjavascript_test.py b/sources/pyside2/tests/QtWebKit/shouldInterruptjavascript_test.py
deleted file mode 100644
index 4db5adbb..00000000
--- a/sources/pyside2/tests/QtWebKit/shouldInterruptjavascript_test.py
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-#############################################################################
-##
-## Copyright (C) 2016 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 os
-import sys
-import unittest
-
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from init_paths import init_test_paths
-init_test_paths(False)
-
-from PySide2 import QtCore, QtWebKit
-
-from helper.usesqapplication import UsesQApplication
-
-class QWebPageHeadless(QtWebKit.QWebPage):
- # FIXME: This is not working, the slot is not overriden!
- # http://doc.qt.nokia.com/4.7-snapshot/qwebpage.html#shouldInterruptJavaScript
- @QtCore.Slot()
- def shouldInterruptJavaScript(self):
- self._interrupted = True
- QtCore.QTimer.singleShot(300, self._app.quit)
- return True
-
-class TestSlotOverride(UsesQApplication):
- def testFunctionCall(self):
- page = QWebPageHeadless()
- page._interrupted = False
- page._app = self.app
- page.mainFrame().setHtml('<script>while(1);</script>')
- self.app.exec_()
- self.assertTrue(page._interrupted)
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside2/tests/QtWebKit/webframe_test.py b/sources/pyside2/tests/QtWebKit/webframe_test.py
deleted file mode 100644
index d46c1b22..00000000
--- a/sources/pyside2/tests/QtWebKit/webframe_test.py
+++ /dev/null
@@ -1,67 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2016 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 os
-import sys
-import unittest
-
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from init_paths import init_test_paths
-init_test_paths(False)
-
-from PySide2.QtCore import QObject, SIGNAL, QUrl
-from PySide2.QtWebKit import *
-from PySide2.QtNetwork import QNetworkRequest
-
-from helper.helper import adjust_filename
-from helper.usesqapplication import UsesQApplication
-
-
-class TestWebFrame(UsesQApplication):
- def load_finished(self, ok):
- self.assertTrue(ok)
- page = self.view.page()
- self.assertTrue(page)
- frame = page.mainFrame()
- self.assertTrue(frame)
- meta = frame.metaData()
- self.assertEqual(meta['description'], ['PySide Test METADATA.'])
- self.app.quit()
-
- def testMetaData(self):
- self.view = QWebView()
- QObject.connect(self.view, SIGNAL('loadFinished(bool)'),
- self.load_finished)
- url = QUrl.fromLocalFile(adjust_filename('fox.html', __file__))
- self.view.setUrl(url)
- self.app.exec_()
-
-
-if __name__ == '__main__':
- unittest.main()
-
diff --git a/sources/pyside2/tests/QtWebKit/webpage_test.py b/sources/pyside2/tests/QtWebKit/webpage_test.py
deleted file mode 100644
index 0c37befa..00000000
--- a/sources/pyside2/tests/QtWebKit/webpage_test.py
+++ /dev/null
@@ -1,95 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2016 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 QWebPage'''
-
-import os
-import sys
-import unittest
-
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from init_paths import init_test_paths
-init_test_paths(False)
-
-from PySide2.QtCore import QObject, SIGNAL, QUrl
-from PySide2.QtWebKit import QWebPage
-from PySide2.QtNetwork import QNetworkAccessManager
-
-from helper.helper import adjust_filename
-from helper.timedqapplication import TimedQApplication
-
-#Define a global timeout because TimedQApplication uses a singleton!
-#Use a value big enough to run all the tests.
-TIMEOUT = 1000
-
-class TestFindText(TimedQApplication):
- '''Test cases for finding text'''
-
- def setUp(self):
- TimedQApplication.setUp(self, timeout=TIMEOUT)
- self.page = QWebPage()
- QObject.connect(self.page, SIGNAL('loadFinished(bool)'),
- self.load_finished)
- self.called = False
-
- def tearDown(self):
- #Release resources
- del self.page
- self.called = False
- TimedQApplication.tearDown(self)
-
- def testFindSelectText(self):
- url = QUrl.fromLocalFile(adjust_filename('fox.html', __file__))
- self.page.mainFrame().load(url)
- self.app.exec_()
- self.assertTrue(self.called)
-
- def load_finished(self, ok):
- #Callback to check if load was successful
- if ok:
- self.called = True
- self.assertTrue(self.page.findText('fox'))
- self.assertEqual(self.page.selectedText(), 'fox')
- self.app.quit()
-
-class SetNetworkAccessManagerCase(TimedQApplication):
-
- def setUp(self):
- TimedQApplication.setUp(self, timeout=TIMEOUT)
-
- def testSetNetworkAccessManager(self):
- page = QWebPage()
- manager = QNetworkAccessManager()
- page.setNetworkAccessManager(manager)
-
- def testNetWorkAccessManager(self):
- page = QWebPage()
- a = page.networkAccessManager()
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside2/tests/QtWebKit/webview_test.py b/sources/pyside2/tests/QtWebKit/webview_test.py
deleted file mode 100644
index 5ecac538..00000000
--- a/sources/pyside2/tests/QtWebKit/webview_test.py
+++ /dev/null
@@ -1,101 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2016 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 QWebView'''
-
-import os
-import sys
-import unittest
-
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from init_paths import init_test_paths
-init_test_paths(False)
-
-import py3kcompat as py3k
-
-from PySide2.QtCore import QObject, SIGNAL, QUrl
-from PySide2.QtWebKit import QWebPage, QWebView
-from PySide2.QtNetwork import QNetworkRequest
-
-from helper.helper import adjust_filename
-from helper.timedqapplication import TimedQApplication
-
-
-class testWebPage(QWebPage):
- def sayMyName(self):
- return 'testWebPage'
-
-class TestLoadFinished(TimedQApplication):
- '''Test case for signal QWebView.loadFinished(bool)'''
-
- def setUp(self):
- #Acquire resources
- TimedQApplication.setUp(self, timeout=1000)
- self.view = QWebView()
- QObject.connect(self.view, SIGNAL('loadFinished(bool)'),
- self.load_finished)
- self.called = False
-
- def tearDown(self):
- #Release resources
- del self.view
- self.called = False
- TimedQApplication.tearDown(self)
-
- def testLoadFinishedFromFile(self):
- url = QUrl.fromLocalFile(adjust_filename('fox.html', __file__))
- self.view.setUrl(url)
- self.app.exec_()
-
- self.assertTrue(self.called)
-
- def testSetPageAndGetPage(self):
- twp = testWebPage()
- self.view.setPage(twp)
- del twp
- p = self.view.page()
- self.assertEqual(p.sayMyName(), 'testWebPage')
-
- # Setting the same webpage should not incref the python obj
- refCount = sys.getrefcount(p)
- self.view.setPage(p)
- self.assertEqual(sys.getrefcount(p), refCount)
-
- # Changing the webpage obj should decref the old one
- twp2 = testWebPage()
- self.view.setPage(twp2)
- self.assertEqual(sys.getrefcount(p), refCount - 1)
-
- def load_finished(self, ok):
- #Callback to check if load was successful
- self.app.quit()
- if ok:
- self.called = True
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside2/tests/QtWidgets/CMakeLists.txt b/sources/pyside2/tests/QtWidgets/CMakeLists.txt
index 6682136e..f6c3c01b 100644
--- a/sources/pyside2/tests/QtWidgets/CMakeLists.txt
+++ b/sources/pyside2/tests/QtWidgets/CMakeLists.txt
@@ -9,7 +9,6 @@ PYSIDE_TEST(bug_243.py)
PYSIDE_TEST(bug_307.py)
PYSIDE_TEST(bug_324.py)
PYSIDE_TEST(bug_338.py)
-PYSIDE_TEST(bug_363.py)
PYSIDE_TEST(bug_389.py)
PYSIDE_TEST(bug_400.py)
PYSIDE_TEST(bug_416.py)
@@ -28,7 +27,6 @@ PYSIDE_TEST(bug_575.py)
PYSIDE_TEST(bug_576.py)
PYSIDE_TEST(bug_585.py)
PYSIDE_TEST(bug_589.py)
-PYSIDE_TEST(bug_632.py)
PYSIDE_TEST(bug_635.py)
PYSIDE_TEST(bug_640.py)
PYSIDE_TEST(bug_653.py)
diff --git a/sources/pyside2/tests/QtWidgets/add_action_test.py b/sources/pyside2/tests/QtWidgets/add_action_test.py
index c8a7c226..d4af8b5d 100644
--- a/sources/pyside2/tests/QtWidgets/add_action_test.py
+++ b/sources/pyside2/tests/QtWidgets/add_action_test.py
@@ -37,7 +37,8 @@ from init_paths import init_test_paths
init_test_paths(False)
from PySide2.QtCore import SLOT
-from PySide2.QtWidgets import QMenuBar, QAction, QPushButton
+from PySide2.QtGui import QAction
+from PySide2.QtWidgets import QMenuBar, QPushButton
from helper.usesqapplication import UsesQApplication
diff --git a/sources/pyside2/tests/QtWidgets/bug_363.py b/sources/pyside2/tests/QtWidgets/bug_363.py
deleted file mode 100644
index 910525fe..00000000
--- a/sources/pyside2/tests/QtWidgets/bug_363.py
+++ /dev/null
@@ -1,59 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2016 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 bug 363: http://bugs.openbossa.org/show_bug.cgi?id=363'''
-
-import os
-import sys
-import unittest
-
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from init_paths import init_test_paths
-init_test_paths(False)
-
-from helper.usesqapplication import UsesQApplication
-from PySide2 import QtCore, QtWidgets
-
-# Check for desktop object lifetime
-class BugTest(UsesQApplication):
- def mySlot(self):
- pass
-
- # test if it is possible to connect with a desktop object after storing that on an auxiliar variable
- def testCase1(self):
- desktop = QtWidgets.QApplication.desktop()
- desktop.resized[int].connect(self.mySlot)
- self.assertTrue(True)
-
- # test if it is possible to connect with a desktop object without storing that on an auxiliar variable
- def testCase2(self):
- QtWidgets.QApplication.desktop().resized[int].connect(self.mySlot)
- self.assertTrue(True)
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/sources/pyside2/tests/QtWidgets/bug_632.py b/sources/pyside2/tests/QtWidgets/bug_632.py
deleted file mode 100644
index d836b2ff..00000000
--- a/sources/pyside2/tests/QtWidgets/bug_632.py
+++ /dev/null
@@ -1,54 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2016 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 os
-import sys
-import unittest
-
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
-from init_paths import init_test_paths
-init_test_paths(False)
-
-from PySide2.QtWidgets import QLineEdit, QApplication
-
-
-class Bug589(unittest.TestCase):
- def testWrongSignature(self):
- text = QLineEdit("PySide bug 632")
- a = b = c = d = 0
- self.assertRaises(TypeError, text.getTextMargins, (a, b, c, d))
-
- def testTupleReturn(self):
- text = QLineEdit("PySide bug 632")
- text.setTextMargins(10, 20, 30, 40)
- (a, b, c, d) = text.getTextMargins()
- self.assertTrue((a, b, c, d), (10, 20, 30, 40))
-
-if __name__ == "__main__":
- app = QApplication(sys.argv)
- unittest.main()
diff --git a/sources/pyside2/tests/QtWidgets/bug_711.py b/sources/pyside2/tests/QtWidgets/bug_711.py
index 43e4b7bb..3898e23f 100644
--- a/sources/pyside2/tests/QtWidgets/bug_711.py
+++ b/sources/pyside2/tests/QtWidgets/bug_711.py
@@ -34,7 +34,8 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from init_paths import init_test_paths
init_test_paths(False)
-from PySide2.QtWidgets import QToolBar, QApplication, QAction, QToolButton
+from PySide2.QtGui import QAction
+from PySide2.QtWidgets import QToolBar, QApplication, QToolButton
try:
xrange
diff --git a/sources/pyside2/tests/QtWidgets/bug_860.py b/sources/pyside2/tests/QtWidgets/bug_860.py
index 8cdab2e4..483973fd 100644
--- a/sources/pyside2/tests/QtWidgets/bug_860.py
+++ b/sources/pyside2/tests/QtWidgets/bug_860.py
@@ -52,7 +52,7 @@ class MultipleSlotTest(UsesQApplication):
box.stateChanged.connect(checkboxMapper.map)
checkboxMapper.setMapping(box, box.text())
- checkboxMapper.mapped[str].connect(self.cb_changed)
+ checkboxMapper.mappedString[str].connect(self.cb_changed)
self._changed = False
box.setChecked(True)
self.assertTrue(self._changed)
diff --git a/sources/pyside2/tests/QtWidgets/qaction_test.py b/sources/pyside2/tests/QtWidgets/qaction_test.py
index 8fc8f6c0..d587a59b 100644
--- a/sources/pyside2/tests/QtWidgets/qaction_test.py
+++ b/sources/pyside2/tests/QtWidgets/qaction_test.py
@@ -34,7 +34,8 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from init_paths import init_test_paths
init_test_paths(False)
-from PySide2.QtWidgets import QAction, QWidget
+from PySide2.QtGui import QAction
+from PySide2.QtWidgets import QWidget
from helper.usesqapplication import UsesQApplication
class QPainterDrawText(UsesQApplication):
diff --git a/sources/pyside2/tests/QtWidgets/qshortcut_test.py b/sources/pyside2/tests/QtWidgets/qshortcut_test.py
index 18aec285..dbe99167 100644
--- a/sources/pyside2/tests/QtWidgets/qshortcut_test.py
+++ b/sources/pyside2/tests/QtWidgets/qshortcut_test.py
@@ -38,11 +38,13 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from init_paths import init_test_paths
init_test_paths(False)
-from PySide2 import QtCore, QtGui, QtWidgets
+from PySide2.QtCore import Qt, QTimer
+from PySide2.QtGui import QKeySequence, QShortcut
+from PySide2.QtWidgets import QApplication, QWidget
-class Foo(QtWidgets.QWidget):
+class Foo(QWidget):
def __init__(self):
- QtWidgets.QWidget.__init__(self)
+ QWidget.__init__(self)
self.ok = False
self.copy = False
@@ -52,22 +54,22 @@ class Foo(QtWidgets.QWidget):
def slot_of_copy(self):
self.copy = True
-class MyShortcut(QtWidgets.QShortcut):
+class MyShortcut(QShortcut):
def __init__(self, keys, wdg, slot):
- QtWidgets.QShortcut.__init__(self, keys, wdg, slot)
+ QShortcut.__init__(self, keys, wdg, slot)
def emit_signal(self):
- self.emit(QtCore.SIGNAL("activated()"))
+ self.activated.emit()
class QAppPresence(unittest.TestCase):
def testQShortcut(self):
- self.qapp = QtWidgets.QApplication([])
+ self.qapp = QApplication([])
f = Foo()
- self.sc = MyShortcut(QtGui.QKeySequence(QtCore.Qt.Key_Return), f, f.slot_of_foo)
- self.scstd = MyShortcut(QtGui.QKeySequence.Copy, f, f.slot_of_copy)
- QtCore.QTimer.singleShot(0, self.init);
+ self.sc = MyShortcut(QKeySequence(Qt.Key_Return), f, f.slot_of_foo)
+ self.scstd = MyShortcut(QKeySequence.Copy, f, f.slot_of_copy)
+ QTimer.singleShot(0, self.init);
self.qapp.exec_()
self.assertEqual(f.ok, True)
self.assertEqual(f.copy, True)
diff --git a/sources/pyside2/tests/QtWidgets/qstring_qkeysequence_test.py b/sources/pyside2/tests/QtWidgets/qstring_qkeysequence_test.py
index 0321b69a..79842aac 100644
--- a/sources/pyside2/tests/QtWidgets/qstring_qkeysequence_test.py
+++ b/sources/pyside2/tests/QtWidgets/qstring_qkeysequence_test.py
@@ -42,8 +42,8 @@ init_test_paths(False)
import py3kcompat as py3k
from helper.usesqapplication import UsesQApplication
-from PySide2.QtGui import QKeySequence
-from PySide2.QtWidgets import QAction
+from PySide2.QtGui import QAction, QKeySequence
+
class QStringQKeySequenceTest(UsesQApplication):
'''Tests conversions of QString to and from QKeySequence.'''
diff --git a/sources/pyside2/tests/QtWidgets/qtoolbar_test.py b/sources/pyside2/tests/QtWidgets/qtoolbar_test.py
index 856bf07f..a70305c4 100644
--- a/sources/pyside2/tests/QtWidgets/qtoolbar_test.py
+++ b/sources/pyside2/tests/QtWidgets/qtoolbar_test.py
@@ -36,7 +36,8 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from init_paths import init_test_paths
init_test_paths(False)
-from PySide2.QtWidgets import QToolBar, QMainWindow, QAction
+from PySide2.QtGui import QAction
+from PySide2.QtWidgets import QToolBar, QMainWindow
from helper.usesqapplication import UsesQApplication
diff --git a/sources/pyside2/tests/QtXml/qdomdocument_test.py b/sources/pyside2/tests/QtXml/qdomdocument_test.py
index 67da9952..07319092 100644
--- a/sources/pyside2/tests/QtXml/qdomdocument_test.py
+++ b/sources/pyside2/tests/QtXml/qdomdocument_test.py
@@ -67,7 +67,7 @@ class QDomDocumentTest(unittest.TestCase):
'''Sets invalid xml as the QDomDocument contents.'''
ok, errorStr, errorLine, errorColumn = self.dom.setContent(self.badXmlData, True)
self.assertFalse(ok)
- self.assertEqual(errorStr, 'tag mismatch')
+ self.assertEqual(errorStr, 'Opening and ending tag mismatch.')
self.assertEqual(errorLine, 4)
self.assertEqual(errorColumn, 21)
diff --git a/sources/pyside2/tests/pysidetest/CMakeLists.txt b/sources/pyside2/tests/pysidetest/CMakeLists.txt
index bdd88ea3..b2eb7139 100644
--- a/sources/pyside2/tests/pysidetest/CMakeLists.txt
+++ b/sources/pyside2/tests/pysidetest/CMakeLists.txt
@@ -5,7 +5,10 @@ cmake_minimum_required(VERSION 3.1)
set(QT_USE_QTCORE 1)
# no more supported: include(${QT_USE_FILE})
-add_definitions(${Qt${QT_MAJOR_VERSION}Core_DEFINITIONS})
+
+# removed after qtbase/054b66a65748c9ebfafeca88bf31669a24994237, is this required?
+# add_definitions(${Qt${QT_MAJOR_VERSION}Core_DEFINITIONS})
+
add_definitions(-DQT_SHARED)
add_definitions(-DRXX_ALLOCATOR_INIT_0)
@@ -23,11 +26,7 @@ testview.h
hiddenobject.h
)
-if (${QT_MAJOR_VERSION} GREATER_EQUAL 6)
- qt6_wrap_cpp(pysidetest_MOC_SRC ${pysidetest_MOC_HEADERS})
-else()
- qt5_wrap_cpp(pysidetest_MOC_SRC ${pysidetest_MOC_HEADERS})
-endif()
+qt_wrap_cpp(pysidetest_MOC_SRC ${pysidetest_MOC_HEADERS})
set(testbinding_SRC
${CMAKE_CURRENT_BINARY_DIR}/testbinding/testobject_wrapper.cpp
@@ -48,9 +47,9 @@ ${CMAKE_CURRENT_BINARY_DIR}/testbinding/testbinding_module_wrapper.cpp
# Thus we use the second direct path, which contains the actual header files.
if(${QT_MAJOR_VERSION} GREATER_EQUAL 6)
- set(Qt6Core_DIRECT_INCLUDE_DIR Qt6Core_INCLUDE_DIRS)
- set(Qt6Gui_DIRECT_INCLUDE_DIR Qt6Gui_INCLUDE_DIRS)
- set(Qt6Widgets_DIRECT_INCLUDE_DIR Qt6Widgets_INCLUDE_DIRS)
+ set(Qt6Core_DIRECT_INCLUDE_DIR ${Qt6Core_INCLUDE_DIRS})
+ set(Qt6Gui_DIRECT_INCLUDE_DIR ${Qt6Gui_INCLUDE_DIRS})
+ set(Qt6Widgets_DIRECT_INCLUDE_DIR ${Qt6Widgets_INCLUDE_DIRS})
else()
list(GET Qt5Core_INCLUDE_DIRS 1 Qt5Core_DIRECT_INCLUDE_DIR)
list(GET Qt5Gui_INCLUDE_DIRS 1 Qt5Gui_DIRECT_INCLUDE_DIR)
diff --git a/sources/pyside2/tests/pysidetest/new_inherited_functions_test.py b/sources/pyside2/tests/pysidetest/new_inherited_functions_test.py
index 81a76498..55953ad6 100644
--- a/sources/pyside2/tests/pysidetest/new_inherited_functions_test.py
+++ b/sources/pyside2/tests/pysidetest/new_inherited_functions_test.py
@@ -57,7 +57,6 @@ new_functions = """
"""
new_functions += """
- PySide2.QtGui.QBitmap().transformed(qMatrix,transformationMode)
PySide2.QtGui.QStandardItemModel().insertColumn(int,qModelIndex)
PySide2.QtGui.QStandardItemModel().parent()
# PySide2.QtGui.QTextList(qTextDocument).setFormat(qTextFormat) # Segmentation fault: 11
@@ -71,8 +70,6 @@ new_functions += """
PySide2.QtWidgets.QApplication.setPalette(qPalette)
PySide2.QtWidgets.QBoxLayout(direction).addWidget(qWidget)
PySide2.QtWidgets.QColorDialog().open()
- PySide2.QtWidgets.QDirModel().index(int,int,qModelIndex)
- PySide2.QtWidgets.QDirModel().parent()
PySide2.QtWidgets.QFileDialog().open()
PySide2.QtWidgets.QFileSystemModel().index(int,int,qModelIndex)
PySide2.QtWidgets.QFileSystemModel().parent()
@@ -145,7 +142,6 @@ class MainTest(unittest.TestCase):
try:
PySide2.QtGui
#qPaintDevice = PySide2.QtGui.QPaintDevice() # NotImplementedError
- qMatrix = PySide2.QtGui.QMatrix()
qTextDocument = PySide2.QtGui.QTextDocument()
qTextFormat = PySide2.QtGui.QTextFormat()
quintptr = long(42) if sys.version_info[0] < 3 else 42
@@ -158,7 +154,7 @@ class MainTest(unittest.TestCase):
direction = PySide2.QtWidgets.QBoxLayout.Direction()
qWidget = PySide2.QtWidgets.QWidget()
qStyleOptionFrame = PySide2.QtWidgets.QStyleOptionFrame()
- qAction = PySide2.QtWidgets.QAction(qObject)
+ qAction = PySide2.QtGui.QAction(qObject)
renderFlags = PySide2.QtWidgets.QWidget.RenderFlags
except AttributeError:
pass
diff --git a/sources/pyside2/tests/tools/list-class-hierarchy.py b/sources/pyside2/tests/tools/list-class-hierarchy.py
index b734ae69..70075b27 100755
--- a/sources/pyside2/tests/tools/list-class-hierarchy.py
+++ b/sources/pyside2/tests/tools/list-class-hierarchy.py
@@ -87,7 +87,6 @@ if __name__=='__main__':
'QtSvg',
'QtTest',
#'QtUiTools',
- 'QtWebKit',
'QtXml',
'QtXmlPatterns' ]
diff --git a/sources/pyside2/tests/util/module_wrapper/PySide/QtWebKit.py b/sources/pyside2/tests/util/module_wrapper/PySide/QtWebKit.py
deleted file mode 100644
index bffc7996..00000000
--- a/sources/pyside2/tests/util/module_wrapper/PySide/QtWebKit.py
+++ /dev/null
@@ -1,2 +0,0 @@
-
-from PyQt4.QtWebKit import *
diff --git a/sources/shiboken2/ApiExtractor/CMakeLists.txt b/sources/shiboken2/ApiExtractor/CMakeLists.txt
index f8e50458..28644fe4 100644
--- a/sources/shiboken2/ApiExtractor/CMakeLists.txt
+++ b/sources/shiboken2/ApiExtractor/CMakeLists.txt
@@ -13,6 +13,7 @@ fileout.cpp
graph.cpp
messages.cpp
reporthandler.cpp
+sourcelocation.cpp
typeparser.cpp
typesystem.cpp
typesystemparser.cpp
diff --git a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
index b54dc70e..f9e34ba5 100644
--- a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
+++ b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
@@ -42,7 +42,6 @@
#include <QFile>
#include <QFileInfo>
#include <QRegularExpression>
-#include <QTextCodec>
#include <QTextStream>
#include <QVariant>
#include <QTime>
@@ -213,9 +212,8 @@ void AbstractMetaBuilderPrivate::checkFunctionModifications()
if (!found) {
qCWarning(lcShiboken).noquote().nospace()
- << msgNoFunctionForModification(signature,
+ << msgNoFunctionForModification(clazz, signature,
modification.originalSignature(),
- clazz->qualifiedCppName(),
possibleSignatures, functions);
}
}
@@ -554,9 +552,7 @@ void AbstractMetaBuilderPrivate::traverseDom(const FileModelItem &dom)
&& !entry->isCustom()
&& (entry->generateCode() & TypeEntry::GenerateTargetLang)
&& !AbstractMetaClass::findClass(m_metaClasses, entry)) {
- qCWarning(lcShiboken).noquote().nospace()
- << QStringLiteral("type '%1' is specified in typesystem, but not defined. This could potentially lead to compilation errors.")
- .arg(entry->qualifiedCppName());
+ qCWarning(lcShiboken, "%s", qPrintable(msgTypeNotDefined(entry)));
} else if (entry->generateCode() && entry->type() == TypeEntry::FunctionType) {
auto fte = static_cast<const FunctionTypeEntry *>(entry);
const QStringList &signatures = fte->signatures();
@@ -569,13 +565,13 @@ void AbstractMetaBuilderPrivate::traverseDom(const FileModelItem &dom)
}
}
if (!ok) {
- qCWarning(lcShiboken).noquote().nospace()
- << QStringLiteral("Global function '%1' is specified in typesystem, but not defined. This could potentially lead to compilation errors.")
- .arg(signature);
+ qCWarning(lcShiboken, "%s",
+ qPrintable(msgGlobalFunctionNotDefined(fte, signature)));
}
}
} else if (entry->isEnum() && (entry->generateCode() & TypeEntry::GenerateTargetLang)) {
- const QString name = static_cast<const EnumTypeEntry *>(entry)->targetLangQualifier();
+ auto enumEntry = static_cast<const EnumTypeEntry *>(entry);
+ const QString name = enumEntry->targetLangQualifier();
AbstractMetaClass *cls = AbstractMetaClass::findClass(m_metaClasses, name);
const bool enumFound = cls
@@ -584,9 +580,8 @@ void AbstractMetaBuilderPrivate::traverseDom(const FileModelItem &dom)
if (!enumFound) {
entry->setCodeGeneration(TypeEntry::GenerateNothing);
- qCWarning(lcShiboken).noquote().nospace()
- << QStringLiteral("enum '%1' is specified in typesystem, but not declared")
- .arg(entry->qualifiedCppName());
+ qCWarning(lcShiboken, "%s",
+ qPrintable(msgEnumNotDefined(enumEntry)));
}
}
@@ -745,8 +740,8 @@ AbstractMetaClass *AbstractMetaBuilderPrivate::traverseNamespace(const FileModel
auto type = TypeDatabase::instance()->findNamespaceType(namespaceName, namespaceItem->fileName());
if (!type) {
- qCWarning(lcShiboken).noquote().nospace()
- << QStringLiteral("namespace '%1' does not have a type entry").arg(namespaceName);
+ qCWarning(lcShiboken, "%s",
+ qPrintable(msgNamespaceNoTypeEntry(namespaceItem, namespaceName)));
return nullptr;
}
@@ -1036,6 +1031,7 @@ AbstractMetaClass *AbstractMetaBuilderPrivate::traverseClass(const FileModelItem
}
auto *metaClass = new AbstractMetaClass;
+ metaClass->setSourceLocation(classItem->sourceLocation());
metaClass->setTypeEntry(type);
if (classItem->isFinal())
@@ -1073,7 +1069,7 @@ AbstractMetaClass *AbstractMetaBuilderPrivate::traverseClass(const FileModelItem
}
metaClass->setTemplateArguments(template_args);
- parseQ_Property(metaClass, classItem->propertyDeclarations());
+ parseQ_Properties(metaClass, classItem->propertyDeclarations());
traverseEnums(classItem, metaClass, classItem->enumsDeclarations());
@@ -1189,9 +1185,8 @@ AbstractMetaField *AbstractMetaBuilderPrivate::traverseField(const VariableModel
if (!metaType) {
const QString type = TypeInfo::resolveType(fieldType, currentScope()).qualifiedName().join(colonColon());
if (cls->typeEntry()->codeGeneration() & TypeEntry::GenerateTargetLang) {
- qCWarning(lcShiboken).noquote().nospace()
- << QStringLiteral("skipping field '%1::%2' with unmatched type '%3'")
- .arg(cls->name(), fieldName, type);
+ qCWarning(lcShiboken, "%s",
+ qPrintable(msgSkippingField(field, cls->name(), type)));
}
delete metaField;
return nullptr;
@@ -1455,9 +1450,8 @@ bool AbstractMetaBuilderPrivate::setupInheritance(AbstractMetaClass *metaClass)
for (const auto &baseClassName : baseClasses) {
if (!types->isClassRejected(baseClassName)) {
if (!types->findType(baseClassName)) {
- qCWarning(lcShiboken).noquote().nospace()
- << QStringLiteral("class '%1' inherits from unknown base class '%2'")
- .arg(metaClass->name(), baseClassName);
+ qCWarning(lcShiboken, "%s",
+ qPrintable(msgUnknownBase(metaClass, baseClassName)));
return false;
}
auto baseClass = AbstractMetaClass::findClass(m_metaClasses, baseClassName);
@@ -1770,6 +1764,7 @@ AbstractMetaFunction *AbstractMetaBuilderPrivate::traverseFunction(const Functio
}
auto *metaFunction = new AbstractMetaFunction;
+ metaFunction->setSourceLocation(functionItem->sourceLocation());
if (deprecated)
*metaFunction += AbstractMetaAttributes::Deprecated;
@@ -1868,16 +1863,14 @@ AbstractMetaFunction *AbstractMetaBuilderPrivate::traverseFunction(const Functio
AbstractMetaType *metaType = translateType(arg->type(), currentClass, {}, &errorMessage);
if (!metaType) {
// If an invalid argument has a default value, simply remove it
- if (arg->defaultValue()) {
+ // unless the function is virtual (since the override in the
+ // wrapper can then not correctly be generated).
+ if (arg->defaultValue() && !functionItem->isVirtual()) {
if (!currentClass
|| (currentClass->typeEntry()->codeGeneration()
& TypeEntry::GenerateTargetLang)) {
- qCWarning(lcShiboken).noquote().nospace()
- << "Stripping argument #" << (i + 1) << " of "
- << originalQualifiedSignatureWithReturn
- << " due to unmatched type \"" << arg->type().toString()
- << "\" with default expression \""
- << arg->defaultValueExpression() << "\".";
+ qCWarning(lcShiboken, "%s",
+ qPrintable(msgStrippingArgument(functionItem, i, originalQualifiedSignatureWithReturn, arg)));
}
break;
}
@@ -1941,8 +1934,8 @@ AbstractMetaFunction *AbstractMetaBuilderPrivate::traverseFunction(const Functio
fixArgumentNames(metaFunction, functionMods);
QString errorMessage;
if (!applyArrayArgumentModifications(functionMods, metaFunction, &errorMessage)) {
- qCWarning(lcShiboken, "While traversing %s: %s",
- qPrintable(className), qPrintable(errorMessage));
+ qCWarning(lcShiboken, "%s",
+ qPrintable(msgArrayModificationFailed(functionItem, className, errorMessage)));
}
}
@@ -2789,51 +2782,77 @@ bool AbstractMetaBuilderPrivate::inheritTemplate(AbstractMetaClass *subclass,
return true;
}
-void AbstractMetaBuilderPrivate::parseQ_Property(AbstractMetaClass *metaClass,
- const QStringList &declarations)
+void AbstractMetaBuilderPrivate::parseQ_Properties(AbstractMetaClass *metaClass,
+ const QStringList &declarations)
{
const QStringList scopes = currentScope()->qualifiedName();
-
+ QString errorMessage;
for (int i = 0; i < declarations.size(); ++i) {
- const auto propertyTokens = declarations.at(i).splitRef(QLatin1Char(' '));
-
- AbstractMetaType *type = nullptr;
- for (int j = scopes.size(); j >= 0; --j) {
- QStringList qualifiedName = scopes.mid(0, j);
- qualifiedName.append(propertyTokens.at(0).toString());
- TypeInfo info;
- info.setQualifiedName(qualifiedName);
-
- type = translateType(info, metaClass);
- if (type)
- break;
+ if (auto spec = parseQ_Property(metaClass, declarations.at(i), scopes, &errorMessage)) {
+ spec->setIndex(i);
+ metaClass->addPropertySpec(spec);
+ } else {
+ QString message;
+ QTextStream str(&message);
+ str << metaClass->sourceLocation() << errorMessage;
+ qCWarning(lcShiboken, "%s", qPrintable(message));
}
+ }
+}
- if (!type) {
- qCWarning(lcShiboken).noquote().nospace()
- << QStringLiteral("Unable to decide type of property: '%1' in class '%2'")
- .arg(propertyTokens.at(0).toString(), metaClass->name());
- continue;
- }
+QPropertySpec *AbstractMetaBuilderPrivate::parseQ_Property(AbstractMetaClass *metaClass,
+ const QString &declaration,
+ const QStringList &scopes,
+ QString *errorMessage)
+{
+ errorMessage->clear();
- auto *spec = new QPropertySpec(type->typeEntry());
- spec->setName(propertyTokens.at(1).toString());
- spec->setIndex(i);
+ // Q_PROPERTY(QString objectName READ objectName WRITE setObjectName NOTIFY objectNameChanged)
- for (int pos = 2; pos + 1 < propertyTokens.size(); pos += 2) {
- if (propertyTokens.at(pos) == QLatin1String("READ"))
- spec->setRead(propertyTokens.at(pos + 1).toString());
- else if (propertyTokens.at(pos) == QLatin1String("WRITE"))
- spec->setWrite(propertyTokens.at(pos + 1).toString());
- else if (propertyTokens.at(pos) == QLatin1String("DESIGNABLE"))
- spec->setDesignable(propertyTokens.at(pos + 1).toString());
- else if (propertyTokens.at(pos) == QLatin1String("RESET"))
- spec->setReset(propertyTokens.at(pos + 1).toString());
- }
+ auto propertyTokens = declaration.splitRef(QLatin1Char(' '), Qt::SkipEmptyParts);
+ if (propertyTokens.size() < 4) {
+ *errorMessage = QLatin1String("Insufficient number of tokens");
+ return nullptr;
+ }
- metaClass->addPropertySpec(spec);
- delete type;
+ const QString typeName = propertyTokens.takeFirst().toString();
+ const QString name = propertyTokens.takeFirst().toString();
+
+ QScopedPointer<AbstractMetaType> type;
+ for (int j = scopes.size(); j >= 0 && type.isNull(); --j) {
+ QStringList qualifiedName = scopes.mid(0, j);
+ qualifiedName.append(typeName);
+ TypeInfo info;
+ info.setQualifiedName(qualifiedName);
+ type.reset(translateType(info, metaClass));