aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt1
-rw-r--r--build_scripts/config.py2
-rw-r--r--build_scripts/main.py43
-rw-r--r--build_scripts/options.py2
-rw-r--r--build_scripts/platforms/macos.py2
-rw-r--r--build_scripts/platforms/unix.py2
-rw-r--r--build_scripts/platforms/windows_desktop.py10
-rw-r--r--build_scripts/qp5_tool.py13
-rw-r--r--build_scripts/setup_runner.py6
-rw-r--r--build_scripts/utils.py2
-rw-r--r--coin/instructions/execute_build_instructions.yaml6
-rw-r--r--coin/instructions/execute_test_instructions.yaml6
-rw-r--r--coin_build_instructions.py16
-rw-r--r--coin_test_instructions.py17
-rw-r--r--dependencies.yaml4
-rw-r--r--dist/changes-1.2.3 (renamed from CHANGES.rst)0
-rw-r--r--dist/changes-5.14.2.335
-rw-r--r--examples/axcontainer/axviewer.py3
-rw-r--r--examples/corelib/threads/mandelbrot.py4
-rw-r--r--examples/corelib/tools/codecs/codecs.py250
-rw-r--r--examples/corelib/tools/settingseditor/settingseditor.py891
-rw-r--r--examples/external/matplotlib/widget_3dplot.py4
-rw-r--r--examples/external/opencv/webcam_pattern_detection.py4
-rw-r--r--examples/external/scikit/staining_colors_separation.py4
-rw-r--r--examples/multimedia/camera.py4
-rw-r--r--examples/multimedia/player.py6
-rw-r--r--examples/network/fortuneclient.py2
-rw-r--r--examples/opengl/2dpainting.py172
-rw-r--r--examples/opengl/contextinfo.py5
-rw-r--r--examples/opengl/grabber.py435
-rw-r--r--examples/opengl/hellogl.py287
-rw-r--r--examples/opengl/hellogl2.py12
-rw-r--r--examples/opengl/opengl.pyproject4
-rw-r--r--examples/opengl/overpainting.py385
-rw-r--r--examples/opengl/samplebuffers.py192
-rw-r--r--examples/quick/customitems/painteditem/main.qml114
-rw-r--r--examples/quick/customitems/painteditem/painteditem.py106
-rw-r--r--examples/quick/customitems/painteditem/painteditem.pyproject3
-rw-r--r--examples/scriptableapplication/mainwindow.cpp2
-rw-r--r--examples/webenginewidgets/tabbedbrowser/browsertabwidget.py2
-rw-r--r--examples/webenginewidgets/tabbedbrowser/downloadwidget.py6
-rw-r--r--examples/webenginewidgets/tabbedbrowser/main.py12
-rw-r--r--examples/widgetbinding/CMakeLists.txt275
-rw-r--r--examples/widgetbinding/README.md74
-rw-r--r--examples/widgetbinding/bindings.h (renamed from sources/pyside2/doc/codesnippets/webkitsnippets/qtwebkit_qwebinspector_snippet.cpp)18
-rw-r--r--examples/widgetbinding/bindings.xml (renamed from sources/pyside2/doc/codesnippets/webkitsnippets/qtwebkit_qwebview_snippet.cpp)42
-rw-r--r--examples/widgetbinding/dialog.py77
-rw-r--r--examples/widgetbinding/macros.h (renamed from sources/pyside2/doc/codesnippets/webkitsnippets/simple/main.cpp)28
-rw-r--r--examples/widgetbinding/main.py61
-rw-r--r--examples/widgetbinding/wigglywidget.cpp111
-rw-r--r--examples/widgetbinding/wigglywidget.h (renamed from sources/pyside2/doc/codesnippets/webkitsnippets/webpage/main.cpp)52
-rw-r--r--examples/widgetbinding/wigglywidget.py97
-rw-r--r--examples/widgets/animation/easing/easing.py2
-rw-r--r--examples/widgets/codeeditor/codeeditor.py2
-rw-r--r--examples/widgets/dialogs/classwizard/classwizard.py2
-rw-r--r--examples/widgets/dialogs/standarddialogs.py2
-rw-r--r--examples/widgets/gallery/widgetgallery.py4
-rw-r--r--examples/widgets/graphicsview/diagramscene/diagramscene.py24
-rw-r--r--examples/widgets/itemviews/addressbook/addressbook.py3
-rw-r--r--examples/widgets/itemviews/addressbook/addresswidget.py9
-rw-r--r--examples/widgets/mainwindows/application/application.py20
-rw-r--r--examples/widgets/mainwindows/dockwidgets/dockwidgets.py6
-rw-r--r--examples/widgets/mainwindows/mdi/mdi.py6
-rw-r--r--examples/widgets/richtext/syntaxhighlighter.py56
-rw-r--r--examples/widgets/state-machine/rogue.py5
-rw-r--r--examples/widgets/systray/window.py4
-rw-r--r--examples/widgets/widgets/hellogl_openglwidget_legacy.py288
-rw-r--r--examples/xml/dombookmarks/dombookmarks.py10
-rw-r--r--examples/xmlpatterns/schema/schema.py43
-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/webelement/main.cpp114
-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
-rw-r--r--testing/buildlog.py30
-rw-r--r--tools/dump_metaobject.py8
-rw-r--r--tools/metaobject_dump.py8
-rw-r--r--tools/missing_bindings-requirements.txt7
-rw-r--r--tools/missing_bindings.py7
358 files changed, 11897 insertions, 7590 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 595489df..d8a43604 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -20,4 +20,3 @@ add_subdirectory(sources/pyside2)
# Semi-hack to include exported pyside2 variables.
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_CURRENT_BINARY_DIR}/sources/pyside2/libpyside")
-add_subdirectory(sources/pyside2-tools)
diff --git a/build_scripts/config.py b/build_scripts/config.py
index 4ec2af3d..ae09ed8a 100644
--- a/build_scripts/config.py
+++ b/build_scripts/config.py
@@ -331,7 +331,7 @@ class Config(object):
if self.is_internal_shiboken_module_build() or self.is_internal_shiboken_generator_build():
return ['shiboken2']
elif self.is_internal_pyside_build():
- return ['pyside2', 'pyside2-tools']
+ return ['pyside2']
return None
def set_is_top_level_invocation(self):
diff --git a/build_scripts/main.py b/build_scripts/main.py
index 55cc6a88..a771e2d3 100644
--- a/build_scripts/main.py
+++ b/build_scripts/main.py
@@ -356,7 +356,7 @@ class PysideInstall(_install):
def run(self):
_install.run(self)
- print('*** Install completed ({}s)'.format(elapsed()))
+ print('--- Install completed ({}s)'.format(elapsed()))
class PysideDevelop(_develop):
@@ -737,7 +737,7 @@ class PysideBuild(_build):
_build.run(self)
else:
log.info("Skipped preparing and building packages.")
- print('*** Build completed ({}s)'.format(elapsed()))
+ print('--- Build completed ({}s)'.format(elapsed()))
def log_pre_build_info(self):
if config.is_internal_shiboken_generator_build_and_part_of_top_level_all():
@@ -748,16 +748,16 @@ class PysideBuild(_build):
setuptools_install_prefix = OPTION["FINAL_INSTALL_PREFIX"]
log.info("=" * 30)
log.info("Package version: {}".format(get_package_version()))
- log.info("Build type: {}".format(self.build_type))
+ log.info("Build type: {}".format(self.build_type))
log.info("Build tests: {}".format(self.build_tests))
log.info("-" * 3)
- log.info("Make path: {}".format(self.make_path))
+ log.info("Make path: {}".format(self.make_path))
log.info("Make generator: {}".format(self.make_generator))
- log.info("Make jobs: {}".format(OPTION["JOBS"]))
+ log.info("Make jobs: {}".format(OPTION["JOBS"]))
log.info("-" * 3)
- log.info("setup.py directory: {}".format(self.script_dir))
+ log.info("setup.py directory: {}".format(self.script_dir))
log.info("Build scripts directory: {}".format(build_scripts_dir))
- log.info("Sources directory: {}".format(self.sources_dir))
+ log.info("Sources directory: {}".format(self.sources_dir))
log.info(dedent("""
Building {st_package_name} will create and touch directories
in the following order:
@@ -767,9 +767,9 @@ class PysideBuild(_build):
setuptools install directory
(usually path-installed-python/lib/python*/site-packages/*)
""").format(st_package_name=config.package_name()))
- log.info("make build directory: {}".format(self.build_dir))
+ log.info("make build directory: {}".format(self.build_dir))
log.info("make install directory: {}".format(self.install_dir))
- log.info("setuptools build directory: {}".format(self.st_build_dir))
+ log.info("setuptools build directory: {}".format(self.st_build_dir))
log.info("setuptools install directory: {}".format(setuptools_install_prefix))
log.info(dedent("""
make-installed site-packages directory: {}
@@ -779,15 +779,15 @@ class PysideBuild(_build):
self.site_packages_dir))
log.info("-" * 3)
log.info("Python executable: {}".format(self.py_executable))
- log.info("Python includes: {}".format(self.py_include_dir))
- log.info("Python library: {}".format(self.py_library))
- log.info("Python prefix: {}".format(self.py_prefix))
- log.info("Python scripts: {}".format(self.py_scripts_dir))
+ log.info("Python includes: {}".format(self.py_include_dir))
+ log.info("Python library: {}".format(self.py_library))
+ log.info("Python prefix: {}".format(self.py_prefix))
+ log.info("Python scripts: {}".format(self.py_scripts_dir))
log.info("-" * 3)
- log.info("Qt qmake: {}".format(self.qtinfo.qmake_command))
+ log.info("Qt qmake: {}".format(self.qtinfo.qmake_command))
log.info("Qt version: {}".format(self.qtinfo.version))
- log.info("Qt bins: {}".format(self.qtinfo.bins_dir))
- log.info("Qt docs: {}".format(self.qtinfo.docs_dir))
+ log.info("Qt bins: {}".format(self.qtinfo.bins_dir))
+ log.info("Qt docs: {}".format(self.qtinfo.docs_dir))
log.info("Qt plugins: {}".format(self.qtinfo.plugins_dir))
log.info("-" * 3)
if sys.platform == 'win32':
@@ -1015,7 +1015,7 @@ class PysideBuild(_build):
timestamp = get_package_timestamp()
cmake_cmd.append("-DPACKAGE_SETUP_PY_PACKAGE_TIMESTAMP={}".format(timestamp))
- if extension.lower() in ["shiboken2", "pyside2-tools"]:
+ if extension.lower() in ["shiboken2"]:
cmake_cmd.append("-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=yes")
if sys.version_info[0] > 2:
cmake_cmd.append("-DUSE_PYTHON_VERSION=3.3")
@@ -1059,6 +1059,13 @@ class PysideBuild(_build):
cmake_cmd.append("-DCMAKE_OSX_DEPLOYMENT_TARGET={}".format(deployment_target))
os.environ['MACOSX_DEPLOYMENT_TARGET'] = deployment_target
+ if OPTION["DOC_BUILD_ONLINE"]:
+ log.info("Output format will be HTML")
+ cmake_cmd.append("-DDOC_OUTPUT_FORMAT=html")
+ else:
+ log.info("Output format will be qthelp")
+ cmake_cmd.append("-DDOC_OUTPUT_FORMAT=qthelp")
+
if not OPTION["SKIP_CMAKE"]:
log.info("Configuring module {} ({})...".format(extension, module_src_dir))
if run_process(cmake_cmd) != 0:
@@ -1067,7 +1074,7 @@ class PysideBuild(_build):
log.info("Reusing old configuration for module {} ({})...".format(
extension, module_src_dir))
- log.info("Compiling module {}...".format(extension))
+ log.info("-- Compiling module {}...".format(extension))
cmd_make = [self.make_path]
if OPTION["JOBS"]:
cmd_make.append(OPTION["JOBS"])
diff --git a/build_scripts/options.py b/build_scripts/options.py
index 4229a2c1..db2a7e36 100644
--- a/build_scripts/options.py
+++ b/build_scripts/options.py
@@ -182,6 +182,8 @@ OPTION = {
# This is used automatically by distutils.command.install object, to
# specify the final installation location.
"FINAL_INSTALL_PREFIX": option_value("prefix", remove=False),
+ # This is used to identify the template for doc builds
+ "DOC_BUILD_ONLINE": has_option("doc-build-online"),
}
_deprecated_option_jobs = option_value('jobs')
if _deprecated_option_jobs:
diff --git a/build_scripts/platforms/macos.py b/build_scripts/platforms/macos.py
index 7932db33..614d6acb 100644
--- a/build_scripts/platforms/macos.py
+++ b/build_scripts/platforms/macos.py
@@ -140,8 +140,6 @@ def prepare_standalone_package_macos(self, vars):
ignored_modules = []
if not self.is_webengine_built(built_modules):
ignored_modules.extend(['libQt5WebEngine*.dylib'])
- if 'WebKit' not in built_modules:
- ignored_modules.extend(['libQt5WebKit*.dylib'])
accepted_modules = ['libQt5*.5.dylib']
if constrain_modules:
accepted_modules = ["libQt5" + module + "*.5.dylib" for module in constrain_modules]
diff --git a/build_scripts/platforms/unix.py b/build_scripts/platforms/unix.py
index b842510f..754cdc96 100644
--- a/build_scripts/platforms/unix.py
+++ b/build_scripts/platforms/unix.py
@@ -204,7 +204,7 @@ def prepare_packages_posix(self, vars):
# compatibility
if sys.version_info[0] == 3:
examples_path = "{st_build_dir}/{st_package_name}/examples".format(**vars)
- pyside_rcc_path = "{install_dir}/bin/rcc".format(**vars)
+ pyside_rcc_path = "rcc"
pyside_rcc_options = ['-g', 'python']
regenerate_qt_resources(examples_path, pyside_rcc_path, pyside_rcc_options)
diff --git a/build_scripts/platforms/windows_desktop.py b/build_scripts/platforms/windows_desktop.py
index 750a064b..f8a776b8 100644
--- a/build_scripts/platforms/windows_desktop.py
+++ b/build_scripts/platforms/windows_desktop.py
@@ -220,8 +220,7 @@ def prepare_packages_win32(self, vars):
if sys.version_info[0] == 3:
examples_path = "{st_build_dir}/{st_package_name}/examples".format(
**vars)
- pyside_rcc_path = "{install_dir}/bin/rcc.exe".format(
- **vars)
+ pyside_rcc_path = "rcc.exe"
pyside_rcc_options = ['-g', 'python']
regenerate_qt_resources(examples_path, pyside_rcc_path, pyside_rcc_options)
@@ -251,7 +250,8 @@ def copy_msvc_redist_files(vars, redist_target_path):
"vcamp140.dll",
"vccorlib140.dll",
"vcomp140.dll",
- "vcruntime140.dll"
+ "vcruntime140.dll",
+ "vcruntime140_1.dll"
]
# Make a directory where the files should be extracted.
@@ -262,9 +262,9 @@ def copy_msvc_redist_files(vars, redist_target_path):
in_coin = os.environ.get('COIN_LAUNCH_PARAMETERS', None)
if in_coin is not None:
redist_url = "http://download.qt.io/development_releases/prebuilt/vcredist/"
- zip_file = "pyside_qt_deps_64.7z"
+ zip_file = "pyside_qt_deps_64_2019.7z"
if "{target_arch}".format(**vars) == "32":
- zip_file = "pyside_qt_deps_32.7z"
+ zip_file = "pyside_qt_deps_32_2019.7z"
download_and_extract_7z(redist_url + zip_file, redist_target_path)
else:
print("Qt dependency DLLs (MSVC redist) will not be downloaded and extracted.")
diff --git a/build_scripts/qp5_tool.py b/build_scripts/qp5_tool.py
index 9fc37a99..b023fc58 100644
--- a/build_scripts/qp5_tool.py
+++ b/build_scripts/qp5_tool.py
@@ -68,6 +68,8 @@ Modules-pyside-setup512=Core,Gui,Widgets,Network,Test
Configuration keys:
Acceleration Incredibuild or unset
BuildArguments Arguments to setup.py
+Generator Generator to be used for CMake. Currently, only Ninja is
+ supported.
Jobs Number of jobs to be run simultaneously
Modules Comma separated list of modules to be built
(for --module-subset=)
@@ -99,6 +101,7 @@ INCREDIBUILD_CONSOLE = 'BuildConsole' if IS_WINDOWS else '/opt/incredibuild/bin/
# Config file keys
ACCELERATION_KEY = 'Acceleration'
BUILDARGUMENTS_KEY = 'BuildArguments'
+GENERATOR_KEY = 'Generator'
JOBS_KEY = 'Jobs'
MODULES_KEY = 'Modules'
PYTHON_KEY = 'Python'
@@ -208,9 +211,10 @@ def read_config_file(file_name):
keyPattern = re.compile(r'^\s*([A-Za-z0-9\_\-]+)\s*=\s*(.*)$')
with open(file_name) as f:
while True:
- line = f.readline().rstrip()
+ line = f.readline()
if not line:
break
+ line = line.rstrip()
match = keyPattern.match(line)
if match:
key = match.group(1)
@@ -304,6 +308,9 @@ def build(target):
arguments.append('--avoid') # caching, v0.96.74
arguments.extend([read_config_python_binary(), 'setup.py', target])
arguments.extend(read_config_build_arguments())
+ generator = read_config(GENERATOR_KEY)
+ if generator == 'Ninja':
+ arguments.extend(['--make-spec', 'ninja'])
jobs = read_int_config(JOBS_KEY)
if jobs > 1:
arguments.extend(['-j', str(jobs)])
@@ -388,8 +395,8 @@ if __name__ == '__main__':
argument_parser.print_help()
sys.exit(0)
- git = which('git')
- if git is None:
+ git = 'git'
+ if which(git) is None:
warnings.warn('Unable to find git', RuntimeWarning)
sys.exit(-1)
diff --git a/build_scripts/setup_runner.py b/build_scripts/setup_runner.py
index 1a7317e4..b5b55fa2 100644
--- a/build_scripts/setup_runner.py
+++ b/build_scripts/setup_runner.py
@@ -41,6 +41,8 @@ import sys
import os
import textwrap
+import distutils.log as log
+
from build_scripts.config import config
from build_scripts.main import get_package_version, get_setuptools_extension_modules
from build_scripts.main import cmd_class_dict
@@ -49,6 +51,8 @@ from build_scripts.utils import run_process
from setuptools import setup
+if OPTION["VERBOSE_BUILD"]:
+ log.set_verbosity(1)
class SetupRunner(object):
def __init__(self, orig_argv):
@@ -148,7 +152,7 @@ class SetupRunner(object):
for cmd in self.invocations_list:
cmd_as_string = " ".join(cmd)
- print("\nRunning process: {}\n".format(cmd_as_string))
+ log.info("\nRunning setup: {}\n".format(cmd_as_string))
exit_code = run_process(cmd)
if exit_code != 0:
msg = textwrap.dedent("""
diff --git a/build_scripts/utils.py b/build_scripts/utils.py
index d1bc780d..9f6d472c 100644
--- a/build_scripts/utils.py
+++ b/build_scripts/utils.py
@@ -388,7 +388,7 @@ def run_process(args, initial_env=None):
No output is captured.
"""
command = " ".join([(" " in x and '"{}"'.format(x) or x) for x in args])
- log.info("Running process in directory {}: command {}".format(os.getcwd(), command))
+ log.info("In directory {}:\n\tRunning command: {}".format(os.getcwd(), command))
if initial_env is None:
initial_env = os.environ
diff --git a/coin/instructions/execute_build_instructions.yaml b/coin/instructions/execute_build_instructions.yaml
index 831783a7..1a0c7306 100644
--- a/coin/instructions/execute_build_instructions.yaml
+++ b/coin/instructions/execute_build_instructions.yaml
@@ -3,7 +3,7 @@ instructions:
- type: ExecuteCommand
command: "python -u coin_build_instructions.py --os={{.Env.CI_OS}} {{.Env.CI_PACKAGING_FEATURE}} --instdir=/Users/qt/work/install --targetOs={{.Env.CI_OS}} --hostArch=X86_64 --targetArch={{.Env.CI_TARGET_ARCHITECTURE}} --phase=ALL"
maxTimeInSeconds: 14400
- maxTimeBetweenOutput: 300
+ maxTimeBetweenOutput: 1200
enable_if:
condition: property
property: host.os
@@ -13,7 +13,7 @@ instructions:
- type: ExecuteCommand
command: "python -u coin_build_instructions.py --os={{.Env.CI_OS}} {{.Env.CI_PACKAGING_FEATURE}} --instdir=/home/qt/work/install --targetOs={{.Env.CI_OS}} --hostArch=X86_64 --targetArch={{.Env.CI_TARGET_ARCHITECTURE}} --phase=ALL"
maxTimeInSeconds: 14400
- maxTimeBetweenOutput: 300
+ maxTimeBetweenOutput: 600
enable_if:
condition: property
property: host.os
@@ -23,7 +23,7 @@ instructions:
- type: ExecuteCommand
command: "c:\\users\\qt\\MSVC.bat python -u coin_build_instructions.py --os={{.Env.CI_OS}} {{.Env.CI_PACKAGING_FEATURE}} --instdir=\\Users\\qt\\work\\install --targetOs={{.Env.CI_OS}} --hostArch=X86_64 --targetArch={{.Env.CI_TARGET_ARCHITECTURE}} --phase=BUILD"
maxTimeInSeconds: 14400
- maxTimeBetweenOutput: 300
+ maxTimeBetweenOutput: 600
enable_if:
condition: property
property: host.os
diff --git a/coin/instructions/execute_test_instructions.yaml b/coin/instructions/execute_test_instructions.yaml
index 87abb476..22a98066 100644
--- a/coin/instructions/execute_test_instructions.yaml
+++ b/coin/instructions/execute_test_instructions.yaml
@@ -10,7 +10,7 @@ instructions:
- type: ExecuteCommand
command: "python -u coin_test_instructions.py --os={{.Env.CI_OS}} {{.Env.CI_PACKAGING_FEATURE}} --instdir=/Users/qt/work/install --targetOs={{.Env.CI_OS}} --hostArch=X86_64 --targetArch={{.Env.CI_TARGET_ARCHITECTURE}}"
maxTimeInSeconds: 14400
- maxTimeBetweenOutput: 300
+ maxTimeBetweenOutput: 1200
enable_if:
condition: property
property: host.os
@@ -20,7 +20,7 @@ instructions:
- type: ExecuteCommand
command: "python -u coin_test_instructions.py --os={{.Env.CI_OS}} {{.Env.CI_PACKAGING_FEATURE}} --instdir=/home/qt/work/install --targetOs={{.Env.CI_OS}} --hostArch=X86_64 --targetArch={{.Env.CI_TARGET_ARCHITECTURE}}"
maxTimeInSeconds: 14400
- maxTimeBetweenOutput: 300
+ maxTimeBetweenOutput: 600
enable_if:
condition: property
property: host.os
@@ -30,7 +30,7 @@ instructions:
- type: ExecuteCommand
command: "c:\\users\\qt\\MSVC.bat python -u coin_test_instructions.py --os={{.Env.CI_OS}} {{.Env.CI_PACKAGING_FEATURE}} --instdir=\\Users\\qt\\work\\install --targetOs={{.Env.CI_OS}} --hostArch=X86_64 --targetArch={{.Env.CI_TARGET_ARCHITECTURE}}"
maxTimeInSeconds: 14400
- maxTimeBetweenOutput: 300
+ maxTimeBetweenOutput: 600
enable_if:
condition: property
property: host.os
diff --git a/coin_build_instructions.py b/coin_build_instructions.py
index bfb10410..4f006612 100644
--- a/coin_build_instructions.py
+++ b/coin_build_instructions.py
@@ -47,6 +47,8 @@ from build_scripts.utils import get_ci_qmake_path
import os
import datetime
import calendar
+import site
+import sys
# Values must match COIN thrift
CI_HOST_OS = option_value("os")
@@ -110,8 +112,18 @@ def call_setup(python_ver, phase):
if phase in ["BUILD"]:
rmtree(_env, True)
# Pinning the virtualenv before creating one
- run_instruction(["pip", "install", "--user", "virtualenv==20.0.20"], "Failed to pin virtualenv")
- run_instruction(["virtualenv", "-p", _pExe, _env], "Failed to create virtualenv")
+ run_instruction(["pip", "install", "--user", "virtualenv==20.0.25"], "Failed to pin virtualenv")
+ # installing to user base might not be in PATH by default.
+ env_path = os.path.join(site.USER_BASE, "bin")
+ v_env = os.path.join(env_path, "virtualenv")
+ if sys.platform == "win32":
+ env_path = os.path.join(site.USER_BASE, "Scripts")
+ v_env = os.path.join(env_path, "virtualenv.exe")
+ try:
+ run_instruction([v_env, "--version"], "Using default virtualenv")
+ except Exception as e:
+ v_env = "virtualenv"
+ run_instruction([v_env, "-p", _pExe, _env], "Failed to create virtualenv")
# When the 'python_ver' variable is empty, we are using Python 2
# Pip is always upgraded when CI template is provisioned, upgrading it in later phase may cause perm issue
run_instruction([env_pip, "install", "-r", "requirements.txt"], "Failed to install dependencies")
diff --git a/coin_test_instructions.py b/coin_test_instructions.py
index c3752cb9..16ba601f 100644
--- a/coin_test_instructions.py
+++ b/coin_test_instructions.py
@@ -44,6 +44,8 @@ from build_scripts.utils import run_instruction
from build_scripts.utils import rmtree
from build_scripts.utils import get_ci_qmake_path
import os
+import site
+import sys
# Values must match COIN thrift
CI_HOST_OS = option_value("os")
@@ -65,8 +67,19 @@ def call_testrunner(python_ver, buildnro):
_pExe, _env, env_pip, env_python = get_qtci_virtualEnv(python_ver, CI_HOST_OS, CI_HOST_ARCH, CI_TARGET_ARCH)
rmtree(_env, True)
# Pinning the virtualenv before creating one
- run_instruction(["pip", "install", "--user", "virtualenv==20.0.20"], "Failed to pin virtualenv")
- run_instruction(["virtualenv", "-p", _pExe, _env], "Failed to create virtualenv")
+ run_instruction(["pip", "install", "--user", "virtualenv==20.0.25"], "Failed to pin virtualenv")
+ # installing to user base might not be in PATH by default.
+ env_path = os.path.join(site.USER_BASE, "bin")
+ v_env = os.path.join(env_path, "virtualenv")
+ if sys.platform == "win32":
+ env_path = os.path.join(site.USER_BASE, "Scripts")
+ v_env = os.path.join(env_path, "virtualenv.exe")
+ try:
+ run_instruction([v_env, "--version"], "Using default virtualenv")
+ except Exception as e:
+ v_env = "virtualenv"
+
+ run_instruction([v_env, "-p", _pExe, _env], "Failed to create virtualenv")
# When the 'python_ver' variable is empty, we are using Python 2
# Pip is always upgraded when CI template is provisioned, upgrading it in later phase may cause perm issue
run_instruction([env_pip, "install", "-r", "requirements.txt"], "Failed to install dependencies")
diff --git a/dependencies.yaml b/dependencies.yaml
new file mode 100644
index 00000000..61a9c977
--- /dev/null
+++ b/dependencies.yaml
@@ -0,0 +1,4 @@
+dependencies:
+ ../../qt/qtdeclarative:
+ ref: 3debb37250b2c57aaaf81940f9dfeb540fd4e380
+ required: true
diff --git a/CHANGES.rst b/dist/changes-1.2.3
index 7deaa8bd..7deaa8bd 100644
--- a/CHANGES.rst
+++ b/dist/changes-1.2.3
diff --git a/dist/changes-5.14.2.3 b/dist/changes-5.14.2.3
new file mode 100644
index 00000000..6f17bc4b
--- /dev/null
+++ b/dist/changes-5.14.2.3
@@ -0,0 +1,35 @@
+Qt for Python 5.14.2.3 is a bug-fix release.
+
+For more details, refer to the online documentation included in this
+distribution. The documentation is also available online:
+
+https://doc.qt.io/qtforpython/
+
+Some of the changes listed in this file include issue tracking numbers
+corresponding to tasks in the Qt Bug Tracker:
+
+https://bugreports.qt.io/
+
+Each of these identifiers can be entered in the bug tracker to obtain more
+information about a particular change.
+
+****************************************************************************
+* PySide2 *
+****************************************************************************
+
+ - [PYSIDE-1223] pyside2-uic instead of uic is not used for loadUiType()
+ - [PYSIDE-1257] Deployment with cx_freeze using zip_include_packages has
+ been fixed
+ - [PYSIDE-1282] A crash using QThread.terminate() on pthreads has
+ been fixed
+ - [PYSIDE-1311] The downloads functionality of the Tabbedbrowser example
+ has been fixed
+ - [PYSIDE-1321] A leaking reference in the PySide2 property getter has
+ been fixed
+
+****************************************************************************
+* Shiboken2 *
+****************************************************************************
+
+ - [PYSIDE-1325] Wrong generated code for default-initialized function
+ arguments ({}) has been fixed
diff --git a/examples/axcontainer/axviewer.py b/examples/axcontainer/axviewer.py
index e9083d8f..50e50ee1 100644
--- a/examples/axcontainer/axviewer.py
+++ b/examples/axcontainer/axviewer.py
@@ -43,7 +43,8 @@
import sys
from PySide2.QtAxContainer import QAxSelect, QAxWidget
-from PySide2.QtWidgets import (QAction, QApplication, QDialog,
+from PySide2.QtGui import QAction
+from PySide2.QtWidgets import (QApplication, QDialog,
QMainWindow, QMessageBox, QToolBar)
class MainWindow(QMainWindow):
diff --git a/examples/corelib/threads/mandelbrot.py b/examples/corelib/threads/mandelbrot.py
index f0d13dbf..c0ca70d6 100644
--- a/examples/corelib/threads/mandelbrot.py
+++ b/examples/corelib/threads/mandelbrot.py
@@ -251,7 +251,7 @@ class MandelbrotWidget(QWidget):
painter.save()
painter.translate(newX, newY)
painter.scale(scaleFactor, scaleFactor)
- exposed, _ = painter.matrix().inverted()
+ exposed, _ = painter.transform().inverted()
exposed = exposed.mapRect(self.rect()).adjusted(-1, -1, 1, 1)
painter.drawPixmap(exposed, self.pixmap, exposed)
painter.restore()
@@ -259,7 +259,7 @@ class MandelbrotWidget(QWidget):
text = "Use mouse wheel or the '+' and '-' keys to zoom. Press and " \
"hold left mouse button to scroll."
metrics = painter.fontMetrics()
- textWidth = metrics.width(text)
+ textWidth = metrics.horizontalAdvance(text)
painter.setPen(Qt.NoPen)
painter.setBrush(QColor(0, 0, 0, 127))
diff --git a/examples/corelib/tools/codecs/codecs.py b/examples/corelib/tools/codecs/codecs.py
deleted file mode 100644
index a3c063c0..00000000
--- a/examples/corelib/tools/codecs/codecs.py
+++ /dev/null
@@ -1,250 +0,0 @@
-
-#############################################################################
-##
-## Copyright (C) 2013 Riverbank Computing Limited.
-## Copyright (C) 2016 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$
-##
-#############################################################################
-
-"""PySide2 port of the widgets/tools/codecs example from Qt v5.x"""
-
-from PySide2 import QtCore, QtWidgets
-
-
-def codec_name(codec):
- try:
- # Python v3.
- name = str(codec.name(), encoding='ascii')
- except TypeError:
- # Python v2.
- name = str(codec.name())
-
- return name
-
-
-class MainWindow(QtWidgets.QMainWindow):
- def __init__(self):
- super(MainWindow, self).__init__()
-
- self.textEdit = QtWidgets.QTextEdit()
- self.textEdit.setLineWrapMode(QtWidgets.QTextEdit.NoWrap)
- self.setCentralWidget(self.textEdit)
-
- self.codecs = []
- self.findCodecs()
-
- self.previewForm = PreviewForm(self)
- self.previewForm.setCodecList(self.codecs)
-
- self.saveAsActs = []
- self.createActions()
- self.createMenus()
-
- self.setWindowTitle("Codecs")
- self.resize(500, 400)
-
- def open(self):
- fileName, _ = QtWidgets.QFileDialog.getOpenFileName(self)
- if fileName:
- inFile = QtCore.QFile(fileName)
- if not inFile.open(QtCore.QFile.ReadOnly):
- QtWidgets.QMessageBox.warning(self, "Codecs",
- "Cannot read file %s:\n%s" % (fileName, inFile.errorString()))
- return
-
- data = inFile.readAll()
-
- self.previewForm.setEncodedData(data)
- if self.previewForm.exec_():
- self.textEdit.setPlainText(self.previewForm.decodedString())
-
- def save(self):
- fileName = QtWidgets.QFileDialog.getSaveFileName(self)
- if fileName:
- outFile = QtCore.QFile(fileName)
- if not outFile.open(QtCore.QFile.WriteOnly|QtCore.QFile.Text):
- QtWidgets.QMessageBox.warning(self, "Codecs",
- "Cannot write file %s:\n%s" % (fileName, outFile.errorString()))
- return
-
- action = self.sender()
- codecName = action.data()
-
- out = QtCore.QTextStream(outFile)
- out.setCodec(codecName)
- out << self.textEdit.toPlainText()
-
- def about(self):
- QtWidgets.QMessageBox.about(self, "About Codecs",
- "The <b>Codecs</b> example demonstrates how to read and "
- "write files using various encodings.")
-
- def aboutToShowSaveAsMenu(self):
- currentText = self.textEdit.toPlainText()
-
- for action in self.saveAsActs:
- codecName = str(action.data())
- codec = QtCore.QTextCodec.codecForName(codecName)
- action.setVisible(codec and codec.canEncode(currentText))
-
- def findCodecs(self):
- codecMap = []
- iso8859RegExp = QtCore.QRegExp('ISO[- ]8859-([0-9]+).*')
-
- for mib in QtCore.QTextCodec.availableMibs():
- codec = QtCore.QTextCodec.codecForMib(mib)
- sortKey = codec_name(codec).upper()
- rank = 0
-
- if sortKey.startswith('UTF-8'):
- rank = 1
- elif sortKey.startswith('UTF-16'):
- rank = 2
- elif iso8859RegExp.exactMatch(sortKey):
- if len(iso8859RegExp.cap(1)) == 1:
- rank = 3
- else:
- rank = 4
- else:
- rank = 5
-
- codecMap.append((str(rank) + sortKey, codec))
-
- codecMap.sort()
- self.codecs = [item[-1] for item in codecMap]
-
- def createActions(self):
- self.openAct = QtWidgets.QAction("&Open...", self, shortcut="Ctrl+O",
- triggered=self.open)
-
- for codec in self.codecs:
- name = codec_name(codec)
-
- action = QtWidgets.QAction(name + '...', self, triggered=self.save)
- action.setData(name)
- self.saveAsActs.append(action)
-
- self.exitAct = QtWidgets.QAction("E&xit", self, shortcut="Ctrl+Q",
- triggered=self.close)
-
- self.aboutAct = QtWidgets.QAction("&About", self, triggered=self.about)
-
- self.aboutQtAct = QtWidgets.QAction("About &Qt", self,
- triggered=qApp.aboutQt)
-
- def createMenus(self):
- self.saveAsMenu = QtWidgets.QMenu("&Save As", self)
- for action in self.saveAsActs:
- self.saveAsMenu.addAction(action)
-
- self.saveAsMenu.aboutToShow.connect(self.aboutToShowSaveAsMenu)
-
- self.fileMenu = QtWidgets.QMenu("&File", self)
- self.fileMenu.addAction(self.openAct)
- self.fileMenu.addMenu(self.saveAsMenu)
- self.fileMenu.addSeparator()
- self.fileMenu.addAction(self.exitAct)
-
- self.helpMenu = QtWidgets.QMenu("&Help", self)
- self.helpMenu.addAction(self.aboutAct)
- self.helpMenu.addAction(self.aboutQtAct)
-
- self.menuBar().addMenu(self.fileMenu)
- self.menuBar().addSeparator()
- self.menuBar().addMenu(self.helpMenu)
-
-
-class PreviewForm(QtWidgets.QDialog):
- def __init__(self, parent):
- super(PreviewForm, self).__init__(parent)
-
- self.encodingComboBox = QtWidgets.QComboBox()
- encodingLabel = QtWidgets.QLabel("&Encoding:")
- encodingLabel.setBuddy(self.encodingComboBox)
-
- self.textEdit = QtWidgets.QTextEdit()
- self.textEdit.setLineWrapMode(QtWidgets.QTextEdit.NoWrap)
- self.textEdit.setReadOnly(True)
-
- buttonBox = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel)
-
- self.encodingComboBox.activated.connect(self.updateTextEdit)
- buttonBox.accepted.connect(self.accept)
- buttonBox.rejected.connect(self.reject)
-
- mainLayout = QtWidgets.QGridLayout()
- mainLayout.addWidget(encodingLabel, 0, 0)
- mainLayout.addWidget(self.encodingComboBox, 0, 1)
- mainLayout.addWidget(self.textEdit, 1, 0, 1, 2)
- mainLayout.addWidget(buttonBox, 2, 0, 1, 2)
- self.setLayout(mainLayout)
-
- self.setWindowTitle("Choose Encoding")
- self.resize(400, 300)
-
- def setCodecList(self, codecs):
- self.encodingComboBox.clear()
- for codec in codecs:
- self.encodingComboBox.addItem(codec_name(codec), codec.mibEnum())
-
- def setEncodedData(self, data):
- self.encodedData = data
- self.updateTextEdit()
-
- def decodedString(self):
- return self.decodedStr
-
- def updateTextEdit(self):
- mib = self.encodingComboBox.itemData(self.encodingComboBox.currentIndex())
- codec = QtCore.QTextCodec.codecForMib(mib)
-
- data = QtCore.QTextStream(self.encodedData)
- data.setAutoDetectUnicode(False)
- data.setCodec(codec)
-
- self.decodedStr = data.readAll()
- self.textEdit.setPlainText(self.decodedStr)
-
-
-if __name__ == '__main__':
-
- import sys
-
- app = QtWidgets.QApplication(sys.argv)
- mainWin = MainWindow()
- mainWin.show()
- sys.exit(app.exec_())
diff --git a/examples/corelib/tools/settingseditor/settingseditor.py b/examples/corelib/tools/settingseditor/settingseditor.py
index 4cd26256..121d7cb0 100644
--- a/examples/corelib/tools/settingseditor/settingseditor.py
+++ b/examples/corelib/tools/settingseditor/settingseditor.py
@@ -1,8 +1,9 @@
+# -*- coding: utf-8 -*-
#############################################################################
##
## Copyright (C) 2013 Riverbank Computing Limited.
-## Copyright (C) 2016 The Qt Company Ltd.
+## 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.
@@ -44,260 +45,389 @@
import sys
-from PySide2 import QtCore, QtGui, QtWidgets
+from PySide2.QtCore import (QByteArray, QDate, QDateTime, QDir, QEvent, QPoint,
+ QRect, QRegularExpression, QSettings, QSize, QTime, QTimer, Qt)
+from PySide2.QtGui import (QAction, QColor, QIcon, QIntValidator,
+ QDoubleValidator, QRegularExpressionValidator, QValidator)
+from PySide2.QtWidgets import (QAbstractItemView, QApplication,
+ QCheckBox, QComboBox, QFileDialog, QDialog, QDialogButtonBox, QGridLayout,
+ QGroupBox, QHeaderView, QInputDialog, QItemDelegate, QLabel, QLineEdit,
+ QMainWindow, QMessageBox, QStyle, QSpinBox, QStyleOptionViewItem,
+ QTableWidget, QTableWidgetItem, QTreeWidget, QTreeWidgetItem, QVBoxLayout)
-class MainWindow(QtWidgets.QMainWindow):
+class TypeChecker:
+ def __init__(self, parent=None):
+ self.bool_exp = QRegularExpression('^(true)|(false)$')
+ assert self.bool_exp.isValid()
+ self.bool_exp.setPatternOptions(QRegularExpression.CaseInsensitiveOption)
+
+ self.byteArray_exp = QRegularExpression(r'^[\x00-\xff]*$')
+ assert self.byteArray_exp.isValid()
+
+ self.char_exp = QRegularExpression('^.$')
+ assert self.char_exp.isValid()
+
+ pattern = r'^[+-]?\d+$'
+ self.int_exp = QRegularExpression(pattern)
+ assert self.int_exp.isValid()
+
+ pattern = r'^\(([0-9]*),([0-9]*),([0-9]*),([0-9]*)\)$'
+ self.color_exp = QRegularExpression(pattern)
+ assert self.color_exp.isValid()
+
+ pattern = r'^\((-?[0-9]*),(-?[0-9]*)\)$'
+ self.point_exp = QRegularExpression(pattern)
+ assert self.point_exp.isValid()
+
+ pattern = r'^\((-?[0-9]*),(-?[0-9]*),(-?[0-9]*),(-?[0-9]*)\)$'
+ self.rect_exp = QRegularExpression(pattern)
+ assert self.rect_exp.isValid()
+
+ self.size_exp = QRegularExpression(self.point_exp)
+
+ date_pattern = '([0-9]{,4})-([0-9]{,2})-([0-9]{,2})'
+ self.date_exp = QRegularExpression('^{}$'.format(date_pattern))
+ assert self.date_exp.isValid()
+
+ time_pattern = '([0-9]{,2}):([0-9]{,2}):([0-9]{,2})'
+ self.time_exp = QRegularExpression('^{}$'.format(time_pattern))
+ assert self.time_exp.isValid()
+
+ pattern = '^{}T{}$'.format(date_pattern, time_pattern)
+ self.dateTime_exp = QRegularExpression(pattern)
+ assert self.dateTime_exp.isValid()
+
+ def type_from_text(self, text):
+ if self.bool_exp.match(text).hasMatch():
+ return bool
+ if self.int_exp.match(text).hasMatch():
+ return int
+ return None
+
+ def create_validator(self, value, parent):
+ if isinstance(value, bool):
+ return QRegularExpressionValidator(self.bool_exp, parent)
+ if isinstance(value, float):
+ return QDoubleValidator(parent)
+ if isinstance(value, int):
+ return QIntValidator(parent)
+ if isinstance(value, QByteArray):
+ return QRegularExpressionValidator(self.byteArray_exp, parent)
+ if isinstance(value, QColor):
+ return QRegularExpressionValidator(self.color_exp, parent)
+ if isinstance(value, QDate):
+ return QRegularExpressionValidator(self.date_exp, parent)
+ if isinstance(value, QDateTime):
+ return QRegularExpressionValidator(self.dateTime_exp, parent)
+ if isinstance(value, QTime):
+ return QRegularExpressionValidator(self.time_exp, parent)
+ if isinstance(value, QPoint):
+ return QRegularExpressionValidator(self.point_exp, parent)
+ if isinstance(value, QRect):
+ return QRegularExpressionValidator(self.rect_exp, parent)
+ if isinstance(value, QSize):
+ return QRegularExpressionValidator(self.size_exp, parent)
+ return None
+
+ def from_string(self, text, original_value):
+ if isinstance(original_value, QColor):
+ match = self.color_exp.match(text)
+ return QColor(min(int(match.captured(1)), 255),
+ min(int(match.captured(2)), 255),
+ min(int(match.captured(3)), 255),
+ min(int(match.captured(4)), 255))
+ if isinstance(original_value, QDate):
+ value = QDate.fromString(text, Qt.ISODate)
+ return value if value.isValid() else None
+ if isinstance(original_value, QDateTime):
+ value = QDateTime.fromString(text, Qt.ISODate)
+ return value if value.isValid() else None
+ if isinstance(original_value, QTime):
+ value = QTime.fromString(text, Qt.ISODate)
+ return value if value.isValid() else None
+ if isinstance(original_value, QPoint):
+ match = self.point_exp.match(text)
+ return QPoint(int(match.captured(1)),
+ int(match.captured(2)))
+ if isinstance(original_value, QRect):
+ match = self.rect_exp.match(text)
+ return QRect(int(match.captured(1)),
+ int(match.captured(2)),
+ int(match.captured(3)),
+ int(match.captured(4)))
+ if isinstance(original_value, QSize):
+ match = self.size_exp.match(text)
+ return QSize(int(match.captured(1)),
+ int(match.captured(2)))
+ if isinstance(original_value, list):
+ return text.split(',')
+ return type(original_value)(text)
+
+
+class MainWindow(QMainWindow):
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
- self.settingsTree = SettingsTree()
- self.setCentralWidget(self.settingsTree)
+ self.settings_tree = SettingsTree()
+ self.setCentralWidget(self.settings_tree)
- self.locationDialog = None
+ self.location_dialog = None
- self.createActions()
- self.createMenus()
+ self.create_actions()
+ self.create_menus()
- self.autoRefreshAct.setChecked(True)
- self.fallbacksAct.setChecked(True)
+ self.auto_refresh_action.setChecked(True)
+ self.fallbacks_action.setChecked(True)
self.setWindowTitle("Settings Editor")
self.resize(500, 600)
- def openSettings(self):
- if self.locationDialog is None:
- self.locationDialog = LocationDialog(self)
+ def open_settings(self):
+ if self.location_dialog is None:
+ self.location_dialog = LocationDialog(self)
- if self.locationDialog.exec_():
- settings = QtCore.QSettings(self.locationDialog.format(),
- self.locationDialog.scope(),
- self.locationDialog.organization(),
- self.locationDialog.application())
- self.setSettingsObject(settings)
- self.fallbacksAct.setEnabled(True)
+ if self.location_dialog.exec_():
+ settings = QSettings(self.location_dialog.format(),
+ self.location_dialog.scope(),
+ self.location_dialog.organization(),
+ self.location_dialog.application())
+ self.set_settings_object(settings)
+ self.fallbacks_action.setEnabled(True)
- def openIniFile(self):
- fileName, _ = QtWidgets.QFileDialog.getOpenFileName(self, "Open INI File",
+ def open_inifile(self):
+ file_name, _ = QFileDialog.getOpenFileName(self, "Open INI File",
'', "INI Files (*.ini *.conf)")
- if fileName:
- settings = QtCore.QSettings(fileName, QtCore.QSettings.IniFormat)
- self.setSettingsObject(settings)
- self.fallbacksAct.setEnabled(False)
+ if file_name:
+ self.load_ini_file(file_name)
+
+ def load_ini_file(self, file_name):
+ settings = QSettings(file_name, QSettings.IniFormat)
+ if settings.status() != QSettings.NoError:
+ return
+ self.set_settings_object(settings)
+ self.fallbacks_action.setEnabled(False)
- def openPropertyList(self):
- fileName, _ = QtWidgets.QFileDialog.getOpenFileName(self,
+ def open_property_list(self):
+ file_name, _ = QFileDialog.getOpenFileName(self,
"Open Property List", '', "Property List Files (*.plist)")
- if fileName:
- settings = QtCore.QSettings(fileName, QtCore.QSettings.NativeFormat)
- self.setSettingsObject(settings)
- self.fallbacksAct.setEnabled(False)
+ if file_name:
+ settings = QSettings(file_name, QSettings.NativeFormat)
+ self.set_settings_object(settings)
+ self.fallbacks_action.setEnabled(False)
- def openRegistryPath(self):
- path, ok = QtWidgets.QInputDialog.getText(self, "Open Registry Path",
+ def open_registry_path(self):
+ path, ok = QInputDialog.getText(self, "Open Registry Path",
"Enter the path in the Windows registry:",
- QtWidgets.QLineEdit.Normal, 'HKEY_CURRENT_USER\\')
+ QLineEdit.Normal, 'HKEY_CURRENT_USER\\')
if ok and path != '':
- settings = QtCore.QSettings(path, QtCore.QSettings.NativeFormat)
- self.setSettingsObject(settings)
- self.fallbacksAct.setEnabled(False)
+ settings = QSettings(path, QSettings.NativeFormat)
+ self.set_settings_object(settings)
+ self.fallbacks_action.setEnabled(False)
def about(self):
- QtWidgets.QMessageBox.about(self, "About Settings Editor",
+ QMessageBox.about(self, "About Settings Editor",
"The <b>Settings Editor</b> example shows how to access "
"application settings using Qt.")
def createActions(self):
- self.openSettingsAct = QtWidgets.QAction("&Open Application Settings...",
+ self.openSettingsAct = QtGui.QAction("&Open Application Settings...",
self, shortcut="Ctrl+O", triggered=self.openSettings)
- self.openIniFileAct = QtWidgets.QAction("Open I&NI File...", self,
+ self.openIniFileAct = QtGui.QAction("Open I&NI File...", self,
shortcut="Ctrl+N", triggered=self.openIniFile)
- self.openPropertyListAct = QtWidgets.QAction("Open macOS &Property List...",
+ self.openPropertyListAct = QtGui.QAction("Open macOS &Property List...",
self, shortcut="Ctrl+P", triggered=self.openPropertyList)
+
+ def create_actions(self):
+ self.open_settings_action = QAction("&Open Application Settings...",
+ self, shortcut="Ctrl+O", triggered=self.open_settings)
+
+ self.open_ini_file_action = QAction("Open I&NI File...", self,
+ shortcut="Ctrl+N", triggered=self.open_inifile)
+
+ self.open_property_list_action = QAction("Open macOS &Property List...",
+ self, shortcut="Ctrl+P", triggered=self.open_property_list)
if sys.platform != 'darwin':
- self.openPropertyListAct.setEnabled(False)
+ self.open_property_list_action.setEnabled(False)
- self.openRegistryPathAct = QtWidgets.QAction(
+ self.open_registry_path_action = QAction(
"Open Windows &Registry Path...", self, shortcut="Ctrl+G",
- triggered=self.openRegistryPath)
+ triggered=self.open_registry_path)
if sys.platform != 'win32':
- self.openRegistryPathAct.setEnabled(False)
+ self.open_registry_path_action.setEnabled(False)
- self.refreshAct = QtWidgets.QAction("&Refresh", self, shortcut="Ctrl+R",
- enabled=False, triggered=self.settingsTree.refresh)
+ self.refresh_action = QAction("&Refresh", self, shortcut="Ctrl+R",
+ enabled=False, triggered=self.settings_tree.refresh)
- self.exitAct = QtWidgets.QAction("E&xit", self, shortcut="Ctrl+Q",
+ self.exit_action = QAction("E&xit", self, shortcut="Ctrl+Q",
triggered=self.close)
- self.autoRefreshAct = QtWidgets.QAction("&Auto-Refresh", self,
+ self.auto_refresh_action = QAction("&Auto-Refresh", self,
shortcut="Ctrl+A", checkable=True, enabled=False)
- self.autoRefreshAct.triggered[bool].connect(self.settingsTree.setAutoRefresh)
- self.autoRefreshAct.triggered[bool].connect(self.refreshAct.setDisabled)
+ self.auto_refresh_action.triggered[bool].connect(self.settings_tree.set_auto_refresh)
+ self.auto_refresh_action.triggered[bool].connect(self.refresh_action.setDisabled)
- self.fallbacksAct = QtWidgets.QAction("&Fallbacks", self,
+ self.fallbacks_action = QAction("&Fallbacks", self,
shortcut="Ctrl+F", checkable=True, enabled=False)
- self.fallbacksAct.triggered[bool].connect(self.settingsTree.setFallbacksEnabled)
+ self.fallbacks_action.triggered[bool].connect(self.settings_tree.set_fallbacks_enabled)
- self.aboutAct = QtWidgets.QAction("&About", self, triggered=self.about)
+ self.about_action = QAction("&About", self, triggered=self.about)
- self.aboutQtAct = QtWidgets.QAction("About &Qt", self,
- triggered=qApp.aboutQt)
+ self.about_Qt_action = QAction("About &Qt", self,
+ triggered=qApp.aboutQt)
- def createMenus(self):
- self.fileMenu = self.menuBar().addMenu("&File")
- self.fileMenu.addAction(self.openSettingsAct)
- self.fileMenu.addAction(self.openIniFileAct)
- self.fileMenu.addAction(self.openPropertyListAct)
- self.fileMenu.addAction(self.openRegistryPathAct)
- self.fileMenu.addSeparator()
- self.fileMenu.addAction(self.refreshAct)
- self.fileMenu.addSeparator()
- self.fileMenu.addAction(self.exitAct)
+ def create_menus(self):
+ self.file_menu = self.menuBar().addMenu("&File")
+ self.file_menu.addAction(self.open_settings_action)
+ self.file_menu.addAction(self.open_ini_file_action)
+ self.file_menu.addAction(self.open_property_list_action)
+ self.file_menu.addAction(self.open_registry_path_action)
+ self.file_menu.addSeparator()
+ self.file_menu.addAction(self.refresh_action)
+ self.file_menu.addSeparator()
+ self.file_menu.addAction(self.exit_action)
- self.optionsMenu = self.menuBar().addMenu("&Options")
- self.optionsMenu.addAction(self.autoRefreshAct)
- self.optionsMenu.addAction(self.fallbacksAct)
+ self.options_menu = self.menuBar().addMenu("&Options")
+ self.options_menu.addAction(self.auto_refresh_action)
+ self.options_menu.addAction(self.fallbacks_action)
self.menuBar().addSeparator()
- self.helpMenu = self.menuBar().addMenu("&Help")
- self.helpMenu.addAction(self.aboutAct)
- self.helpMenu.addAction(self.aboutQtAct)
+ self.help_menu = self.menuBar().addMenu("&Help")
+ self.help_menu.addAction(self.about_action)
+ self.help_menu.addAction(self.about_Qt_action)
- def setSettingsObject(self, settings):
- settings.setFallbacksEnabled(self.fallbacksAct.isChecked())
- self.settingsTree.setSettingsObject(settings)
+ def set_settings_object(self, settings):
+ settings.setFallbacksEnabled(self.fallbacks_action.isChecked())
+ self.settings_tree.set_settings_object(settings)
- self.refreshAct.setEnabled(True)
- self.autoRefreshAct.setEnabled(True)
+ self.refresh_action.setEnabled(True)
+ self.auto_refresh_action.setEnabled(True)
- niceName = settings.fileName()
- niceName.replace('\\', '/')
- niceName = niceName.split('/')[-1]
+ nice_name = QDir.fromNativeSeparators(settings.fileName())
+ nice_name = nice_name.split('/')[-1]
if not settings.isWritable():
- niceName += " (read only)"
+ nice_name += " (read only)"
- self.setWindowTitle("%s - Settings Editor" % niceName)
+ self.setWindowTitle("{} - Settings Editor".format(nice_name))
-class LocationDialog(QtWidgets.QDialog):
+class LocationDialog(QDialog):
def __init__(self, parent=None):
super(LocationDialog, self).__init__(parent)
- self.formatComboBox = QtWidgets.QComboBox()
- self.formatComboBox.addItem("Native")
- self.formatComboBox.addItem("INI")
-
- self.scopeComboBox = QtWidgets.QComboBox()
- self.scopeComboBox.addItem("User")
- self.scopeComboBox.addItem("System")
-
- self.organizationComboBox = QtWidgets.QComboBox()
- self.organizationComboBox.addItem("Trolltech")
- self.organizationComboBox.setEditable(True)
-
- self.applicationComboBox = QtWidgets.QComboBox()
- self.applicationComboBox.addItem("Any")
- self.applicationComboBox.addItem("Application Example")
- self.applicationComboBox.addItem("Assistant")
- self.applicationComboBox.addItem("Designer")
- self.applicationComboBox.addItem("Linguist")
- self.applicationComboBox.setEditable(True)
- self.applicationComboBox.setCurrentIndex(3)
-
- formatLabel = QtWidgets.QLabel("&Format:")
- formatLabel.setBuddy(self.formatComboBox)
-
- scopeLabel = QtWidgets.QLabel("&Scope:")
- scopeLabel.setBuddy(self.scopeComboBox)
-
- organizationLabel = QtWidgets.QLabel("&Organization:")
- organizationLabel.setBuddy(self.organizationComboBox)
-
- applicationLabel = QtWidgets.QLabel("&Application:")
- applicationLabel.setBuddy(self.applicationComboBox)
-
- self.locationsGroupBox = QtWidgets.QGroupBox("Setting Locations")
-
- self.locationsTable = QtWidgets.QTableWidget()
- self.locationsTable.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)
- self.locationsTable.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
- self.locationsTable.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
- self.locationsTable.setColumnCount(2)
- self.locationsTable.setHorizontalHeaderLabels(("Location", "Access"))
- self.locationsTable.horizontalHeader().setSectionResizeMode(0, QtWidgets.QHeaderView.Stretch)
- self.locationsTable.horizontalHeader().resizeSection(1, 180)
-
- self.buttonBox = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel)
-
- self.formatComboBox.activated.connect(self.updateLocationsTable)
- self.scopeComboBox.activated.connect(self.updateLocationsTable)
- self.organizationComboBox.lineEdit().editingFinished.connect(self.updateLocationsTable)
- self.applicationComboBox.lineEdit().editingFinished.connect(self.updateLocationsTable)
- self.buttonBox.accepted.connect(self.accept)
- self.buttonBox.rejected.connect(self.reject)
-
- locationsLayout = QtWidgets.QVBoxLayout()
- locationsLayout.addWidget(self.locationsTable)
- self.locationsGroupBox.setLayout(locationsLayout)
-
- mainLayout = QtWidgets.QGridLayout()
- mainLayout.addWidget(formatLabel, 0, 0)
- mainLayout.addWidget(self.formatComboBox, 0, 1)
- mainLayout.addWidget(scopeLabel, 1, 0)
- mainLayout.addWidget(self.scopeComboBox, 1, 1)
- mainLayout.addWidget(organizationLabel, 2, 0)
- mainLayout.addWidget(self.organizationComboBox, 2, 1)
- mainLayout.addWidget(applicationLabel, 3, 0)
- mainLayout.addWidget(self.applicationComboBox, 3, 1)
- mainLayout.addWidget(self.locationsGroupBox, 4, 0, 1, 2)
- mainLayout.addWidget(self.buttonBox, 5, 0, 1, 2)
- self.setLayout(mainLayout)
-
- self.updateLocationsTable()
+ self.format_combo = QComboBox()
+ self.format_combo.addItem("Native")
+ self.format_combo.addItem("INI")
+
+ self.scope_cCombo = QComboBox()
+ self.scope_cCombo.addItem("User")
+ self.scope_cCombo.addItem("System")
+
+ self.organization_combo = QComboBox()
+ self.organization_combo.addItem("Trolltech")
+ self.organization_combo.setEditable(True)
+
+ self.application_combo = QComboBox()
+ self.application_combo.addItem("Any")
+ self.application_combo.addItem("Application Example")
+ self.application_combo.addItem("Assistant")
+ self.application_combo.addItem("Designer")
+ self.application_combo.addItem("Linguist")
+ self.application_combo.setEditable(True)
+ self.application_combo.setCurrentIndex(3)
+
+ format_label = QLabel("&Format:")
+ format_label.setBuddy(self.format_combo)
+
+ scope_label = QLabel("&Scope:")
+ scope_label.setBuddy(self.scope_cCombo)
+
+ organization_label = QLabel("&Organization:")
+ organization_label.setBuddy(self.organization_combo)
+
+ application_label = QLabel("&Application:")
+ application_label.setBuddy(self.application_combo)
+
+ self.locations_groupbox = QGroupBox("Setting Locations")
+
+ self.locations_table = QTableWidget()
+ self.locations_table.setSelectionMode(QAbstractItemView.SingleSelection)
+ self.locations_table.setSelectionBehavior(QAbstractItemView.SelectRows)
+ self.locations_table.setEditTriggers(QAbstractItemView.NoEditTriggers)
+ self.locations_table.setColumnCount(2)
+ self.locations_table.setHorizontalHeaderLabels(("Location", "Access"))
+ self.locations_table.horizontalHeader().setSectionResizeMode(0, QHeaderView.Stretch)
+ self.locations_table.horizontalHeader().resizeSection(1, 180)
+
+ self.button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
+
+ self.format_combo.activated.connect(self.update_locations)
+ self.scope_cCombo.activated.connect(self.update_locations)
+ self.organization_combo.lineEdit().editingFinished.connect(self.update_locations)
+ self.application_combo.lineEdit().editingFinished.connect(self.update_locations)
+ self.button_box.accepted.connect(self.accept)
+ self.button_box.rejected.connect(self.reject)
+
+ locations_layout = QVBoxLayout(self.locations_groupbox)
+ locations_layout.addWidget(self.locations_table)
+
+ mainLayout = QGridLayout(self)
+ mainLayout.addWidget(format_label, 0, 0)
+ mainLayout.addWidget(self.format_combo, 0, 1)
+ mainLayout.addWidget(scope_label, 1, 0)
+ mainLayout.addWidget(self.scope_cCombo, 1, 1)
+ mainLayout.addWidget(organization_label, 2, 0)
+ mainLayout.addWidget(self.organization_combo, 2, 1)
+ mainLayout.addWidget(application_label, 3, 0)
+ mainLayout.addWidget(self.application_combo, 3, 1)
+ mainLayout.addWidget(self.locations_groupbox, 4, 0, 1, 2)
+ mainLayout.addWidget(self.button_box, 5, 0, 1, 2)
+
+ self.update_locations()
self.setWindowTitle("Open Application Settings")
self.resize(650, 400)
def format(self):
- if self.formatComboBox.currentIndex() == 0:
- return QtCore.QSettings.NativeFormat
+ if self.format_combo.currentIndex() == 0:
+ return QSettings.NativeFormat
else:
- return QtCore.QSettings.IniFormat
+ return QSettings.IniFormat
def scope(self):
- if self.scopeComboBox.currentIndex() == 0:
- return QtCore.QSettings.UserScope
+ if self.scope_cCombo.currentIndex() == 0:
+ return QSettings.UserScope
else:
- return QtCore.QSettings.SystemScope
+ return QSettings.SystemScope
def organization(self):
- return self.organizationComboBox.currentText()
+ return self.organization_combo.currentText()
def application(self):
- if self.applicationComboBox.currentText() == "Any":
+ if self.application_combo.currentText() == "Any":
return ''
- return self.applicationComboBox.currentText()
+ return self.application_combo.currentText()
- def updateLocationsTable(self):
- self.locationsTable.setUpdatesEnabled(False)
- self.locationsTable.setRowCount(0)
+ def update_locations(self):
+ self.locations_table.setUpdatesEnabled(False)
+ self.locations_table.setRowCount(0)
for i in range(2):
if i == 0:
- if self.scope() == QtCore.QSettings.SystemScope:
+ if self.scope() == QSettings.SystemScope:
continue
- actualScope = QtCore.QSettings.UserScope
+ actualScope = QSettings.UserScope
else:
- actualScope = QtCore.QSettings.SystemScope
+ actualScope = QSettings.SystemScope
for j in range(2):
if j == 0:
@@ -308,16 +438,16 @@ class LocationDialog(QtWidgets.QDialog):
else:
actualApplication = ''
- settings = QtCore.QSettings(self.format(), actualScope,
- self.organization(), actualApplication)
+ settings = QSettings(self.format(), actualScope,
+ self.organization(), actualApplication)
- row = self.locationsTable.rowCount()
- self.locationsTable.setRowCount(row + 1)
+ row = self.locations_table.rowCount()
+ self.locations_table.setRowCount(row + 1)
- item0 = QtWidgets.QTableWidgetItem()
+ item0 = QTableWidgetItem()
item0.setText(settings.fileName())
- item1 = QtWidgets.QTableWidgetItem()
+ item1 = QTableWidgetItem()
disable = not (settings.childKeys() or settings.childGroups())
if row == 0:
@@ -326,77 +456,79 @@ class LocationDialog(QtWidgets.QDialog):
disable = False
else:
item1.setText("Read-only")
- self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).setDisabled(disable)
+ self.button_box.button(QDialogButtonBox.Ok).setDisabled(disable)
else:
item1.setText("Read-only fallback")
if disable:
- item0.setFlags(item0.flags() & ~QtCore.Qt.ItemIsEnabled)
- item1.setFlags(item1.flags() & ~QtCore.Qt.ItemIsEnabled)
+ item0.setFlags(item0.flags() & ~Qt.ItemIsEnabled)
+ item1.setFlags(item1.flags() & ~Qt.ItemIsEnabled)
- self.locationsTable.setItem(row, 0, item0)
- self.locationsTable.setItem(row, 1, item1)
+ self.locations_table.setItem(row, 0, item0)
+ self.locations_table.setItem(row, 1, item1)
- self.locationsTable.setUpdatesEnabled(True)
+ self.locations_table.setUpdatesEnabled(True)
-class SettingsTree(QtWidgets.QTreeWidget):
+class SettingsTree(QTreeWidget):
def __init__(self, parent=None):
super(SettingsTree, self).__init__(parent)
- self.setItemDelegate(VariantDelegate(self))
+ self._type_checker = TypeChecker()
+ self.setItemDelegate(VariantDelegate(self._type_checker, self))
self.setHeaderLabels(("Setting", "Type", "Value"))
- self.header().setSectionResizeMode(0, QtWidgets.QHeaderView.Stretch)
- self.header().setSectionResizeMode(2, QtWidgets.QHeaderView.Stretch)
+ self.header().setSectionResizeMode(0, QHeaderView.Stretch)
+ self.header().setSectionResizeMode(2, QHeaderView.Stretch)
self.settings = None
- self.refreshTimer = QtCore.QTimer()
- self.refreshTimer.setInterval(2000)
- self.autoRefresh = False
-
- self.groupIcon = QtGui.QIcon()
- self.groupIcon.addPixmap(self.style().standardPixmap(QtWidgets.QStyle.SP_DirClosedIcon),
- QtGui.QIcon.Normal, QtGui.QIcon.Off)
- self.groupIcon.addPixmap(self.style().standardPixmap(QtWidgets.QStyle.SP_DirOpenIcon),
- QtGui.QIcon.Normal, QtGui.QIcon.On)
- self.keyIcon = QtGui.QIcon()
- self.keyIcon.addPixmap(self.style().standardPixmap(QtWidgets.QStyle.SP_FileIcon))
-
- self.refreshTimer.timeout.connect(self.maybeRefresh)
-
- def setSettingsObject(self, settings):
+ self.refresh_timer = QTimer()
+ self.refresh_timer.setInterval(2000)
+ self.auto_refresh = False
+
+ self.group_icon = QIcon()
+ style = self.style()
+ self.group_icon.addPixmap(style.standardPixmap(QStyle.SP_DirClosedIcon),
+ QIcon.Normal, QIcon.Off)
+ self.group_icon.addPixmap(style.standardPixmap(QStyle.SP_DirOpenIcon),
+ QIcon.Normal, QIcon.On)
+ self.key_icon = QIcon()
+ self.key_icon.addPixmap(style.standardPixmap(QStyle.SP_FileIcon))
+
+ self.refresh_timer.timeout.connect(self.maybe_refresh)
+
+ def set_settings_object(self, settings):
self.settings = settings
self.clear()
if self.settings is not None:
self.settings.setParent(self)
self.refresh()
- if self.autoRefresh:
- self.refreshTimer.start()
+ if self.auto_refresh:
+ self.refresh_timer.start()
else:
- self.refreshTimer.stop()
+ self.refresh_timer.stop()
def sizeHint(self):
- return QtCore.QSize(800, 600)
+ return QSize(800, 600)
- def setAutoRefresh(self, autoRefresh):
- self.autoRefresh = autoRefresh
+ def set_auto_refresh(self, autoRefresh):
+ self.auto_refresh = autoRefresh
if self.settings is not None:
- if self.autoRefresh:
- self.maybeRefresh()
- self.refreshTimer.start()
+ if self.auto_refresh:
+ self.maybe_refresh()
+ self.refresh_timer.start()
else:
- self.refreshTimer.stop()
+ self.refresh_timer.stop()
- def setFallbacksEnabled(self, enabled):
+ def set_fallbacks_enabled(self, enabled):
if self.settings is not None:
self.settings.setFallbacksEnabled(enabled)
self.refresh()
- def maybeRefresh(self):
- if self.state() != QtWidgets.QAbstractItemView.EditingState:
+ def maybe_refresh(self):
+ if self.state() != QAbstractItemView.EditingState:
self.refresh()
def refresh(self):
@@ -405,23 +537,23 @@ class SettingsTree(QtWidgets.QTreeWidget):
# The signal might not be connected.
try:
- self.itemChanged.disconnect(self.updateSetting)
+ self.itemChanged.disconnect(self.update_setting)
except:
pass
self.settings.sync()
- self.updateChildItems(None)
+ self.update_child_items(None)
- self.itemChanged.connect(self.updateSetting)
+ self.itemChanged.connect(self.update_setting)
def event(self, event):
- if event.type() == QtCore.QEvent.WindowActivate:
- if self.isActiveWindow() and self.autoRefresh:
- self.maybeRefresh()
+ if event.type() == QEvent.WindowActivate:
+ if self.isActiveWindow() and self.auto_refresh:
+ self.maybe_refresh()
return super(SettingsTree, self).event(event)
- def updateSetting(self, item):
+ def update_setting(self, item):
key = item.text(0)
ancestor = item.parent()
@@ -429,154 +561,121 @@ class SettingsTree(QtWidgets.QTreeWidget):
key = ancestor.text(0) + '/' + key
ancestor = ancestor.parent()
- d = item.data(2, QtCore.Qt.UserRole)
- self.settings.setValue(key, item.data(2, QtCore.Qt.UserRole))
+ d = item.data(2, Qt.UserRole)
+ self.settings.setValue(key, item.data(2, Qt.UserRole))
- if self.autoRefresh:
+ if self.auto_refresh:
self.refresh()
- def updateChildItems(self, parent):
- dividerIndex = 0
+ def update_child_items(self, parent):
+ divider_index = 0
for group in self.settings.childGroups():
- childIndex = self.findChild(parent, group, dividerIndex)
- if childIndex != -1:
- child = self.childAt(parent, childIndex)
+ child_index = self.find_child(parent, group, divider_index)
+ if child_index != -1:
+ child = self.child_at(parent, child_index)
child.setText(1, '')
child.setText(2, '')
- child.setData(2, QtCore.Qt.UserRole, None)
- self.moveItemForward(parent, childIndex, dividerIndex)
+ child.setData(2, Qt.UserRole, None)
+ self.move_item_forward(parent, child_index, divider_index)
else:
- child = self.createItem(group, parent, dividerIndex)
+ child = self.create_item(group, parent, divider_index)
- child.setIcon(0, self.groupIcon)
- dividerIndex += 1
+ child.setIcon(0, self.group_icon)
+ divider_index += 1
self.settings.beginGroup(group)
- self.updateChildItems(child)
+ self.update_child_items(child)
self.settings.endGroup()
for key in self.settings.childKeys():
- childIndex = self.findChild(parent, key, 0)
- if childIndex == -1 or childIndex >= dividerIndex:
- if childIndex != -1:
- child = self.childAt(parent, childIndex)
+ child_index = self.find_child(parent, key, 0)
+ if child_index == -1 or child_index >= divider_index:
+ if child_index != -1:
+ child = self.child_at(parent, child_index)
for i in range(child.childCount()):
- self.deleteItem(child, i)
- self.moveItemForward(parent, childIndex, dividerIndex)
+ self.delete_item(child, i)
+ self.move_item_forward(parent, child_index, divider_index)
else:
- child = self.createItem(key, parent, dividerIndex)
- child.setIcon(0, self.keyIcon)
- dividerIndex += 1
+ child = self.create_item(key, parent, divider_index)
+ child.setIcon(0, self.key_icon)
+ divider_index += 1
else:
- child = self.childAt(parent, childIndex)
+ child = self.child_at(parent, child_index)
value = self.settings.value(key)
if value is None:
child.setText(1, 'Invalid')
else:
+ # Try to convert to type unless a QByteArray is received
+ if isinstance(value, str):
+ value_type = self._type_checker.type_from_text(value)
+ if value_type:
+ value = self.settings.value(key, type=value_type)
child.setText(1, value.__class__.__name__)
child.setText(2, VariantDelegate.displayText(value))
- child.setData(2, QtCore.Qt.UserRole, value)
+ child.setData(2, Qt.UserRole, value)
- while dividerIndex < self.childCount(parent):
- self.deleteItem(parent, dividerIndex)
+ while divider_index < self.child_count(parent):
+ self.delete_item(parent, divider_index)
- def createItem(self, text, parent, index):
+ def create_item(self, text, parent, index):
after = None
if index != 0:
- after = self.childAt(parent, index - 1)
+ after = self.child_at(parent, index - 1)
if parent is not None:
- item = QtWidgets.QTreeWidgetItem(parent, after)
+ item = QTreeWidgetItem(parent, after)
else:
- item = QtWidgets.QTreeWidgetItem(self, after)
+ item = QTreeWidgetItem(self, after)
item.setText(0, text)
- item.setFlags(item.flags() | QtCore.Qt.ItemIsEditable)
+ item.setFlags(item.flags() | Qt.ItemIsEditable)
return item
- def deleteItem(self, parent, index):
+ def delete_item(self, parent, index):
if parent is not None:
item = parent.takeChild(index)
else:
item = self.takeTopLevelItem(index)
del item
- def childAt(self, parent, index):
+ def child_at(self, parent, index):
if parent is not None:
return parent.child(index)
else:
return self.topLevelItem(index)
- def childCount(self, parent):
+ def child_count(self, parent):
if parent is not None:
return parent.childCount()
else:
return self.topLevelItemCount()
- def findChild(self, parent, text, startIndex):
- for i in range(self.childCount(parent)):
- if self.childAt(parent, i).text(0) == text:
+ def find_child(self, parent, text, startIndex):
+ for i in range(self.child_count(parent)):
+ if self.child_at(parent, i).text(0) == text:
return i
return -1
- def moveItemForward(self, parent, oldIndex, newIndex):
+ def move_item_forward(self, parent, oldIndex, newIndex):
for int in range(oldIndex - newIndex):
- self.deleteItem(parent, newIndex)
+ self.delete_item(parent, newIndex)
-class VariantDelegate(QtWidgets.QItemDelegate):
- def __init__(self, parent=None):
+class VariantDelegate(QItemDelegate):
+ def __init__(self, type_checker, parent=None):
super(VariantDelegate, self).__init__(parent)
-
- self.boolExp = QtCore.QRegExp()
- self.boolExp.setPattern('true|false')
- self.boolExp.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
-
- self.byteArrayExp = QtCore.QRegExp()
- self.byteArrayExp.setPattern('[\\x00-\\xff]*')
-
- self.charExp = QtCore.QRegExp()
- self.charExp.setPattern('.')
-
- self.colorExp = QtCore.QRegExp()
- self.colorExp.setPattern('\\(([0-9]*),([0-9]*),([0-9]*),([0-9]*)\\)')
-
- self.doubleExp = QtCore.QRegExp()
- self.doubleExp.setPattern('')
-
- self.pointExp = QtCore.QRegExp()
- self.pointExp.setPattern('\\((-?[0-9]*),(-?[0-9]*)\\)')
-
- self.rectExp = QtCore.QRegExp()
- self.rectExp.setPattern('\\((-?[0-9]*),(-?[0-9]*),(-?[0-9]*),(-?[0-9]*)\\)')
-
- self.signedIntegerExp = QtCore.QRegExp()
- self.signedIntegerExp.setPattern('-?[0-9]*')
-
- self.sizeExp = QtCore.QRegExp(self.pointExp)
-
- self.unsignedIntegerExp = QtCore.QRegExp()
- self.unsignedIntegerExp.setPattern('[0-9]*')
-
- self.dateExp = QtCore.QRegExp()
- self.dateExp.setPattern('([0-9]{,4})-([0-9]{,2})-([0-9]{,2})')
-
- self.timeExp = QtCore.QRegExp()
- self.timeExp.setPattern('([0-9]{,2}):([0-9]{,2}):([0-9]{,2})')
-
- self.dateTimeExp = QtCore.QRegExp()
- self.dateTimeExp.setPattern(self.dateExp.pattern() + 'T' + self.timeExp.pattern())
+ self._type_checker = type_checker
def paint(self, painter, option, index):
if index.column() == 2:
- value = index.model().data(index, QtCore.Qt.UserRole)
- if not self.isSupportedType(value):
- myOption = QtWidgets.QStyleOptionViewItem(option)
- myOption.state &= ~QtWidgets.QStyle.State_Enabled
- super(VariantDelegate, self).paint(painter, myOption, index)
+ value = index.model().data(index, Qt.UserRole)
+ if not self.is_supported_type(value):
+ my_option = QStyleOptionViewItem(option)
+ my_option.state &= ~QStyle.State_Enabled
+ super(VariantDelegate, self).paint(painter, my_option, index)
return
super(VariantDelegate, self).paint(painter, option, index)
@@ -585,137 +684,97 @@ class VariantDelegate(QtWidgets.QItemDelegate):
if index.column() != 2:
return None
- originalValue = index.model().data(index, QtCore.Qt.UserRole)
- if not self.isSupportedType(originalValue):
+ original_value = index.model().data(index, Qt.UserRole)
+ if not self.is_supported_type(original_value):
return None
- lineEdit = QtWidgets.QLineEdit(parent)
- lineEdit.setFrame(False)
-
- if isinstance(originalValue, bool):
- regExp = self.boolExp
- elif isinstance(originalValue, float):
- regExp = self.doubleExp
- elif isinstance(originalValue, int):
- regExp = self.signedIntegerExp
- elif isinstance(originalValue, QtCore.QByteArray):
- regExp = self.byteArrayExp
- elif isinstance(originalValue, QtGui.QColor):
- regExp = self.colorExp
- elif isinstance(originalValue, QtCore.QDate):
- regExp = self.dateExp
- elif isinstance(originalValue, QtCore.QDateTime):
- regExp = self.dateTimeExp
- elif isinstance(originalValue, QtCore.QTime):
- regExp = self.timeExp
- elif isinstance(originalValue, QtCore.QPoint):
- regExp = self.pointExp
- elif isinstance(originalValue, QtCore.QRect):
- regExp = self.rectExp
- elif isinstance(originalValue, QtCore.QSize):
- regExp = self.sizeExp
+ editor = None
+ if isinstance(original_value, bool):
+ editor = QCheckBox(parent)
+ if isinstance(original_value, int):
+ editor = QSpinBox(parent)
+ editor.setRange(-32767, 32767)
else:
- regExp = QtCore.QRegExp()
-
- if not regExp.isEmpty():
- validator = QtGui.QRegExpValidator(regExp, lineEdit)
- lineEdit.setValidator(validator)
-
- return lineEdit
+ editor = QLineEdit(parent)
+ editor.setFrame(False)
+ validator = self._type_checker.create_validator(original_value, editor)
+ if validator:
+ editor.setValidator(validator)
+ return editor
def setEditorData(self, editor, index):
- value = index.model().data(index, QtCore.Qt.UserRole)
- if editor is not None:
- editor.setText(self.displayText(value))
-
- def setModelData(self, editor, model, index):
- if not editor.isModified():
+ if not editor:
return
+ value = index.model().data(index, Qt.UserRole)
+ if isinstance(editor, QCheckBox):
+ editor.setCheckState(Qt.Checked if value else Qt.Unchecked)
+ elif isinstance(editor, QSpinBox):
+ editor.setValue(value)
+ else:
+ editor.setText(self.displayText(value))
- text = editor.text()
- validator = editor.validator()
+ def value_from_lineedit(self, lineedit, model, index):
+ if not lineedit.isModified():
+ return None
+ text = lineedit.text()
+ validator = lineedit.validator()
if validator is not None:
state, text, _ = validator.validate(text, 0)
- if state != QtGui.QValidator.Acceptable:
- return
+ if state != QValidator.Acceptable:
+ return None
+ original_value = index.model().data(index, Qt.UserRole)
+ return self._type_checker.from_string(text, original_value)
- originalValue = index.model().data(index, QtCore.Qt.UserRole)
-
- if isinstance(originalValue, QtGui.QColor):
- self.colorExp.exactMatch(text)
- value = QtGui.QColor(min(int(self.colorExp.cap(1)), 255),
- min(int(self.colorExp.cap(2)), 255),
- min(int(self.colorExp.cap(3)), 255),
- min(int(self.colorExp.cap(4)), 255))
- elif isinstance(originalValue, QtCore.QDate):
- value = QtCore.QDate.fromString(text, QtCore.Qt.ISODate)
- if not value.isValid():
- return
- elif isinstance(originalValue, QtCore.QDateTime):
- value = QtCore.QDateTime.fromString(text, QtCore.Qt.ISODate)
- if not value.isValid():
- return
- elif isinstance(originalValue, QtCore.QTime):
- value = QtCore.QTime.fromString(text, QtCore.Qt.ISODate)
- if not value.isValid():
- return
- elif isinstance(originalValue, QtCore.QPoint):
- self.pointExp.exactMatch(text)
- value = QtCore.QPoint(int(self.pointExp.cap(1)),
- int(self.pointExp.cap(2)))
- elif isinstance(originalValue, QtCore.QRect):
- self.rectExp.exactMatch(text)
- value = QtCore.QRect(int(self.rectExp.cap(1)),
- int(self.rectExp.cap(2)),
- int(self.rectExp.cap(3)),
- int(self.rectExp.cap(4)))
- elif isinstance(originalValue, QtCore.QSize):
- self.sizeExp.exactMatch(text)
- value = QtCore.QSize(int(self.sizeExp.cap(1)),
- int(self.sizeExp.cap(2)))
- elif isinstance(originalValue, list):
- value = text.split(',')
+ def setModelData(self, editor, model, index):
+ value = None
+ if isinstance(editor, QCheckBox):
+ value = editor.checkState() == Qt.Checked
+ elif isinstance(editor, QSpinBox):
+ value = editor.value()
else:
- value = type(originalValue)(text)
-
- model.setData(index, self.displayText(value), QtCore.Qt.DisplayRole)
- model.setData(index, value, QtCore.Qt.UserRole)
+ value = self.value_from_lineedit(editor, model, index)
+ if not value is None:
+ model.setData(index, value, Qt.UserRole)
+ model.setData(index, self.displayText(value), Qt.DisplayRole)
@staticmethod
- def isSupportedType(value):
- return isinstance(value, (bool, float, int, QtCore.QByteArray,
- str, QtGui.QColor, QtCore.QDate, QtCore.QDateTime,
- QtCore.QTime, QtCore.QPoint, QtCore.QRect, QtCore.QSize,
- list))
+ def is_supported_type(value):
+ return isinstance(value, (bool, float, int, QByteArray, str, QColor,
+ QDate, QDateTime, QTime, QPoint, QRect,
+ QSize, list))
@staticmethod
def displayText(value):
- if isinstance(value, (bool, int, QtCore.QByteArray)):
- return str(value)
if isinstance(value, str):
return value
- elif isinstance(value, float):
- return '%g' % value
- elif isinstance(value, QtGui.QColor):
- return '(%u,%u,%u,%u)' % (value.red(), value.green(), value.blue(), value.alpha())
- elif isinstance(value, (QtCore.QDate, QtCore.QDateTime, QtCore.QTime)):
- return value.toString(QtCore.Qt.ISODate)
- elif isinstance(value, QtCore.QPoint):
- return '(%d,%d)' % (value.x(), value.y())
- elif isinstance(value, QtCore.QRect):
- return '(%d,%d,%d,%d)' % (value.x(), value.y(), value.width(), value.height())
- elif isinstance(value, QtCore.QSize):
- return '(%d,%d)' % (value.width(), value.height())
- elif isinstance(value, list):
+ if isinstance(value, bool):
+ return '✓' if value else '☐'
+ if isinstance(value, (int, float, QByteArray)):
+ return str(value)
+ if isinstance(value, QColor):
+ return '({},{},{},{})'.format(value.red(), value.green(),
+ value.blue(), value.alpha())
+ if isinstance(value, (QDate, QDateTime, QTime)):
+ return value.toString(Qt.ISODate)
+ if isinstance(value, QPoint):
+ return '({},{})'.format(value.x(), value.y())
+ if isinstance(value, QRect):
+ return '({},{},{},{})'.format(value.x(), value.y(), value.width(),
+ value.height())
+ if isinstance(value, QSize):
+ return '({},{})'.format(value.width(), value.height())
+ if isinstance(value, list):
return ','.join(value)
- elif value is None:
+ if value is None:
return '<Invalid>'
- return '<%s>' % value
+ return '<{}>'.format(value)
if __name__ == '__main__':
- app = QtWidgets.QApplication(sys.argv)
- mainWin = MainWindow()
- mainWin.show()
+ app = QApplication(sys.argv)
+ main_win = MainWindow()
+ if len(sys.argv) > 1:
+ main_win.load_ini_file(sys.argv[1])
+ main_win.show()
sys.exit(app.exec_())
diff --git a/examples/external/matplotlib/widget_3dplot.py b/examples/external/matplotlib/widget_3dplot.py
index b9640566..6f47da31 100644
--- a/examples/external/matplotlib/widget_3dplot.py
+++ b/examples/external/matplotlib/widget_3dplot.py
@@ -45,8 +45,8 @@ from matplotlib.backends.backend_qt5agg import FigureCanvas
from matplotlib.figure import Figure
from mpl_toolkits.mplot3d import axes3d
from PySide2.QtCore import Qt, Slot
-from PySide2.QtGui import QKeySequence
-from PySide2.QtWidgets import (QAction, QApplication, QComboBox, QHBoxLayout,
+from PySide2.QtGui import QAction, QKeySequence
+from PySide2.QtWidgets import (QApplication, QComboBox, QHBoxLayout,
QHeaderView, QLabel, QMainWindow, QSlider,
QTableWidget, QTableWidgetItem, QVBoxLayout,
QWidget)
diff --git a/examples/external/opencv/webcam_pattern_detection.py b/examples/external/opencv/webcam_pattern_detection.py
index 55326161..664ba211 100644
--- a/examples/external/opencv/webcam_pattern_detection.py
+++ b/examples/external/opencv/webcam_pattern_detection.py
@@ -44,8 +44,8 @@ import time
import cv2
from PySide2.QtCore import Qt, QThread, Signal, Slot
-from PySide2.QtGui import QImage, QKeySequence, QPixmap
-from PySide2.QtWidgets import (QAction, QApplication, QComboBox, QGroupBox,
+from PySide2.QtGui import QAction, QImage, QKeySequence, QPixmap
+from PySide2.QtWidgets import (QApplication, QComboBox, QGroupBox,
QHBoxLayout, QLabel, QMainWindow, QPushButton,
QSizePolicy, QVBoxLayout, QWidget)
diff --git a/examples/external/scikit/staining_colors_separation.py b/examples/external/scikit/staining_colors_separation.py
index 051b2bc2..d2145392 100644
--- a/examples/external/scikit/staining_colors_separation.py
+++ b/examples/external/scikit/staining_colors_separation.py
@@ -45,8 +45,8 @@ from matplotlib.backends.backend_qt5agg import FigureCanvas
from matplotlib.colors import LinearSegmentedColormap
from matplotlib.figure import Figure
from PySide2.QtCore import Qt, Slot
-from PySide2.QtGui import QKeySequence
-from PySide2.QtWidgets import (QAction, QApplication, QHBoxLayout, QLabel,
+from PySide2.QtGui import QAction, QKeySequence
+from PySide2.QtWidgets import (QApplication, QHBoxLayout, QLabel,
QMainWindow, QPushButton, QSizePolicy,
QVBoxLayout, QWidget)
from skimage import data
diff --git a/examples/multimedia/camera.py b/examples/multimedia/camera.py
index d58b526d..644b5340 100644
--- a/examples/multimedia/camera.py
+++ b/examples/multimedia/camera.py
@@ -43,9 +43,9 @@
import os, sys
from PySide2.QtCore import QDate, QDir, QStandardPaths, Qt, QUrl
-from PySide2.QtGui import QGuiApplication, QDesktopServices, QIcon
+from PySide2.QtGui import QAction, QGuiApplication, QDesktopServices, QIcon
from PySide2.QtGui import QImage, QPixmap
-from PySide2.QtWidgets import (QAction, QApplication, QHBoxLayout, QLabel,
+from PySide2.QtWidgets import (QApplication, QHBoxLayout, QLabel,
QMainWindow, QPushButton, QTabWidget, QToolBar, QVBoxLayout, QWidget)
from PySide2.QtMultimedia import QCamera, QCameraImageCapture, QCameraInfo
from PySide2.QtMultimediaWidgets import QCameraViewfinder
diff --git a/examples/multimedia/player.py b/examples/multimedia/player.py
index cb70e50d..762d26b7 100644
--- a/examples/multimedia/player.py
+++ b/examples/multimedia/player.py
@@ -43,8 +43,8 @@
import sys
from PySide2.QtCore import QStandardPaths, Qt
-from PySide2.QtGui import QIcon, QKeySequence
-from PySide2.QtWidgets import (QAction, QApplication, QDialog, QFileDialog,
+from PySide2.QtGui import QAction, QIcon, QKeySequence
+from PySide2.QtWidgets import (QApplication, QDialog, QFileDialog,
QMainWindow, QSlider, QStyle, QToolBar)
from PySide2.QtMultimedia import QMediaPlayer, QMediaPlaylist
from PySide2.QtMultimediaWidgets import QVideoWidget
@@ -137,7 +137,7 @@ class MainWindow(QMainWindow):
if self.player.position() <= 5000:
self.playlist.previous()
else:
- player.setPosition(0)
+ self.player.setPosition(0)
def updateButtons(self, state):
mediaCount = self.playlist.mediaCount()
diff --git a/examples/network/fortuneclient.py b/examples/network/fortuneclient.py
index c774973c..00247eee 100644
--- a/examples/network/fortuneclient.py
+++ b/examples/network/fortuneclient.py
@@ -83,7 +83,7 @@ class Client(QtWidgets.QDialog):
self.getFortuneButton.clicked.connect(self.requestNewFortune)
quitButton.clicked.connect(self.close)
self.tcpSocket.readyRead.connect(self.readFortune)
- self.tcpSocket.error.connect(self.displayError)
+ self.tcpSocket.errorOccurred.connect(self.displayError)
mainLayout = QtWidgets.QGridLayout()
mainLayout.addWidget(hostLabel, 0, 0)
diff --git a/examples/opengl/2dpainting.py b/examples/opengl/2dpainting.py
deleted file mode 100644
index 5b3ba618..00000000
--- a/examples/opengl/2dpainting.py
+++ /dev/null
@@ -1,172 +0,0 @@
-
-############################################################################
-##
-## Copyright (C) 2013 Riverbank Computing Limited.
-## Copyright (C) 2016 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$
-##
-############################################################################
-
-"""PySide2 port of the opengl/legacy/2dpainting example from Qt v5.x"""
-
-import sys
-from PySide2.QtCore import *
-from PySide2.QtGui import *
-from PySide2.QtWidgets import *
-from PySide2.QtOpenGL import *
-
-try:
- from OpenGL import GL
-except ImportError:
- app = QApplication(sys.argv)
- messageBox = QMessageBox(QMessageBox.Critical, "OpenGL 2dpainting",
- "PyOpenGL must be installed to run this example.",
- QMessageBox.Close)
- messageBox.setDetailedText("Run:\npip install PyOpenGL PyOpenGL_accelerate")
- messageBox.exec_()
- sys.exit(1)
-
-
-class Helper:
- def __init__(self):
- gradient = QLinearGradient(QPointF(50, -20), QPointF(80, 20))
- gradient.setColorAt(0.0, Qt.white)
- gradient.setColorAt(1.0, QColor(0xa6, 0xce, 0x39))
-
- self.background = QBrush(QColor(64, 32, 64))
- self.circleBrush = QBrush(gradient)
- self.circlePen = QPen(Qt.black)
- self.circlePen.setWidth(1)
- self.textPen = QPen(Qt.white)
- self.textFont = QFont()
- self.textFont.setPixelSize(50)
-
- def paint(self, painter, event, elapsed):
- painter.fillRect(event.rect(), self.background)
- painter.translate(100, 100)
-
- painter.save()
- painter.setBrush(self.circleBrush)
- painter.setPen(self.circlePen)
- painter.rotate(elapsed * 0.030)
-
- r = elapsed/1000.0
- n = 30
- for i in range(n):
- painter.rotate(30)
- radius = 0 + 120.0*((i+r)/n)
- circleRadius = 1 + ((i+r)/n)*20
- painter.drawEllipse(QRectF(radius, -circleRadius,
- circleRadius*2, circleRadius*2))
-
- painter.restore()
-
- painter.setPen(self.textPen)
- painter.setFont(self.textFont)
- painter.drawText(QRect(-50, -50, 100, 100), Qt.AlignCenter, "Qt")
-
-
-class Widget(QWidget):
- def __init__(self, helper, parent = None):
- QWidget.__init__(self, parent)
-
- self.helper = helper
- self.elapsed = 0
- self.setFixedSize(200, 200)
-
- def animate(self):
- self.elapsed = (self.elapsed + self.sender().interval()) % 1000
- self.repaint()
-
- def paintEvent(self, event):
- painter = QPainter()
- painter.begin(self)
- painter.setRenderHint(QPainter.Antialiasing)
- self.helper.paint(painter, event, self.elapsed)
- painter.end()
-
-
-class GLWidget(QGLWidget):
- def __init__(self, helper, parent = None):
- QGLWidget.__init__(self, QGLFormat(QGL.SampleBuffers), parent)
-
- self.helper = helper
- self.elapsed = 0
- self.setFixedSize(200, 200)
-
- def animate(self):
- self.elapsed = (self.elapsed + self.sender().interval()) % 1000
- self.repaint()
-
- def paintEvent(self, event):
- painter = QPainter()
- painter.begin(self)
- self.helper.paint(painter, event, self.elapsed)
- painter.end()
-
-
-class Window(QWidget):
- def __init__(self, parent = None):
- QWidget.__init__(self, parent)
-
- helper = Helper()
- native = Widget(helper, self)
- openGL = GLWidget(helper, self)
- nativeLabel = QLabel(self.tr("Native"))
- nativeLabel.setAlignment(Qt.AlignHCenter)
- openGLLabel = QLabel(self.tr("OpenGL"))
- openGLLabel.setAlignment(Qt.AlignHCenter)
-
- layout = QGridLayout()
- layout.addWidget(native, 0, 0)
- layout.addWidget(openGL, 0, 1)
- layout.addWidget(nativeLabel, 1, 0)
- layout.addWidget(openGLLabel, 1, 1)
- self.setLayout(layout)
-
- timer = QTimer(self)
- self.connect(timer, SIGNAL("timeout()"), native.animate)
- self.connect(timer, SIGNAL("timeout()"), openGL.animate)
- timer.start(50)
-
- self.setWindowTitle(self.tr("2D Painting on Native and OpenGL Widgets"))
-
-
-if __name__ == '__main__':
- app = QApplication(sys.argv)
- window = Window()
- window.show()
- sys.exit(app.exec_())
diff --git a/examples/opengl/contextinfo.py b/examples/opengl/contextinfo.py
index a963b895..fce400e7 100644
--- a/examples/opengl/contextinfo.py
+++ b/examples/opengl/contextinfo.py
@@ -48,8 +48,9 @@ from textwrap import dedent
from PySide2.QtCore import QCoreApplication, QLibraryInfo, QSize, QTimer, Qt
-from PySide2.QtGui import (QMatrix4x4, QOpenGLBuffer, QOpenGLContext, QOpenGLShader,
- QOpenGLShaderProgram, QOpenGLVertexArrayObject, QSurfaceFormat, QWindow)
+from PySide2.QtGui import (QMatrix4x4, QOpenGLContext, QSurfaceFormat, QWindow)
+from PySide2.QtOpenGL import (QOpenGLBuffer, QOpenGLShader,
+ QOpenGLShaderProgram, QOpenGLVertexArrayObject)
from PySide2.QtWidgets import (QApplication, QHBoxLayout, QMessageBox, QPlainTextEdit,
QWidget)
from PySide2.support import VoidPtr
diff --git a/examples/opengl/grabber.py b/examples/opengl/grabber.py
deleted file mode 100644
index d4b62571..00000000
--- a/examples/opengl/grabber.py
+++ /dev/null
@@ -1,435 +0,0 @@
-
-############################################################################
-##
-## Copyright (C) 2013 Riverbank Computing Limited.
-## Copyright (C) 2016 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$
-##
-############################################################################
-
-"""PySide2 port of the opengl/legacy/grabber example from Qt v5.x"""
-
-import sys
-import math
-
-from PySide2 import QtCore, QtGui, QtWidgets, QtOpenGL
-
-try:
- from OpenGL.GL import *
-except ImportError:
- app = QtWidgets.QApplication(sys.argv)
- messageBox = QtWidgets.QMessageBox(QtWidgets.QMessageBox.Critical, "OpenGL grabber",
- "PyOpenGL must be installed to run this example.",
- QtWidgets.QMessageBox.Close)
- messageBox.setDetailedText("Run:\npip install PyOpenGL PyOpenGL_accelerate")
- messageBox.exec_()
- sys.exit(1)
-
-
-class GLWidget(QtOpenGL.QGLWidget):
- xRotationChanged = QtCore.Signal(int)
- yRotationChanged = QtCore.Signal(int)
- zRotationChanged = QtCore.Signal(int)
-
- def __init__(self, parent=None):
- super(GLWidget, self).__init__(parent)
-
- self.gear1 = 0
- self.gear2 = 0
- self.gear3 = 0
- self.xRot = 0
- self.yRot = 0
- self.zRot = 0
- self.gear1Rot = 0
-
- timer = QtCore.QTimer(self)
- timer.timeout.connect(self.advanceGears)
- timer.start(20)
-
- def freeResources(self):
- self.makeCurrent()
- glDeleteLists(self.gear1, 1)
- glDeleteLists(self.gear2, 1)
- glDeleteLists(self.gear3, 1)
-
- def setXRotation(self, angle):
- self.normalizeAngle(angle)
-
- if angle != self.xRot:
- self.xRot = angle
- self.xRotationChanged.emit(angle)
- self.updateGL()
-
- def setYRotation(self, angle):
- self.normalizeAngle(angle)
-
- if angle != self.yRot:
- self.yRot = angle
- self.yRotationChanged.emit(angle)
- self.updateGL()
-
- def setZRotation(self, angle):
- self.normalizeAngle(angle)
-
- if angle != self.zRot:
- self.zRot = angle
- self.zRotationChanged.emit(angle)
- self.updateGL()
-
- def initializeGL(self):
- lightPos = (5.0, 5.0, 10.0, 1.0)
- reflectance1 = (0.8, 0.1, 0.0, 1.0)
- reflectance2 = (0.0, 0.8, 0.2, 1.0)
- reflectance3 = (0.2, 0.2, 1.0, 1.0)
-
- glLightfv(GL_LIGHT0, GL_POSITION, lightPos)
- glEnable(GL_LIGHTING)
- glEnable(GL_LIGHT0)
- glEnable(GL_DEPTH_TEST)
-
- self.gear1 = self.makeGear(reflectance1, 1.0, 4.0, 1.0, 0.7, 20)
- self.gear2 = self.makeGear(reflectance2, 0.5, 2.0, 2.0, 0.7, 10)
- self.gear3 = self.makeGear(reflectance3, 1.3, 2.0, 0.5, 0.7, 10)
-
- glEnable(GL_NORMALIZE)
- glClearColor(0.0, 0.0, 0.0, 1.0)
-
- def paintGL(self):
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
-
- glPushMatrix()
- glRotated(self.xRot / 16.0, 1.0, 0.0, 0.0)
- glRotated(self.yRot / 16.0, 0.0, 1.0, 0.0)
- glRotated(self.zRot / 16.0, 0.0, 0.0, 1.0)
-
- self.drawGear(self.gear1, -3.0, -2.0, 0.0, self.gear1Rot / 16.0)
- self.drawGear(self.gear2, +3.1, -2.0, 0.0,
- -2.0 * (self.gear1Rot / 16.0) - 9.0)
-
- glRotated(+90.0, 1.0, 0.0, 0.0)
- self.drawGear(self.gear3, -3.1, -1.8, -2.2,
- +2.0 * (self.gear1Rot / 16.0) - 2.0)
-
- glPopMatrix()
-
- def resizeGL(self, width, height):
- side = min(width, height)
- if side < 0:
- return
-
- glViewport(int((width - side) / 2), int((height - side) / 2), side, side)
-
- glMatrixMode(GL_PROJECTION)
- glLoadIdentity()
- glFrustum(-1.0, +1.0, -1.0, 1.0, 5.0, 60.0)
- glMatrixMode(GL_MODELVIEW)
- glLoadIdentity()
- glTranslated(0.0, 0.0, -40.0)
-
- def mousePressEvent(self, event):
- self.lastPos = event.pos()
-
- def mouseMoveEvent(self, event):
- dx = event.x() - self.lastPos.x()
- dy = event.y() - self.lastPos.y()
-
- if event.buttons() & QtCore.Qt.LeftButton:
- self.setXRotation(self.xRot + 8 * dy)
- self.setYRotation(self.yRot + 8 * dx)
- elif event.buttons() & QtCore.Qt.RightButton:
- self.setXRotation(self.xRot + 8 * dy)
- self.setZRotation(self.zRot + 8 * dx)
-
- self.lastPos = event.pos()
-
- def advanceGears(self):
- self.gear1Rot += 2 * 16
- self.updateGL()
-
- def xRotation(self):
- return self.xRot
-
- def yRotation(self):
- return self.yRot
-
- def zRotation(self):
- return self.zRot
-
- def makeGear(self, reflectance, innerRadius, outerRadius, thickness, toothSize, toothCount):
- list = glGenLists(1)
- glNewList(list, GL_COMPILE)
- glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, reflectance)
-
- r0 = innerRadius
- r1 = outerRadius - toothSize / 2.0
- r2 = outerRadius + toothSize / 2.0
- delta = (2.0 * math.pi / toothCount) / 4.0
- z = thickness / 2.0
-
- glShadeModel(GL_FLAT)
-
- for i in range(2):
- if i == 0:
- sign = +1.0
- else:
- sign = -1.0
-
- glNormal3d(0.0, 0.0, sign)
-
- glBegin(GL_QUAD_STRIP)
-
- for j in range(toothCount+1):
- angle = 2.0 * math.pi * j / toothCount
- glVertex3d(r0 * math.cos(angle), r0 * math.sin(angle), sign * z)
- glVertex3d(r1 * math.cos(angle), r1 * math.sin(angle), sign * z)
- glVertex3d(r0 * math.cos(angle), r0 * math.sin(angle), sign * z)
- glVertex3d(r1 * math.cos(angle + 3 * delta), r1 * math.sin(angle + 3 * delta), sign * z)
-
- glEnd()
-
- glBegin(GL_QUADS)
-
- for j in range(toothCount):
- angle = 2.0 * math.pi * j / toothCount
- glVertex3d(r1 * math.cos(angle), r1 * math.sin(angle), sign * z)
- glVertex3d(r2 * math.cos(angle + delta), r2 * math.sin(angle + delta), sign * z)
- glVertex3d(r2 * math.cos(angle + 2 * delta), r2 * math.sin(angle + 2 * delta), sign * z)
- glVertex3d(r1 * math.cos(angle + 3 * delta), r1 * math.sin(angle + 3 * delta), sign * z)
-
- glEnd()
-
- glBegin(GL_QUAD_STRIP)
-
- for i in range(toothCount):
- for j in range(2):
- angle = 2.0 * math.pi * (i + (j / 2.0)) / toothCount
- s1 = r1
- s2 = r2
-
- if j == 1:
- s1, s2 = s2, s1
-
- glNormal3d(math.cos(angle), math.sin(angle), 0.0)
- glVertex3d(s1 * math.cos(angle), s1 * math.sin(angle), +z)
- glVertex3d(s1 * math.cos(angle), s1 * math.sin(angle), -z)
-
- glNormal3d(s2 * math.sin(angle + delta) - s1 * math.sin(angle), s1 * math.cos(angle) - s2 * math.cos(angle + delta), 0.0)
- glVertex3d(s2 * math.cos(angle + delta), s2 * math.sin(angle + delta), +z)
- glVertex3d(s2 * math.cos(angle + delta), s2 * math.sin(angle + delta), -z)
-
- glVertex3d(r1, 0.0, +z)
- glVertex3d(r1, 0.0, -z)
- glEnd()
-
- glShadeModel(GL_SMOOTH)
-
- glBegin(GL_QUAD_STRIP)
-
- for i in range(toothCount+1):
- angle = i * 2.0 * math.pi / toothCount
- glNormal3d(-math.cos(angle), -math.sin(angle), 0.0)
- glVertex3d(r0 * math.cos(angle), r0 * math.sin(angle), +z)
- glVertex3d(r0 * math.cos(angle), r0 * math.sin(angle), -z)
-
- glEnd()
-
- glEndList()
-
- return list
-
- def drawGear(self, gear, dx, dy, dz, angle):
- glPushMatrix()
- glTranslated(dx, dy, dz)
- glRotated(angle, 0.0, 0.0, 1.0)
- glCallList(gear)
- glPopMatrix()
-
- def normalizeAngle(self, angle):
- while (angle < 0):
- angle += 360 * 16
-
- while (angle > 360 * 16):
- angle -= 360 * 16
-
-
-class MainWindow(QtWidgets.QMainWindow):
- def __init__(self):
- super(MainWindow, self).__init__()
-
- centralWidget = QtWidgets.QWidget()
- self.setCentralWidget(centralWidget)
-
- self.glWidget = GLWidget()
- self.pixmapLabel = QtWidgets.QLabel()
-
- self.glWidgetArea = QtWidgets.QScrollArea()
- self.glWidgetArea.setWidget(self.glWidget)
- self.glWidgetArea.setWidgetResizable(True)
- self.glWidgetArea.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
- self.glWidgetArea.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
- self.glWidgetArea.setSizePolicy(QtWidgets.QSizePolicy.Ignored,
- QtWidgets.QSizePolicy.Ignored)
- self.glWidgetArea.setMinimumSize(50, 50)
-
- self.pixmapLabelArea = QtWidgets.QScrollArea()
- self.pixmapLabelArea.setWidget(self.pixmapLabel)
- self.pixmapLabelArea.setSizePolicy(QtWidgets.QSizePolicy.Ignored,
- QtWidgets.QSizePolicy.Ignored)
- self.pixmapLabelArea.setMinimumSize(50, 50)
-
- xSlider = self.createSlider(self.glWidget.xRotationChanged,
- self.glWidget.setXRotation)
- ySlider = self.createSlider(self.glWidget.yRotationChanged,
- self.glWidget.setYRotation)
- zSlider = self.createSlider(self.glWidget.zRotationChanged,
- self.glWidget.setZRotation)
-
- self.createActions()
- self.createMenus()
-
- centralLayout = QtWidgets.QGridLayout()
- centralLayout.addWidget(self.glWidgetArea, 0, 0)
- centralLayout.addWidget(self.pixmapLabelArea, 0, 1)
- centralLayout.addWidget(xSlider, 1, 0, 1, 2)
- centralLayout.addWidget(ySlider, 2, 0, 1, 2)
- centralLayout.addWidget(zSlider, 3, 0, 1, 2)
- centralWidget.setLayout(centralLayout)
-
- xSlider.setValue(15 * 16)
- ySlider.setValue(345 * 16)
- zSlider.setValue(0 * 16)
-
- self.setWindowTitle("Grabber")
- self.resize(400, 300)
-
- def renderIntoPixmap(self):
- size = self.getSize()
-
- if size.isValid():
- pixmap = self.glWidget.renderPixmap(size.width(), size.height())
- self.setPixmap(pixmap)
-
- def grabFrameBuffer(self):
- image = self.glWidget.grabFrameBuffer()
- self.setPixmap(QtGui.QPixmap.fromImage(image))
-
- def clearPixmap(self):
- self.setPixmap(QtGui.QPixmap())
-
- def about(self):
- QtWidgets.QMessageBox.about(self, "About Grabber",
- "The <b>Grabber</b> example demonstrates two approaches for "
- "rendering OpenGL into a Qt pixmap.")
-
- def createActions(self):
- self.renderIntoPixmapAct = QtWidgets.QAction("&Render into Pixmap...",
- self, shortcut="Ctrl+R", triggered=self.renderIntoPixmap)
-
- self.grabFrameBufferAct = QtWidgets.QAction("&Grab Frame Buffer", self,
- shortcut="Ctrl+G", triggered=self.grabFrameBuffer)
-
- self.clearPixmapAct = QtWidgets.QAction("&Clear Pixmap", self,
- shortcut="Ctrl+L", triggered=self.clearPixmap)
-
- self.exitAct = QtWidgets.QAction("E&xit", self, shortcut="Ctrl+Q",
- triggered=self.close)
-
- self.aboutAct = QtWidgets.QAction("&About", self, triggered=self.about)
-
- self.aboutQtAct = QtWidgets.QAction("About &Qt", self,
- triggered=qApp.aboutQt)
-
- def createMenus(self):
- self.fileMenu = self.menuBar().addMenu("&File")
- self.fileMenu.addAction(self.renderIntoPixmapAct)
- self.fileMenu.addAction(self.grabFrameBufferAct)
- self.fileMenu.addAction(self.clearPixmapAct)
- self.fileMenu.addSeparator()
- self.fileMenu.addAction(self.exitAct)
-
- self.helpMenu = self.menuBar().addMenu("&Help")
- self.helpMenu.addAction(self.aboutAct)
- self.helpMenu.addAction(self.aboutQtAct)
-
- def createSlider(self, changedSignal, setterSlot):
- slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
- slider.setRange(0, 360 * 16)
- slider.setSingleStep(16)
- slider.setPageStep(15 * 16)
- slider.setTickInterval(15 * 16)
- slider.setTickPosition(QtWidgets.QSlider.TicksRight)
-
- slider.valueChanged.connect(setterSlot)
- changedSignal.connect(slider.setValue)
-
- return slider
-
- def setPixmap(self, pixmap):
- self.pixmapLabel.setPixmap(pixmap)
- size = pixmap.size()
-
- if size - QtCore.QSize(1, 0) == self.pixmapLabelArea.maximumViewportSize():
- size -= QtCore.QSize(1, 0)
-
- self.pixmapLabel.resize(size)
-
- def getSize(self):
- text, ok = QtWidgets.QInputDialog.getText(self, "Grabber",
- "Enter pixmap size:", QtWidgets.QLineEdit.Normal,
- "%d x %d" % (self.glWidget.width(), self.glWidget.height()))
-
- if not ok:
- return QtCore.QSize()
-
- regExp = QtCore.QRegExp("([0-9]+) *x *([0-9]+)")
-
- if regExp.exactMatch(text):
- width = int(regExp.cap(1))
- height = int(regExp.cap(2))
- if width > 0 and width < 2048 and height > 0 and height < 2048:
- return QtCore.QSize(width, height)
-
- return self.glWidget.size()
-
-
-if __name__ == '__main__':
-
- app = QtWidgets.QApplication(sys.argv)
- mainWin = MainWindow()
- mainWin.show()
- res = app.exec_()
- mainWin.glWidget.freeResources()
- sys.exit(res)
diff --git a/examples/opengl/hellogl.py b/examples/opengl/hellogl.py
deleted file mode 100644
index f3aa73ad..00000000
--- a/examples/opengl/hellogl.py
+++ /dev/null
@@ -1,287 +0,0 @@
-
-############################################################################
-##
-## Copyright (C) 2013 Riverbank Computing Limited.
-## Copyright (C) 2016 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$
-##
-############################################################################
-
-"""PySide2 port of the opengl/legacy/hellogl example from Qt v5.x"""
-
-import sys
-import math
-from PySide2 import QtCore, QtGui, QtWidgets, QtOpenGL
-
-try:
- from OpenGL import GL
-except ImportError:
- app = QtWidgets.QApplication(sys.argv)
- messageBox = QtWidgets.QMessageBox(QtWidgets.QMessageBox.Critical, "OpenGL hellogl",
- "PyOpenGL must be installed to run this example.",
- QtWidgets.QMessageBox.Close)
- messageBox.setDetailedText("Run:\npip install PyOpenGL PyOpenGL_accelerate")
- messageBox.exec_()
- sys.exit(1)
-
-
-class Window(QtWidgets.QWidget):
- def __init__(self, parent=None):
- QtWidgets.QWidget.__init__(self, parent)
-
- self.glWidget = GLWidget()
-
- self.xSlider = self.createSlider(QtCore.SIGNAL("xRotationChanged(int)"),
- self.glWidget.setXRotation)
- self.ySlider = self.createSlider(QtCore.SIGNAL("yRotationChanged(int)"),
- self.glWidget.setYRotation)
- self.zSlider = self.createSlider(QtCore.SIGNAL("zRotationChanged(int)"),
- self.glWidget.setZRotation)
-
- mainLayout = QtWidgets.QHBoxLayout()
- mainLayout.addWidget(self.glWidget)
- mainLayout.addWidget(self.xSlider)
- mainLayout.addWidget(self.ySlider)
- mainLayout.addWidget(self.zSlider)
- self.setLayout(mainLayout)
-
- self.xSlider.setValue(170 * 16)
- self.ySlider.setValue(160 * 16)
- self.zSlider.setValue(90 * 16)
-
- self.setWindowTitle(self.tr("Hello GL"))
-
- def createSlider(self, changedSignal, setterSlot):
- slider = QtWidgets.QSlider(QtCore.Qt.Vertical)
-
- slider.setRange(0, 360 * 16)
- slider.setSingleStep(16)
- slider.setPageStep(15 * 16)
- slider.setTickInterval(15 * 16)
- slider.setTickPosition(QtWidgets.QSlider.TicksRight)
-
- self.glWidget.connect(slider, QtCore.SIGNAL("valueChanged(int)"), setterSlot)
- self.connect(self.glWidget, changedSignal, slider, QtCore.SLOT("setValue(int)"))
-
- return slider
-
-
-class GLWidget(QtOpenGL.QGLWidget):
- xRotationChanged = QtCore.Signal(int)
- yRotationChanged = QtCore.Signal(int)
- zRotationChanged = QtCore.Signal(int)
-
- def __init__(self, parent=None):
- QtOpenGL.QGLWidget.__init__(self, parent)
-
- self.object = 0
- self.xRot = 0
- self.yRot = 0
- self.zRot = 0
-
- self.lastPos = QtCore.QPoint()
-
- self.trolltechGreen = QtGui.QColor.fromCmykF(0.40, 0.0, 1.0, 0.0)
- self.trolltechPurple = QtGui.QColor.fromCmykF(0.39, 0.39, 0.0, 0.0)
-
- def xRotation(self):
- return self.xRot
-
- def yRotation(self):
- return self.yRot
-
- def zRotation(self):
- return self.zRot
-
- def minimumSizeHint(self):
- return QtCore.QSize(50, 50)
-
- def sizeHint(self):
- return QtCore.QSize(400, 400)
-
- def setXRotation(self, angle):
- angle = self.normalizeAngle(angle)
- if angle != self.xRot:
- self.xRot = angle
- self.emit(QtCore.SIGNAL("xRotationChanged(int)"), angle)
- self.updateGL()
-
- def setYRotation(self, angle):
- angle = self.normalizeAngle(angle)
- if angle != self.yRot:
- self.yRot = angle
- self.emit(QtCore.SIGNAL("yRotationChanged(int)"), angle)
- self.updateGL()
-
- def setZRotation(self, angle):
- angle = self.normalizeAngle(angle)
- if angle != self.zRot:
- self.zRot = angle
- self.emit(QtCore.SIGNAL("zRotationChanged(int)"), angle)
- self.updateGL()
-
- def initializeGL(self):
- self.qglClearColor(self.trolltechPurple.darker())
- self.object = self.makeObject()
- GL.glShadeModel(GL.GL_FLAT)
- GL.glEnable(GL.GL_DEPTH_TEST)
- GL.glEnable(GL.GL_CULL_FACE)
-
- def paintGL(self):
- GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT)
- GL.glLoadIdentity()
- GL.glTranslated(0.0, 0.0, -10.0)
- GL.glRotated(self.xRot / 16.0, 1.0, 0.0, 0.0)
- GL.glRotated(self.yRot / 16.0, 0.0, 1.0, 0.0)
- GL.glRotated(self.zRot / 16.0, 0.0, 0.0, 1.0)
- GL.glCallList(self.object)
-
- def resizeGL(self, width, height):
- side = min(width, height)
- GL.glViewport(int((width - side) / 2),int((height - side) / 2), side, side)
-
- GL.glMatrixMode(GL.GL_PROJECTION)
- GL.glLoadIdentity()
- GL.glOrtho(-0.5, +0.5, -0.5, +0.5, 4.0, 15.0)
- GL.glMatrixMode(GL.GL_MODELVIEW)
-
- def mousePressEvent(self, event):
- self.lastPos = QtCore.QPoint(event.pos())
-
- def mouseMoveEvent(self, event):
- dx = event.x() - self.lastPos.x()
- dy = event.y() - self.lastPos.y()
-
- if event.buttons() & QtCore.Qt.LeftButton:
- self.setXRotation(self.xRot + 8 * dy)
- self.setYRotation(self.yRot + 8 * dx)
- elif event.buttons() & QtCore.Qt.RightButton:
- self.setXRotation(self.xRot + 8 * dy)
- self.setZRotation(self.zRot + 8 * dx)
-
- self.lastPos = QtCore.QPoint(event.pos())
-
- def makeObject(self):
- genList = GL.glGenLists(1)
- GL.glNewList(genList, GL.GL_COMPILE)
-
- GL.glBegin(GL.GL_QUADS)
-
- x1 = +0.06
- y1 = -0.14
- x2 = +0.14
- y2 = -0.06
- x3 = +0.08
- y3 = +0.00
- x4 = +0.30
- y4 = +0.22
-
- self.quad(x1, y1, x2, y2, y2, x2, y1, x1)
- self.quad(x3, y3, x4, y4, y4, x4, y3, x3)
-
- self.extrude(x1, y1, x2, y2)
- self.extrude(x2, y2, y2, x2)
- self.extrude(y2, x2, y1, x1)
- self.extrude(y1, x1, x1, y1)
- self.extrude(x3, y3, x4, y4)
- self.extrude(x4, y4, y4, x4)
- self.extrude(y4, x4, y3, x3)
-
- Pi = 3.14159265358979323846
- NumSectors = 200
-
- for i in range(NumSectors):
- angle1 = (i * 2 * Pi) / NumSectors
- x5 = 0.30 * math.sin(angle1)
- y5 = 0.30 * math.cos(angle1)
- x6 = 0.20 * math.sin(angle1)
- y6 = 0.20 * math.cos(angle1)
-
- angle2 = ((i + 1) * 2 * Pi) / NumSectors
- x7 = 0.20 * math.sin(angle2)
- y7 = 0.20 * math.cos(angle2)
- x8 = 0.30 * math.sin(angle2)
- y8 = 0.30 * math.cos(angle2)
-
- self.quad(x5, y5, x6, y6, x7, y7, x8, y8)
-
- self.extrude(x6, y6, x7, y7)
- self.extrude(x8, y8, x5, y5)
-
- GL.glEnd()
- GL.glEndList()
-
- return genList
-
- def quad(self, x1, y1, x2, y2, x3, y3, x4, y4):
- self.qglColor(self.trolltechGreen)
-
- GL.glVertex3d(x1, y1, +0.05)
- GL.glVertex3d(x2, y2, +0.05)
- GL.glVertex3d(x3, y3, +0.05)
- GL.glVertex3d(x4, y4, +0.05)
-
- GL.glVertex3d(x4, y4, -0.05)
- GL.glVertex3d(x3, y3, -0.05)
- GL.glVertex3d(x2, y2, -0.05)
- GL.glVertex3d(x1, y1, -0.05)
-
- def extrude(self, x1, y1, x2, y2):
- self.qglColor(self.trolltechGreen.darker(250 + int(100 * x1)))
-
- GL.glVertex3d(x1, y1, -0.05)
- GL.glVertex3d(x2, y2, -0.05)
- GL.glVertex3d(x2, y2, +0.05)
- GL.glVertex3d(x1, y1, +0.05)
-
- def normalizeAngle(self, angle):
- while angle < 0:
- angle += 360 * 16
- while angle > 360 * 16:
- angle -= 360 * 16
- return angle
-
- def freeResources(self):
- self.makeCurrent()
- GL.glDeleteLists(self.object, 1)
-
-if __name__ == '__main__':
- app = QtWidgets.QApplication(sys.argv)
- window = Window()
- window.show()
- res = app.exec_()
- window.glWidget.freeResources()
- sys.exit(res)
diff --git a/examples/opengl/hellogl2.py b/examples/opengl/hellogl2.py
index ad3562f0..b12a7b27 100644
--- a/examples/opengl/hellogl2.py
+++ b/examples/opengl/hellogl2.py
@@ -47,10 +47,14 @@ import math
import numpy
import ctypes
from PySide2.QtCore import QCoreApplication, Signal, SIGNAL, SLOT, Qt, QSize, QPoint
-from PySide2.QtGui import (QVector3D, QOpenGLFunctions, QOpenGLVertexArrayObject, QOpenGLBuffer,
- QOpenGLShaderProgram, QMatrix4x4, QOpenGLShader, QOpenGLContext, QSurfaceFormat)
-from PySide2.QtWidgets import (QApplication, QWidget, QMessageBox, QHBoxLayout, QSlider,
- QOpenGLWidget)
+from PySide2.QtGui import (QVector3D, QOpenGLFunctions,
+ QMatrix4x4, QOpenGLContext, QSurfaceFormat)
+from PySide2.QtOpenGL import (QOpenGLVertexArrayObject, QOpenGLBuffer,
+ QOpenGLShaderProgram, QOpenGLShader)
+from PySide2.QtWidgets import (QApplication, QWidget, QMessageBox, QHBoxLayout,
+ QSlider)
+from PySide2.QtOpenGLWidgets import QOpenGLWidget
+
from shiboken2 import VoidPtr
try:
diff --git a/examples/opengl/opengl.pyproject b/examples/opengl/opengl.pyproject
index 12f435da..20b289d7 100644
--- a/examples/opengl/opengl.pyproject
+++ b/examples/opengl/opengl.pyproject
@@ -1,5 +1,3 @@
{
- "files": ["grabber.py", "samplebuffers.py", "hellogl.py",
- "hellogl2.py", "contextinfo.py", "2dpainting.py",
- "overpainting.py"]
+ "files": ["hellogl2.py", "contextinfo.py"]
}
diff --git a/examples/opengl/overpainting.py b/examples/opengl/overpainting.py
deleted file mode 100644
index 786337f8..00000000
--- a/examples/opengl/overpainting.py
+++ /dev/null
@@ -1,385 +0,0 @@
-
-############################################################################
-##
-## Copyright (C) 2013 Riverbank Computing Limited.
-## Copyright (C) 2016 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$
-##
-############################################################################
-
-"""PySide2 port of the opengl/legacy/overpainting example from Qt v5.x"""
-
-import sys
-import math, random
-from PySide2.QtCore import *
-from PySide2.QtGui import *
-from PySide2.QtWidgets import *
-from PySide2.QtOpenGL import *
-
-try:
- from OpenGL.GL import *
-except ImportError:
- app = QApplication(sys.argv)
- messageBox = QMessageBox(QMessageBox.Critical, "OpenGL overpainting",
- "PyOpenGL must be installed to run this example.",
- QMessageBox.Close)
- messageBox.setDetailedText("Run:\npip install PyOpenGL PyOpenGL_accelerate")
- messageBox.exec_()
- sys.exit(1)
-
-
-class Bubble:
- def __init__(self, position, radius, velocity):
- self.position = position
- self.vel = velocity
- self.radius = radius
- self.innerColor = self.randomColor()
- self.outerColor = self.randomColor()
- self.updateBrush()
-
- def updateBrush(self):
- gradient = QRadialGradient(QPointF(self.radius, self.radius), self.radius,
- QPointF(self.radius*0.5, self.radius*0.5))
-
- gradient.setColorAt(0, QColor(255, 255, 255, 255))
- gradient.setColorAt(0.25, self.innerColor)
- gradient.setColorAt(1, self.outerColor)
- self.brush = QBrush(gradient)
-
- def drawBubble(self, painter):
- painter.save()
- painter.translate(self.position.x() - self.radius,
- self.position.y() - self.radius)
- painter.setBrush(self.brush)
- painter.drawEllipse(0, 0, int(2*self.radius), int(2*self.radius))
- painter.restore()
-
- def randomColor(self):
- red = random.randrange(205, 256)
- green = random.randrange(205, 256)
- blue = random.randrange(205, 256)
- alpha = random.randrange(91, 192)
-
- return QColor(red, green, blue, alpha)
-
- def move(self, bbox):
- self.position += self.vel
- leftOverflow = self.position.x() - self.radius - bbox.left()
- rightOverflow = self.position.x() + self.radius - bbox.right()
- topOverflow = self.position.y() - self.radius - bbox.top()
- bottomOverflow = self.position.y() + self.radius - bbox.bottom()
-
- if leftOverflow < 0.0:
- self.position.setX(self.position.x() - 2 * leftOverflow)
- self.vel.setX(-self.vel.x())
- elif rightOverflow > 0.0:
- self.position.setX(self.position.x() - 2 * rightOverflow)
- self.vel.setX(-self.vel.x())
-
- if topOverflow < 0.0:
- self.position.setY(self.position.y() - 2 * topOverflow)
- self.vel.setY(-self.vel.y())
- elif bottomOverflow > 0.0:
- self.position.setY(self.position.y() - 2 * bottomOverflow)
- self.vel.setY(-self.vel.y())
-
- def rect(self):
- return QRectF(self.position.x() - self.radius,
- self.position.y() - self.radius,
- 2 * self.radius, 2 * self.radius)
-
-
-class GLWidget(QGLWidget):
- def __init__(self, parent = None):
- QGLWidget.__init__(self, QGLFormat(QGL.SampleBuffers), parent)
-
- midnight = QTime(0, 0, 0)
- random.seed(midnight.secsTo(QTime.currentTime()))
-
- self.object = 0
- self.xRot = 0
- self.yRot = 0
- self.zRot = 0
- self.image = QImage()
- self.bubbles = []
- self.lastPos = QPoint()
-
- self.trolltechGreen = QColor.fromCmykF(0.40, 0.0, 1.0, 0.0)
- self.trolltechPurple = QColor.fromCmykF(0.39, 0.39, 0.0, 0.0)
-
- self.animationTimer = QTimer()
- self.animationTimer.setSingleShot(False)
- self.connect(self.animationTimer, SIGNAL("timeout()"), self.animate)
- self.animationTimer.start(25)
-
- self.setAttribute(Qt.WA_NoSystemBackground)
- self.setMinimumSize(200, 200)
- self.setWindowTitle(self.tr("Overpainting a Scene"))
-
- def freeResources(self):
- self.makeCurrent()
- glDeleteLists(self.object, 1)
-
- def setXRotation(self, angle):
- angle = self.normalizeAngle(angle)
- if angle != self.xRot:
- self.xRot = angle
- self.emit(SIGNAL("xRotationChanged(int)"), angle)
-
- def setYRotation(self, angle):
- angle = self.normalizeAngle(angle)
- if angle != self.yRot:
- self.yRot = angle
- self.emit(SIGNAL("yRotationChanged(int)"), angle)
-
- def setZRotation(self, angle):
- angle = self.normalizeAngle(angle)
- if angle != self.zRot:
- self.zRot = angle
- self.emit(SIGNAL("zRotationChanged(int)"), angle)
-
- def initializeGL(self):
- self.object = self.makeObject()
-
- def mousePressEvent(self, event):
- self.lastPos = QPoint(event.pos())
-
- def mouseMoveEvent(self, event):
- dx = event.x() - self.lastPos.x()
- dy = event.y() - self.lastPos.y()
-
- if event.buttons() & Qt.LeftButton:
- self.setXRotation(self.xRot + 8 * dy)
- self.setYRotation(self.yRot + 8 * dx)
- elif event.buttons() & Qt.RightButton:
- self.setXRotation(self.xRot + 8 * dy)
- self.setZRotation(self.zRot + 8 * dx)
-
- self.lastPos = QPoint(event.pos())
-
- def paintEvent(self, event):
- painter = QPainter()
- painter.begin(self)
- painter.setRenderHint(QPainter.Antialiasing)
-
- glPushAttrib(GL_ALL_ATTRIB_BITS)
- glMatrixMode(GL_PROJECTION)
- glPushMatrix()
- glMatrixMode(GL_MODELVIEW)
- glPushMatrix()
-
- self.qglClearColor(self.trolltechPurple.darker())
- glShadeModel(GL_SMOOTH)
- glEnable(GL_DEPTH_TEST)
- glEnable(GL_CULL_FACE)
- glEnable(GL_LIGHTING)
- glEnable(GL_LIGHT0)
- lightPosition = ( 0.5, 5.0, 7.0, 1.0 )
- glLightfv(GL_LIGHT0, GL_POSITION, lightPosition)
-
- self.resizeGL(self.width(), self.height())
-
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
- glLoadIdentity()
- glTranslated(0.0, 0.0, -10.0)
- glRotated(self.xRot / 16.0, 1.0, 0.0, 0.0)
- glRotated(self.yRot / 16.0, 0.0, 1.0, 0.0)
- glRotated(self.zRot / 16.0, 0.0, 0.0, 1.0)
- glCallList(self.object)
-
- glPopAttrib()
- glMatrixMode(GL_MODELVIEW)
- glPopMatrix()
- glMatrixMode(GL_PROJECTION)
- glPopMatrix()
-
- glDisable(GL_CULL_FACE) ### not required if begin() also does it
-
- for bubble in self.bubbles:
- if bubble.rect().intersects(QRectF(event.rect())):
- bubble.drawBubble(painter)
-
- painter.drawImage((self.width() - self.image.width())/2, 0, self.image)
- painter.end()
-
- def resizeGL(self, width, height):
- side = min(width, height)
- glViewport(int((width - side) / 2), int((height - side) / 2), side, side)
-
- glMatrixMode(GL_PROJECTION)
- glLoadIdentity()
- glOrtho(-0.5, +0.5, +0.5, -0.5, 4.0, 15.0)
- glMatrixMode(GL_MODELVIEW)
-
- self.formatInstructions(width, height)
-
- def showEvent(self, event):
- self.createBubbles(20 - len(self.bubbles))
-
- def sizeHint(self):
- return QSize(400, 400)
-
- def makeObject(self):
- list = glGenLists(1)
- glNewList(list, GL_COMPILE)
-
- glEnable(GL_NORMALIZE)
- glBegin(GL_QUADS)
-
- logoDiffuseColor = (self.trolltechGreen.red()/255.0,
- self.trolltechGreen.green()/255.0,
- self.trolltechGreen.blue()/255.0, 1.0)
- glMaterialfv(GL_FRONT, GL_DIFFUSE, logoDiffuseColor)
-
- x1 = +0.06
- y1 = -0.14
- x2 = +0.14
- y2 = -0.06
- x3 = +0.08
- y3 = +0.00
- x4 = +0.30
- y4 = +0.22
-
- self.quad(x1, y1, x2, y2, y2, x2, y1, x1)
- self.quad(x3, y3, x4, y4, y4, x4, y3, x3)
-
- self.extrude(x1, y1, x2, y2)
- self.extrude(x2, y2, y2, x2)
- self.extrude(y2, x2, y1, x1)
- self.extrude(y1, x1, x1, y1)
- self.extrude(x3, y3, x4, y4)
- self.extrude(x4, y4, y4, x4)
- self.extrude(y4, x4, y3, x3)
-
- NumSectors = 200
-
- for i in range(NumSectors):
- angle1 = (i * 2 * math.pi) / NumSectors
- x5 = 0.30 * math.sin(angle1)
- y5 = 0.30 * math.cos(angle1)
- x6 = 0.20 * math.sin(angle1)
- y6 = 0.20 * math.cos(angle1)
-
- angle2 = ((i + 1) * 2 * math.pi) / NumSectors
- x7 = 0.20 * math.sin(angle2)
- y7 = 0.20 * math.cos(angle2)
- x8 = 0.30 * math.sin(angle2)
- y8 = 0.30 * math.cos(angle2)
-
- self.quad(x5, y5, x6, y6, x7, y7, x8, y8)
-
- self.extrude(x6, y6, x7, y7)
- self.extrude(x8, y8, x5, y5)
-
- glEnd()
-
- glEndList()
- return list
-
- def quad(self, x1, y1, x2, y2, x3, y3, x4, y4):
- glNormal3d(0.0, 0.0, -1.0)
- glVertex3d(x1, y1, -0.05)
- glVertex3d(x2, y2, -0.05)
- glVertex3d(x3, y3, -0.05)
- glVertex3d(x4, y4, -0.05)
-
- glNormal3d(0.0, 0.0, 1.0)
- glVertex3d(x4, y4, +0.05)
- glVertex3d(x3, y3, +0.05)
- glVertex3d(x2, y2, +0.05)
- glVertex3d(x1, y1, +0.05)
-
- def extrude(self, x1, y1, x2, y2):
- self.qglColor(self.trolltechGreen.darker(250 + int(100 * x1)))
-
- glNormal3d((x1 + x2)/2.0, (y1 + y2)/2.0, 0.0)
- glVertex3d(x1, y1, +0.05)
- glVertex3d(x2, y2, +0.05)
- glVertex3d(x2, y2, -0.05)
- glVertex3d(x1, y1, -0.05)
-
- def normalizeAngle(self, angle):
- while angle < 0:
- angle += 360 * 16
- while angle > 360 * 16:
- angle -= 360 * 16
- return angle
-
- def createBubbles(self, number):
- for i in range(number):
- position = QPointF(self.width()*(0.1 + 0.8*random.random()),
- self.height()*(0.1 + 0.8*random.random()))
- radius = min(self.width(), self.height())*(0.0125 + 0.0875*random.random())
- velocity = QPointF(self.width()*0.0125*(-0.5 + random.random()),
- self.height()*0.0125*(-0.5 + random.random()))
-
- self.bubbles.append(Bubble(position, radius, velocity))
-
- def animate(self):
- for bubble in self.bubbles:
- self.update(bubble.rect().toRect())
- bubble.move(self.rect())
- self.update(bubble.rect().toRect())
-
- def formatInstructions(self, width, height):
- text = self.tr("Click and drag with the left mouse button "
- "to rotate the Qt logo.")
- metrics = QFontMetrics(self.font())
- border = max(4, metrics.leading())
-
- rect = metrics.boundingRect(0, 0, width - 2*border, int(height*0.125),
- Qt.AlignCenter | Qt.TextWordWrap, text)
- self.image = QImage(width, rect.height() + 2*border,
- QImage.Format_ARGB32_Premultiplied)
- self.image.fill(qRgba(0, 0, 0, 127))
-
- painter = QPainter()
- painter.begin(self.image)
- painter.setRenderHint(QPainter.TextAntialiasing)
- painter.setPen(Qt.white)
- painter.drawText((width - rect.width())/2, border,
- rect.width(), rect.height(),
- Qt.AlignCenter | Qt.TextWordWrap, text)
- painter.end()
-
-
-if __name__ == '__main__':
- app = QApplication(sys.argv)
- window = GLWidget()
- window.show()
- res = app.exec_()
- window.freeResources()
- sys.exit(res)
diff --git a/examples/opengl/samplebuffers.py b/examples/opengl/samplebuffers.py
deleted file mode 100644
index ad5b7946..00000000
--- a/examples/opengl/samplebuffers.py
+++ /dev/null
@@ -1,192 +0,0 @@
-
-############################################################################
-##
-## Copyright (C) 2013 Riverbank Computing Limited.
-## Copyright (C) 2016 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$
-##
-############################################################################
-
-"""PySide2 port of the opengl/legacy/samplebuffers example from Qt v5.x"""
-
-import sys
-import math
-from PySide2 import QtCore, QtGui, QtWidgets, QtOpenGL
-
-try:
- from OpenGL import GL
-except ImportError:
- app = QtWidgets.QApplication(sys.argv)
- messageBox = QtWidgets.QMessageBox(QtWidgets.QMessageBox.Critical, "OpenGL samplebuffers",
- "PyOpenGL must be installed to run this example.",
- QtWidgets.QMessageBox.Close)
- messageBox.setDetailedText("Run:\npip install PyOpenGL PyOpenGL_accelerate")
- messageBox.exec_()
- sys.exit(1)
-
-
-class GLWidget(QtOpenGL.QGLWidget):
- GL_MULTISAMPLE = 0x809D
- rot = 0.0
-
- def __init__(self, parent=None):
- QtOpenGL.QGLWidget.__init__(self, QtOpenGL.QGLFormat(QtOpenGL.QGL.SampleBuffers), parent)
-
- self.list_ = []
-
- self.startTimer(40)
- self.setWindowTitle(self.tr("Sample Buffers"))
-
- def initializeGL(self):
- GL.glMatrixMode(GL.GL_PROJECTION)
- GL.glLoadIdentity()
- GL.glOrtho( -.5, .5, .5, -.5, -1000, 1000)
- GL.glMatrixMode(GL.GL_MODELVIEW)
- GL.glLoadIdentity()
- GL.glClearColor(1.0, 1.0, 1.0, 1.0)
-
- self.makeObject()
-
- def resizeGL(self, w, h):
- GL.glViewport(0, 0, w, h)
-
- def paintGL(self):
- GL.glClear(GL.GL_COLOR_BUFFER_BIT)
-
- GL.glMatrixMode(GL.GL_MODELVIEW)
- GL.glPushMatrix()
- GL.glEnable(GLWidget.GL_MULTISAMPLE)
- GL.glTranslatef( -0.25, -0.10, 0.0)
- GL.glScalef(0.75, 1.15, 0.0)
- GL.glRotatef(GLWidget.rot, 0.0, 0.0, 1.0)
- GL.glCallList(self.list_)
- GL.glPopMatrix()
-
- GL.glPushMatrix()
- GL.glDisable(GLWidget.GL_MULTISAMPLE)
- GL.glTranslatef(0.25, -0.10, 0.0)
- GL.glScalef(0.75, 1.15, 0.0)
- GL.glRotatef(GLWidget.rot, 0.0, 0.0, 1.0)
- GL.glCallList(self.list_)
- GL.glPopMatrix()
-
- GLWidget.rot += 0.2
-
- self.qglColor(QtCore.Qt.black)
- self.renderText(-0.35, 0.4, 0.0, "Multisampling enabled")
- self.renderText(0.15, 0.4, 0.0, "Multisampling disabled")
-
- def timerEvent(self, event):
- self.update()
-
- def makeObject(self):
- trolltechGreen = QtGui.QColor.fromCmykF(0.40, 0.0, 1.0, 0.0)
- Pi = 3.14159265358979323846
- NumSectors = 15
- x1 = +0.06
- y1 = -0.14
- x2 = +0.14
- y2 = -0.06
- x3 = +0.08
- y3 = +0.00
- x4 = +0.30
- y4 = +0.22
-
- self.list_ = GL.glGenLists(1)
- GL.glNewList(self.list_, GL.GL_COMPILE)
-
- for i in range(NumSectors):
- angle1 = float((i * 2 * Pi) / NumSectors)
- x5 = 0.30 * math.sin(angle1)
- y5 = 0.30 * math.cos(angle1)
- x6 = 0.20 * math.sin(angle1)
- y6 = 0.20 * math.cos(angle1)
-
- angle2 = float(((i + 1) * 2 * Pi) / NumSectors)
- x7 = 0.20 * math.sin(angle2)
- y7 = 0.20 * math.cos(angle2)
- x8 = 0.30 * math.sin(angle2)
- y8 = 0.30 * math.cos(angle2)
-
- self.qglColor(trolltechGreen)
- self.quad(GL.GL_QUADS, x5, y5, x6, y6, x7, y7, x8, y8)
- self.qglColor(QtCore.Qt.black)
- self.quad(GL.GL_LINE_LOOP, x5, y5, x6, y6, x7, y7, x8, y8)
-
- self.qglColor(trolltechGreen)
- self.quad(GL.GL_QUADS, x1, y1, x2, y2, y2, x2, y1, x1)
- self.quad(GL.GL_QUADS, x3, y3, x4, y4, y4, x4, y3, x3)
-
- self.qglColor(QtCore.Qt.black)
- self.quad(GL.GL_LINE_LOOP, x1, y1, x2, y2, y2, x2, y1, x1)
- self.quad(GL.GL_LINE_LOOP, x3, y3, x4, y4, y4, x4, y3, x3)
-
- GL.glEndList()
-
- def quad(self, primitive, x1, y1, x2, y2, x3, y3, x4, y4):
- GL.glBegin(primitive)
-
- GL.glVertex2d(x1, y1)
- GL.glVertex2d(x2, y2)
- GL.glVertex2d(x3, y3)
- GL.glVertex2d(x4, y4)
-
- GL.glEnd()
-
- def freeResources(self):
- self.makeCurrent()
- GL.glDeleteLists(self.list_, 1)
-
-
-if __name__ == '__main__':
- app = QtWidgets.QApplication(sys.argv)
-
- if not QtOpenGL.QGLFormat.hasOpenGL():
- QMessageBox.information(0, "OpenGL pbuffers",
- "This system does not support OpenGL.",
- QMessageBox.Ok)
- sys.exit(1)
-
- f = QtOpenGL.QGLFormat.defaultFormat()
- f.setSampleBuffers(True)
- QtOpenGL.QGLFormat.setDefaultFormat(f)
-
- widget = GLWidget()
- widget.resize(640, 480)
- widget.show()
- res = app.exec_()
- widget.freeResources()
- sys.exit(res)
diff --git a/examples/quick/customitems/painteditem/main.qml b/examples/quick/customitems/painteditem/main.qml
new file mode 100644
index 00000000..d3404cad
--- /dev/null
+++ b/examples/quick/customitems/painteditem/main.qml
@@ -0,0 +1,114 @@
+/****************************************************************************
+**
+** 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 QtQuick 2.0
+import TextBalloonPlugin 1.0
+
+Item {
+ height: 480
+ width: 320
+
+ //! [0]
+ ListModel {
+ id: balloonModel
+ ListElement {
+ balloonWidth: 200
+ }
+ ListElement {
+ balloonWidth: 120
+ }
+ }
+
+ ListView {
+ anchors.bottom: controls.top
+ anchors.bottomMargin: 2
+ anchors.top: parent.top
+ id: balloonView
+ delegate: TextBalloon {
+ anchors.right: index % 2 == 0 ? undefined : parent.right
+ height: 60
+ rightAligned: index % 2 == 0 ? false : true
+ width: balloonWidth
+ }
+ model: balloonModel
+ spacing: 5
+ width: parent.width
+ }
+ //! [0]
+
+ //! [1]
+ Rectangle {
+ id: controls
+
+ anchors.bottom: parent.bottom
+ anchors.left: parent.left
+ anchors.margins: 1
+ anchors.right: parent.right
+ border.width: 2
+ color: "white"
+ height: parent.height * 0.15
+
+ Text {
+ anchors.centerIn: parent
+ text: "Add another balloon"
+ }
+
+ MouseArea {
+ anchors.fill: parent
+ hoverEnabled: true
+ onClicked: {
+ balloonModel.append({
+ "balloonWidth": Math.floor(
+ Math.random(
+ ) * 200 + 100)
+ })
+ balloonView.positionViewAtIndex(balloonView.count - 1,
+ ListView.End)
+ }
+ onEntered: {
+ parent.color = "#8ac953"
+ }
+ onExited: {
+ parent.color = "white"
+ }
+ }
+ }
+ //! [1]
+}
diff --git a/examples/quick/customitems/painteditem/painteditem.py b/examples/quick/customitems/painteditem/painteditem.py
new file mode 100644
index 00000000..e89bf0ba
--- /dev/null
+++ b/examples/quick/customitems/painteditem/painteditem.py
@@ -0,0 +1,106 @@
+#############################################################################
+##
+## 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.QtGui import QPainter, QBrush, QColor
+from PySide2.QtWidgets import QApplication
+from PySide2.QtQml import qmlRegisterType
+from PySide2.QtCore import QUrl, Property, Signal, Qt, QPointF
+from PySide2.QtQuick import QQuickPaintedItem, QQuickView
+
+
+class TextBalloon(QQuickPaintedItem):
+
+ rightAlignedChanged = Signal()
+
+ def __init__(self, parent=None):
+ self._rightAligned = False
+ super().__init__(parent)
+
+ @Property(bool, notify=rightAlignedChanged)
+ def rightAligned(self):
+ return self._rightAligned
+
+ @rightAligned.setter
+ def rightAlignedSet(self, value):
+ self._rightAligned = value
+ self.rightAlignedChanged.emit()
+
+ def paint(self, painter: QPainter):
+
+ brush = QBrush(QColor("#007430"))
+
+ painter.setBrush(brush)
+ painter.setPen(Qt.NoPen)
+ painter.setRenderHint(QPainter.Antialiasing)
+
+ itemSize = self.size()
+
+ painter.drawRoundedRect(0, 0, itemSize.width(), itemSize.height() - 10, 10, 10)
+
+ if self.rightAligned:
+ points = [
+ QPointF(itemSize.width() - 10.0, itemSize.height() - 10.0),
+ QPointF(itemSize.width() - 20.0, itemSize.height()),
+ QPointF(itemSize.width() - 30.0, itemSize.height() - 10.0),
+ ]
+ else:
+ points = [
+ QPointF(10.0, itemSize.height() - 10.0),
+ QPointF(20.0, itemSize.height()),
+ QPointF(30.0, itemSize.height() - 10.0),
+ ]
+ painter.drawConvexPolygon(points)
+
+
+if __name__ == "__main__":
+
+ app = QApplication(sys.argv)
+ view = QQuickView()
+ view.setResizeMode(QQuickView.SizeRootObjectToView)
+ qmlRegisterType(TextBalloon, "TextBalloonPlugin", 1, 0, "TextBalloon")
+ view.setSource(QUrl.fromLocalFile("main.qml"))
+
+ if view.status() == QQuickView.Error:
+ sys.exit(-1)
+ view.show()
+
+ sys.exit(app.exec_())
diff --git a/examples/quick/customitems/painteditem/painteditem.pyproject b/examples/quick/customitems/painteditem/painteditem.pyproject
new file mode 100644
index 00000000..0c70ebe5
--- /dev/null
+++ b/examples/quick/customitems/painteditem/painteditem.pyproject
@@ -0,0 +1,3 @@
+{
+ "files": ["main.qml", "painteditem.pyproject"]
+}
diff --git a/examples/scriptableapplication/mainwindow.cpp b/examples/scriptableapplication/mainwindow.cpp
index ef4a2f2e..0811990d 100644
--- a/examples/scriptableapplication/mainwindow.cpp
+++ b/examples/scriptableapplication/mainwindow.cpp
@@ -51,7 +51,7 @@
#include "mainwindow.h"
#include "pythonutils.h"
-#include <QtWidgets/QAction>
+#include <QtGui.QAction>
#include <QtWidgets/QApplication>
#include <QtWidgets/QMenu>
#include <QtWidgets/QMenuBar>
diff --git a/examples/webenginewidgets/tabbedbrowser/browsertabwidget.py b/examples/webenginewidgets/tabbedbrowser/browsertabwidget.py
index 8b96b3dd..093eed6b 100644
--- a/examples/webenginewidgets/tabbedbrowser/browsertabwidget.py
+++ b/examples/webenginewidgets/tabbedbrowser/browsertabwidget.py
@@ -241,4 +241,4 @@ class BrowserTabWidget(QTabWidget):
return -1
def _download_requested(self, item):
- self.downloadRequested.emit(item)
+ self.download_requested.emit(item)
diff --git a/examples/webenginewidgets/tabbedbrowser/downloadwidget.py b/examples/webenginewidgets/tabbedbrowser/downloadwidget.py
index a118f6ee..73b8d116 100644
--- a/examples/webenginewidgets/tabbedbrowser/downloadwidget.py
+++ b/examples/webenginewidgets/tabbedbrowser/downloadwidget.py
@@ -92,7 +92,7 @@ class DownloadWidget(QProgressBar):
path = self._download_item.path()
tool_tip = "{}\n{}".format(self._download_item.url().toString(),
QDir.toNativeSeparators(path))
- total_bytes = self._download_item.total_bytes()
+ total_bytes = self._download_item.totalBytes()
if total_bytes > 0:
tool_tip += "\n{}K".format(total_bytes / 1024)
state = self.state()
@@ -118,11 +118,11 @@ class DownloadWidget(QProgressBar):
def _launch(self):
DownloadWidget.open_file(self._download_item.path())
- def mouse_double_click_event(self, event):
+ def mouseDoubleClickEvent(self, event):
if self.state() == QWebEngineDownloadItem.DownloadCompleted:
self._launch()
- def context_menu_event(self, event):
+ def contextMenuEvent(self, event):
state = self.state()
context_menu = QMenu()
launch_action = context_menu.addAction("Launch")
diff --git a/examples/webenginewidgets/tabbedbrowser/main.py b/examples/webenginewidgets/tabbedbrowser/main.py
index 8a75cd5e..086946ba 100644
--- a/examples/webenginewidgets/tabbedbrowser/main.py
+++ b/examples/webenginewidgets/tabbedbrowser/main.py
@@ -49,8 +49,8 @@ from findtoolbar import FindToolBar
from webengineview import WebEngineView
from PySide2 import QtCore
from PySide2.QtCore import Qt, QUrl
-from PySide2.QtGui import QKeySequence, QIcon
-from PySide2.QtWidgets import (QAction, QApplication, QDockWidget, QLabel,
+from PySide2.QtGui import QAction, QKeySequence, QIcon
+from PySide2.QtWidgets import (QApplication, QDockWidget, QLabel,
QLineEdit, QMainWindow, QToolBar)
from PySide2.QtWebEngineWidgets import QWebEngineDownloadItem, QWebEnginePage
@@ -353,15 +353,15 @@ class MainWindow(QMainWindow):
def _download_requested(self, item):
# Remove old downloads before opening a new one
for old_download in self.statusBar().children():
- if (type(old_download).__name__ == 'download_widget' and
+ if (type(old_download).__name__ == 'DownloadWidget' and
old_download.state() != QWebEngineDownloadItem.DownloadInProgress):
self.statusBar().removeWidget(old_download)
del old_download
item.accept()
- download_widget = download_widget(item)
- download_widget.removeRequested.connect(self._remove_download_requested,
- Qt.QueuedConnection)
+ download_widget = DownloadWidget(item)
+ download_widget.remove_requested.connect(self._remove_download_requested,
+ Qt.QueuedConnection)
self.statusBar().addWidget(download_widget)
def _remove_download_requested(self):
diff --git a/examples/widgetbinding/CMakeLists.txt b/examples/widgetbinding/CMakeLists.txt
new file mode 100644
index 00000000..a557f90e
--- /dev/null
+++ b/examples/widgetbinding/CMakeLists.txt
@@ -0,0 +1,275 @@
+cmake_minimum_required(VERSION 3.1)
+cmake_policy(VERSION 3.1)
+
+# Enable policy to not use RPATH settings for install_name on macOS.
+if(POLICY CMP0068)
+ cmake_policy(SET CMP0068 NEW)
+endif()
+
+# Enable policy to run automoc on generated files.
+if(POLICY CMP0071)
+ cmake_policy(SET CMP0071 NEW)
+endif()
+
+# Consider changing the project name to something relevant for you.
+project(wiggly LANGUAGES CXX)
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+set(CMAKE_AUTOMOC ON)
+find_package(Qt5 5.12 REQUIRED COMPONENTS Core Gui Widgets)
+
+# ================================ General configuration ======================================
+
+# Set CPP standard to C++11 minimum.
+set(CMAKE_CXX_STANDARD 11)
+
+# The wiggly library for which we will create bindings. You can change the name to something
+# relevant for your project.
+set(wiggly_library "libwiggly")
+
+# The name of the generated bindings module (as imported in Python). You can change the name
+# to something relevant for your project.
+set(bindings_library "wiggly")
+
+# The header file with all the types and functions for which bindings will be generated.
+# Usually it simply includes other headers of the library you are creating bindings for.
+set(wrapped_header ${CMAKE_SOURCE_DIR}/bindings.h)
+
+# The typesystem xml file which defines the relationships between the C++ types / functions
+# and the corresponding Python equivalents.
+set(typesystem_file ${CMAKE_SOURCE_DIR}/bindings.xml)
+
+# Specify which C++ files will be generated by shiboken. This includes the module wrapper
+# and a '.cpp' file per C++ type. These are needed for generating the module shared
+# library.
+set(generated_sources
+ ${CMAKE_CURRENT_BINARY_DIR}/${bindings_library}/wiggly_module_wrapper.cpp
+ ${CMAKE_CURRENT_BINARY_DIR}/${bindings_library}/wigglywidget_wrapper.cpp)
+
+
+# ================================== Shiboken detection ======================================
+# Use provided python interpreter if given.
+if(NOT python_interpreter)
+ find_program(python_interpreter "python")
+endif()
+message(STATUS "Using python interpreter: ${python_interpreter}")
+
+# Macro to get various pyside / python include / link flags and paths.
+# Uses the not entirely supported utils/pyside2_config.py file.
+macro(pyside2_config option output_var)
+ if(${ARGC} GREATER 2)
+ set(is_list ${ARGV2})
+ else()
+ set(is_list "")
+ endif()
+
+ execute_process(
+ COMMAND ${python_interpreter} "${CMAKE_SOURCE_DIR}/../utils/pyside2_config.py"
+ ${option}
+ OUTPUT_VARIABLE ${output_var}
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ if ("${${output_var}}" STREQUAL "")
+ message(FATAL_ERROR "Error: Calling pyside2_config.py ${option} returned no output.")
+ endif()
+ if(is_list)
+ string (REPLACE " " ";" ${output_var} "${${output_var}}")
+ endif()
+endmacro()
+
+# Query for the shiboken generator path, Python path, include paths and linker flags.
+pyside2_config(--shiboken2-module-path shiboken2_module_path)
+pyside2_config(--shiboken2-generator-path shiboken2_generator_path)
+pyside2_config(--pyside2-path pyside2_path)
+pyside2_config(--pyside2-include-path pyside2_include_dir 1)
+pyside2_config(--python-include-path python_include_dir)
+pyside2_config(--shiboken2-generator-include-path shiboken_include_dir 1)
+pyside2_config(--shiboken2-module-shared-libraries-cmake shiboken_shared_libraries 0)
+pyside2_config(--python-link-flags-cmake python_linking_data 0)
+pyside2_config(--pyside2-shared-libraries-cmake pyside2_shared_libraries 0)
+
+set(shiboken_path "${shiboken2_generator_path}/shiboken2${CMAKE_EXECUTABLE_SUFFIX}")
+if(NOT EXISTS ${shiboken_path})
+ message(FATAL_ERROR "Shiboken executable not found at path: ${shiboken_path}")
+endif()
+
+
+# ==================================== RPATH configuration ====================================
+
+
+# =============================================================================================
+# !!! (The section below is deployment related, so in a real world application you will want to
+# take care of this properly with some custom script or tool).
+# =============================================================================================
+# Enable rpaths so that the built shared libraries find their dependencies.
+set(CMAKE_SKIP_BUILD_RPATH FALSE)
+set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
+set(CMAKE_INSTALL_RPATH ${shiboken2_module_path} ${CMAKE_CURRENT_SOURCE_DIR})
+set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
+# =============================================================================================
+# !!! End of dubious section.
+# =============================================================================================
+
+
+# =============================== CMake target - wiggly_library ===============================
+
+
+# Get all relevant Qt include dirs, to pass them on to shiboken.
+get_property(QT_CORE_INCLUDE_DIRS TARGET Qt5::Core PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
+get_property(QT_GUI_INCLUDE_DIRS TARGET Qt5::Gui PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
+get_property(QT_WIDGETS_INCLUDE_DIRS TARGET Qt5::Widgets PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
+set(QT_INCLUDE_DIRS ${QT_CORE_INCLUDE_DIRS} ${QT_GUI_INCLUDE_DIRS} ${QT_WIDGETS_INCLUDE_DIRS})
+set(INCLUDES "")
+foreach(INCLUDE_DIR ${QT_INCLUDE_DIRS})
+ list(APPEND INCLUDES "-I${INCLUDE_DIR}")
+endforeach()
+
+# On macOS, check if Qt is a framework build. This affects how include paths should be handled.
+get_target_property(QtCore_is_framework Qt5::Core FRAMEWORK)
+if (QtCore_is_framework)
+ get_target_property(qt_core_library_location Qt5::Core LOCATION)
+ get_filename_component(qt_core_library_location_dir "${qt_core_library_location}" DIRECTORY)
+ get_filename_component(lib_dir "${qt_core_library_location_dir}/../" ABSOLUTE)
+ list(APPEND INCLUDES "--framework-include-paths=${lib_dir}")
+endif()
+
+# We need to include the headers for the module bindings that we use.
+set(pyside2_additional_includes "")
+foreach(INCLUDE_DIR ${pyside2_include_dir})
+ list(APPEND pyside2_additional_includes "${INCLUDE_DIR}/QtCore")
+ list(APPEND pyside2_additional_includes "${INCLUDE_DIR}/QtGui")
+ list(APPEND pyside2_additional_includes "${INCLUDE_DIR}/QtWidgets")
+endforeach()
+
+
+# Define the wiggly shared library for which we will create bindings.
+set(${wiggly_library}_sources wigglywidget.cpp)
+add_library(${wiggly_library} SHARED ${${wiggly_library}_sources})
+set_property(TARGET ${wiggly_library} PROPERTY PREFIX "")
+
+# Needed mostly on Windows to export symbols, and create a .lib file, otherwise the binding
+# library can't link to the wiggly library.
+target_compile_definitions(${wiggly_library} PRIVATE BINDINGS_BUILD)
+
+
+# ====================== Shiboken target for generating binding C++ files ====================
+
+
+# Set up the options to pass to shiboken.
+set(shiboken_options --generator-set=shiboken --enable-parent-ctor-heuristic
+ --enable-pyside-extensions --enable-return-value-heuristic --use-isnull-as-nb_nonzero
+ --avoid-protected-hack
+ ${INCLUDES}
+ -I${CMAKE_SOURCE_DIR}
+ -T${CMAKE_SOURCE_DIR}
+ -T${pyside2_path}/typesystems
+ --output-directory=${CMAKE_CURRENT_BINARY_DIR}
+ )
+
+set(generated_sources_dependencies ${wrapped_header} ${typesystem_file})
+
+# Add custom target to run shiboken to generate the binding cpp files.
+add_custom_command(OUTPUT ${generated_sources}
+ COMMAND ${shiboken_path}
+ ${shiboken_options} ${wrapped_header} ${typesystem_file}
+ DEPENDS ${generated_sources_dependencies}
+ #IMPLICIT_DEPENDS CXX ${wrapped_header}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMENT "Running generator for ${typesystem_file}.")
+
+
+# =============================== CMake target - bindings_library =============================
+
+
+# Set the cpp files which will be used for the bindings library.
+set(${bindings_library}_sources ${generated_sources})
+
+# Define and build the bindings library.
+add_library(${bindings_library} SHARED ${${bindings_library}_sources})
+
+
+# Apply relevant include and link flags.
+target_include_directories(${bindings_library} PRIVATE ${pyside2_additional_includes})
+target_include_directories(${bindings_library} PRIVATE ${pyside2_include_dir})
+target_include_directories(${bindings_library} PRIVATE ${python_include_dir})
+target_include_directories(${bindings_library} PRIVATE ${shiboken_include_dir})
+
+target_link_libraries(${wiggly_library} PRIVATE Qt5::Widgets)
+target_link_libraries(${bindings_library} PRIVATE Qt5::Widgets)
+target_link_libraries(${bindings_library} PRIVATE ${wiggly_library})
+target_link_libraries(${bindings_library} PRIVATE ${pyside2_shared_libraries})
+target_link_libraries(${bindings_library} PRIVATE ${shiboken_shared_libraries})
+
+# Adjust the name of generated module.
+set_property(TARGET ${bindings_library} PROPERTY PREFIX "")
+set_property(TARGET ${bindings_library} PROPERTY OUTPUT_NAME
+ "${bindings_library}${PYTHON_EXTENSION_SUFFIX}")
+if(WIN32)
+ set_property(TARGET ${bindings_library} PROPERTY SUFFIX ".pyd")
+endif()
+
+# Make sure the linker doesn't complain about not finding Python symbols on macOS.
+if(APPLE)
+ set_target_properties(${bindings_library} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
+endif(APPLE)
+
+# Find and link to the python import library only on Windows.
+# On Linux and macOS, the undefined symbols will get resolved by the dynamic linker
+# (the symbols will be picked up in the Python executable).
+if (WIN32)
+ list(GET python_linking_data 0 python_libdir)
+ list(GET python_linking_data 1 python_lib)
+ find_library(python_link_flags ${python_lib} PATHS ${python_libdir} HINTS ${python_libdir})
+ target_link_libraries(${bindings_library} PRIVATE ${python_link_flags})
+endif()
+
+# ================================= Dubious deployment section ================================
+
+set(windows_shiboken_shared_libraries)
+
+if(WIN32)
+ # =========================================================================================
+ # !!! (The section below is deployment related, so in a real world application you will
+ # want to take care of this properly (this is simply to eliminate errors that users usually
+ # encounter.
+ # =========================================================================================
+ # Circumvent some "#pragma comment(lib)"s in "include/pyconfig.h" which might force to link
+ # against a wrong python shared library.
+
+ set(python_versions_list 3 32 33 34 35 36 37 38)
+ set(python_additional_link_flags "")
+ foreach(ver ${python_versions_list})
+ set(python_additional_link_flags
+ "${python_additional_link_flags} /NODEFAULTLIB:\"python${ver}_d.lib\"")
+ set(python_additional_link_flags
+ "${python_additional_link_flags} /NODEFAULTLIB:\"python${ver}.lib\"")
+ endforeach()
+
+ set_target_properties(${bindings_library}
+ PROPERTIES LINK_FLAGS "${python_additional_link_flags}")
+
+ # Compile a list of shiboken shared libraries to be installed, so that
+ # the user doesn't have to set the PATH manually to point to the PySide2 package.
+ foreach(library_path ${shiboken_shared_libraries})
+ string(REGEX REPLACE ".lib$" ".dll" library_path ${library_path})
+ file(TO_CMAKE_PATH ${library_path} library_path)
+ list(APPEND windows_shiboken_shared_libraries "${library_path}")
+ endforeach()
+ # =========================================================================================
+ # !!! End of dubious section.
+ # =========================================================================================
+endif()
+
+# =============================================================================================
+# !!! (The section below is deployment related, so in a real world application you will want to
+# take care of this properly with some custom script or tool).
+# =============================================================================================
+# Install the library and the bindings module into the source folder near the main.py file, so
+# that the Python interpeter successfully imports the used module.
+install(TARGETS ${bindings_library} ${wiggly_library}
+ LIBRARY DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}
+ RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}
+ )
+install(FILES ${windows_shiboken_shared_libraries} DESTINATION ${CMAKE_CURRENT_SOURCE_DIR})
+# =============================================================================================
+# !!! End of dubious section.
+# =============================================================================================
diff --git a/examples/widgetbinding/README.md b/examples/widgetbinding/README.md
new file mode 100644
index 00000000..f58a4962
--- /dev/null
+++ b/examples/widgetbinding/README.md
@@ -0,0 +1,74 @@
+# WigglyWidget
+
+The original Qt/C++ example can be found here:
+https://doc.qt.io/qt-5/qtwidgets-widgets-wiggly-example.html
+
+This example shows how to interact with a custom widget from two
+different ways:
+
+ * A full Python translation from a C++ example,
+ * A Python binding generated from the C++ file.
+
+
+The original example contained three different files:
+ * `main.cpp/h`, which was translated to `main.py`,
+ * `dialog.cpp/h`, which was translated to `dialog.py`,
+ * `wigglywidget.cpp/h`, which was translated to `wigglywidget.py`,
+ but also remains as is, to enable the binding generation through
+ Shiboken.
+
+In the `dialog.py` file you will find two imports that will be related
+to each of the two approaches described before::
+
+
+ # Python translated file
+ from wigglywidget import WigglyWidget
+
+ # Binding module create with Shiboken
+ from wiggly import WigglyWidget
+
+
+## Steps to build the bindings
+
+The most important files are:
+ * `bindings.xml`, to specify the class that we want to expose from C++
+ to Python,
+ * `bindings.h` to include the header of the classes we want to expose
+ * `CMakeList.txt`, with all the instructions to build the shared libraries
+ (DLL, or dylib)
+ * `pyside2_config.py` which is located in the utils directory, one level
+ up, to get the path for Shiboken and PySide.
+
+Now create a `build/` directory, and from inside run `cmake ..` to use
+the provided `CMakeLists.txt`.
+To build, just run `make`, and `make install` to copy the generated files
+to the main example directory to be able to run the final example:
+`python main.py`.
+You should be able to see two identical custom widgets, one being the
+Python translation, and the other one being the C++ one.
+
+### Windows
+
+For windows it's recommended to use either `nmake`, `jom` or `ninja`,
+when running cmake.
+
+```bash
+cmake -H.. -B. -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release # for nmake
+cmake -H.. -B. -G "NMake Makefiles JOM" -DCMAKE_BUILD_TYPE=Release # for jom
+cmake -H.. -B. -G Ninja -DCMAKE_BUILD_TYPE=Release # for ninja
+```
+
+### Linux, macOS
+
+Generally using `make` will be enough, but as in the Windows case, you can use
+ninja to build the project.
+
+```bash
+cmake -H.. -B. -G Ninja -DCMAKE_BUILD_TYPE=Release
+```
+
+## Final words
+
+Since this example originated by mixing the concepts of the `scriptableapplication`
+and `samplebinding` examples, you can complement this README with the ones in
+those directories.
diff --git a/sources/pyside2/doc/codesnippets/webkitsnippets/qtwebkit_qwebinspector_snippet.cpp b/examples/widgetbinding/bindings.h
index 79dc1517..d5922265 100644
--- a/sources/pyside2/doc/codesnippets/webkitsnippets/qtwebkit_qwebinspector_snippet.cpp
+++ b/examples/widgetbinding/bindings.h
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** 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 documentation of Qt for Python.
+** This file is part of the Qt for Python examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
@@ -48,13 +48,7 @@
**
****************************************************************************/
-def wrapInFunction():
-//! [0]
- # ...
- page = QWebPage()
- # ...
-
- inspector = QWebInspector()
- inspector.setPage(page)
-//! [0]
-
+#ifndef BINDINGS_H
+#define BINDINGS_H
+#include "wigglywidget.h"
+#endif // BINDINGS_H
diff --git a/sources/pyside2/doc/codesnippets/webkitsnippets/qtwebkit_qwebview_snippet.cpp b/examples/widgetbinding/bindings.xml
index 268f4344..07f1c89c 100644
--- a/sources/pyside2/doc/codesnippets/webkitsnippets/qtwebkit_qwebview_snippet.cpp
+++ b/examples/widgetbinding/bindings.xml
@@ -1,9 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
/****************************************************************************
**
-** 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 documentation of Qt for Python.
+** This file is part of the Qt for Python examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
@@ -47,34 +49,8 @@
** $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]
-
+-->
+<typesystem package="wiggly">
+ <load-typesystem name="typesystem_widgets.xml" generate="no"/>
+ <object-type name="WigglyWidget"/>
+</typesystem>
diff --git a/examples/widgetbinding/dialog.py b/examples/widgetbinding/dialog.py
new file mode 100644
index 00000000..e5215599
--- /dev/null
+++ b/examples/widgetbinding/dialog.py
@@ -0,0 +1,77 @@
+############################################################################
+##
+## Copyright (C) 2020 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the Qt for Python examples of the Qt Toolkit.
+##
+## $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.QtWidgets import QDialog, QLineEdit, QVBoxLayout
+
+# Python binding from the C++ widget
+from wiggly import WigglyWidget as WigglyWidgetCPP
+
+# Python-only widget
+from wigglywidget import WigglyWidget as WigglyWidgetPY
+
+
+class Dialog(QDialog):
+ def __init__(self, parent=None):
+ super(Dialog, self).__init__(parent)
+ wiggly_widget_py = WigglyWidgetPY(self)
+ wiggly_widget_cpp = WigglyWidgetCPP(self)
+ lineEdit = QLineEdit(self)
+
+ layout = QVBoxLayout(self)
+ layout.addWidget(wiggly_widget_py)
+ layout.addWidget(wiggly_widget_cpp)
+ layout.addWidget(lineEdit)
+
+ lineEdit.textChanged.connect(wiggly_widget_py.setText)
+ lineEdit.textChanged.connect(wiggly_widget_cpp.setText)
+ lineEdit.setText("Hello world!")
+
+ self.setWindowTitle("Wiggly")
+ self.resize(360, 145)
diff --git a/sources/pyside2/doc/codesnippets/webkitsnippets/simple/main.cpp b/examples/widgetbinding/macros.h
index 1382cd44..224fada6 100644
--- a/sources/pyside2/doc/codesnippets/webkitsnippets/simple/main.cpp
+++ b/examples/widgetbinding/macros.h
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** 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 documentation of Qt for Python.
+** This file is part of the Qt for Python examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
@@ -48,16 +48,16 @@
**
****************************************************************************/
-from PySide2.QtCore import *
-from PySide2.QtGui import *
-from PySide2.QtWebKit import *
-import sys
+#ifndef MACROS_H
+#define MACROS_H
-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_())
+#include <QtCore/qglobal.h>
+
+// Export symbols when creating .dll and .lib, and import them when using .lib.
+#if BINDINGS_BUILD
+# define BINDINGS_API Q_DECL_EXPORT
+#else
+# define BINDINGS_API Q_DECL_IMPORT
+#endif
+
+#endif // MACROS_H
diff --git a/examples/widgetbinding/main.py b/examples/widgetbinding/main.py
new file mode 100644
index 00000000..556eb263
--- /dev/null
+++ b/examples/widgetbinding/main.py
@@ -0,0 +1,61 @@
+############################################################################
+##
+## Copyright (C) 2020 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the Qt for Python examples of the Qt Toolkit.
+##
+## $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$
+##
+############################################################################
+
+import sys
+
+from PySide2.QtWidgets import QApplication
+
+from dialog import Dialog
+
+if __name__ == "__main__":
+ app = QApplication()
+ w = Dialog()
+ w.show()
+ sys.exit(app.exec_())
diff --git a/examples/widgetbinding/wigglywidget.cpp b/examples/widgetbinding/wigglywidget.cpp
new file mode 100644
index 00000000..ab549ef0
--- /dev/null
+++ b/examples/widgetbinding/wigglywidget.cpp
@@ -0,0 +1,111 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $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$
+**
+****************************************************************************/
+
+#include "wigglywidget.h"
+
+#include <QFontMetrics>
+#include <QPainter>
+#include <QTimerEvent>
+
+//! [0]
+WigglyWidget::WigglyWidget(QWidget *parent)
+ : QWidget(parent), step(0)
+{
+ setBackgroundRole(QPalette::Midlight);
+ setAutoFillBackground(true);
+
+ QFont newFont = font();
+ newFont.setPointSize(newFont.pointSize() + 20);
+ setFont(newFont);
+
+ timer.start(60, this);
+}
+//! [0]
+
+//! [1]
+void WigglyWidget::paintEvent(QPaintEvent * /* event */)
+//! [1] //! [2]
+{
+ static constexpr int sineTable[16] = {
+ 0, 38, 71, 92, 100, 92, 71, 38, 0, -38, -71, -92, -100, -92, -71, -38
+ };
+
+ QFontMetrics metrics(font());
+ int x = (width() - metrics.horizontalAdvance(text)) / 2;
+ int y = (height() + metrics.ascent() - metrics.descent()) / 2;
+ QColor color;
+//! [2]
+
+//! [3]
+ QPainter painter(this);
+//! [3] //! [4]
+ for (int i = 0; i < text.size(); ++i) {
+ int index = (step + i) % 16;
+ color.setHsv((15 - index) * 16, 255, 191);
+ painter.setPen(color);
+ painter.drawText(x, y - ((sineTable[index] * metrics.height()) / 400),
+ QString(text[i]));
+ x += metrics.horizontalAdvance(text[i]);
+ }
+}
+//! [4]
+
+//! [5]
+void WigglyWidget::timerEvent(QTimerEvent *event)
+//! [5] //! [6]
+{
+ if (event->timerId() == timer.timerId()) {
+ ++step;
+ update();
+ } else {
+ QWidget::timerEvent(event);
+ }
+//! [6]
+}
diff --git a/sources/pyside2/doc/codesnippets/webkitsnippets/webpage/main.cpp b/examples/widgetbinding/wigglywidget.h
index b64a4f35..d08db05d 100644
--- a/sources/pyside2/doc/codesnippets/webkitsnippets/webpage/main.cpp
+++ b/examples/widgetbinding/wigglywidget.h
@@ -3,7 +3,7 @@
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
-** This file is part of the documentation of Qt for Python.
+** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
@@ -48,36 +48,34 @@
**
****************************************************************************/
-//! [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]
+#ifndef WIGGLYWIDGET_H
+#define WIGGLYWIDGET_H
- finished = Signal()
+#include "macros.h"
-//! [2]
- def render(self):
- self.page.setViewportSize(self.page.mainFrame().contentsSize())
- image = QImage(self.page.viewportSize(), QImage.Format_ARGB32)
- painter = QPainter(image)
+#include <QWidget>
+#include <QBasicTimer>
- self.page.mainFrame().render(painter)
- painter.end()
+//! [0]
+class BINDINGS_API WigglyWidget : public QWidget
+{
+ Q_OBJECT
- thumbnail = image.scaled(400, 400)
- thumbnail.save("thumbnail.png")
+public:
+ WigglyWidget(QWidget *parent = nullptr);
- self.finished.emit()
-//! [2]
-//! [0]
+public slots:
+ void setText(const QString &newText) { text = newText; }
-app = QApplication(sys.argv)
+protected:
+ void paintEvent(QPaintEvent *event) override;
+ void timerEvent(QTimerEvent *event) override;
+
+private:
+ QBasicTimer timer;
+ QString text;
+ int step;
+};
+//! [0]
-thumbnail = Thumbnailer(QUrl("http://qt-project.org"))
-thumbnail.finished.connect(app.quit)
-sys.exit(app.exec_())
+#endif
diff --git a/examples/widgetbinding/wigglywidget.py b/examples/widgetbinding/wigglywidget.py
new file mode 100644
index 00000000..50a06107
--- /dev/null
+++ b/examples/widgetbinding/wigglywidget.py
@@ -0,0 +1,97 @@
+############################################################################
+##
+## Copyright (C) 2020 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of the Qt for Python examples of the Qt Toolkit.
+##
+## $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 QBasicTimer
+from PySide2.QtGui import QColor, QFontMetrics, QPainter, QPalette
+from PySide2.QtWidgets import QWidget
+
+
+class WigglyWidget(QWidget):
+ def __init__(self, parent=None):
+ super(WigglyWidget, self).__init__(parent)
+ self.step = 0
+ self.text = ""
+ self.setBackgroundRole(QPalette.Midlight)
+ self.setAutoFillBackground(True)
+
+ newFont = self.font()
+ newFont.setPointSize(newFont.pointSize() + 20)
+ self.setFont(newFont)
+
+ self.timer = QBasicTimer()
+ self.timer.start(60, self)
+
+ def paintEvent(self, event):
+ sineTable = [0, 38, 71, 92, 100, 92, 71, 38, 0, -38, -71, -92, -100,
+ -92, -71, -38]
+
+ metrics = QFontMetrics(self.font())
+ x = (self.width() - metrics.horizontalAdvance(self.text)) / 2
+ y = (self.height() + metrics.ascent() - metrics.descent()) / 2
+ color = QColor()
+
+ painter = QPainter(self)
+ for i in range(len(self.text)):
+ index = (self.step + i) % 16
+ color.setHsv((15 - index) * 16, 255, 191)
+ painter.setPen(color)
+ painter.drawText(x, y - ((sineTable[index] * metrics.height()) / 400),
+ str(self.text[i]))
+ x += metrics.horizontalAdvance(self.text[i])
+
+ def timerEvent(self, event):
+ if event.timerId() == self.timer.timerId():
+ self.step += 1
+ self.update()
+ else:
+ QWidget.timerEvent(event)
+
+ def setText(self, text):
+ self.text = text
diff --git a/examples/widgets/animation/easing/easing.py b/examples/widgets/animation/easing/easing.py
index 18b5c09d..d5c73386 100644
--- a/examples/widgets/animation/easing/easing.py
+++ b/examples/widgets/animation/easing/easing.py
@@ -121,7 +121,7 @@ class Window(QtWidgets.QWidget):
m_ui.overshootSpinBox.setValue(dummy.overshoot())
m_ui.easingCurvePicker.currentRowChanged.connect(self.curveChanged)
- m_ui.buttonGroup.buttonClicked[int].connect(self.pathChanged)
+ m_ui.buttonGroup.idClicked.connect(self.pathChanged)
m_ui.periodSpinBox.valueChanged.connect(self.periodChanged)
m_ui.amplitudeSpinBox.valueChanged.connect(self.amplitudeChanged)
m_ui.overshootSpinBox.valueChanged.connect(self.overshootChanged)
diff --git a/examples/widgets/codeeditor/codeeditor.py b/examples/widgets/codeeditor/codeeditor.py
index 331069f4..d83d010d 100644
--- a/examples/widgets/codeeditor/codeeditor.py
+++ b/examples/widgets/codeeditor/codeeditor.py
@@ -74,7 +74,7 @@ class CodeEditor(QPlainTextEdit):
max_num *= 0.1
digits += 1
- space = 3 + self.fontMetrics().width('9') * digits
+ space = 3 + self.fontMetrics().horizontalAdvance('9') * digits
return space
def resizeEvent(self, e):
diff --git a/examples/widgets/dialogs/classwizard/classwizard.py b/examples/widgets/dialogs/classwizard/classwizard.py
index fc2feb49..d0e970f9 100644
--- a/examples/widgets/dialogs/classwizard/classwizard.py
+++ b/examples/widgets/dialogs/classwizard/classwizard.py
@@ -325,7 +325,7 @@ class CodeStylePage(QtWidgets.QWizardPage):
if not is_baseClass:
self.baseIncludeLineEdit.clear()
- elif QtCore.QRegExp('Q[A-Z].*').exactMatch(baseClass):
+ elif QtCore.QRegularExpression('^Q[A-Z].*$').match(baseClass).hasMatch():
self.baseIncludeLineEdit.setText('<' + baseClass + '>')
else:
self.baseIncludeLineEdit.setText('"' + baseClass.lower() + '.h"')
diff --git a/examples/widgets/dialogs/standarddialogs.py b/examples/widgets/dialogs/standarddialogs.py
index f61157e7..ea1afa4c 100644
--- a/examples/widgets/dialogs/standarddialogs.py
+++ b/examples/widgets/dialogs/standarddialogs.py
@@ -119,7 +119,7 @@ class Dialog(QtWidgets.QDialog):
self.errorLabel = QtWidgets.QLabel()
self.errorLabel.setFrameStyle(frameStyle)
- self.errorButton = QtWidgets.QPushButton("QErrorMessage.show&M&essage()")
+ self.errorButton = QtWidgets.QPushButton("QErrorMessage.showM&essage()")
self.integerButton.clicked.connect(self.setInteger)
self.doubleButton.clicked.connect(self.setDouble)
diff --git a/examples/widgets/gallery/widgetgallery.py b/examples/widgets/gallery/widgetgallery.py
index a06ac2e2..9d3faeef 100644
--- a/examples/widgets/gallery/widgetgallery.py
+++ b/examples/widgets/gallery/widgetgallery.py
@@ -42,8 +42,8 @@ import sys
from PySide2.QtWidgets import *
from PySide2.QtGui import (QCursor, QDesktopServices, QGuiApplication, QIcon,
- QKeySequence, QStandardItem, QStandardItemModel,
- QScreen, QWindow)
+ QKeySequence, QShortcut, QStandardItem,
+ QStandardItemModel, QScreen, QWindow)
from PySide2.QtCore import (QDateTime, QDir, QLibraryInfo, QMetaObject,
QSysInfo, QTextStream, QTimer, Qt, qVersion)
diff --git a/examples/widgets/graphicsview/diagramscene/diagramscene.py b/examples/widgets/graphicsview/diagramscene/diagramscene.py
index 3890782c..079ae402 100644
--- a/examples/widgets/graphicsview/diagramscene/diagramscene.py
+++ b/examples/widgets/graphicsview/diagramscene/diagramscene.py
@@ -550,7 +550,7 @@ class MainWindow(QtWidgets.QMainWindow):
def createToolBox(self):
self.buttonGroup = QtWidgets.QButtonGroup()
self.buttonGroup.setExclusive(False)
- self.buttonGroup.buttonClicked[int].connect(self.buttonGroupClicked)
+ self.buttonGroup.idClicked.connect(self.buttonGroupClicked)
layout = QtWidgets.QGridLayout()
layout.addWidget(self.createCellWidget("Conditional", DiagramItem.Conditional),
@@ -607,38 +607,38 @@ class MainWindow(QtWidgets.QMainWindow):
self.toolBox.addItem(backgroundWidget, "Backgrounds")
def createActions(self):
- self.toFrontAction = QtWidgets.QAction(
+ self.toFrontAction = QtGui.QAction(
QtGui.QIcon(':/images/bringtofront.png'), "Bring to &Front",
self, shortcut="Ctrl+F", statusTip="Bring item to front",
triggered=self.bringToFront)
- self.sendBackAction = QtWidgets.QAction(
+ self.sendBackAction = QtGui.QAction(
QtGui.QIcon(':/images/sendtoback.png'), "Send to &Back", self,
shortcut="Ctrl+B", statusTip="Send item to back",
triggered=self.sendToBack)
- self.deleteAction = QtWidgets.QAction(QtGui.QIcon(':/images/delete.png'),
+ self.deleteAction = QtGui.QAction(QtGui.QIcon(':/images/delete.png'),
"&Delete", self, shortcut="Delete",
statusTip="Delete item from diagram",
triggered=self.deleteItem)
- self.exitAction = QtWidgets.QAction("E&xit", self, shortcut="Ctrl+X",
+ self.exitAction = QtGui.QAction("E&xit", self, shortcut="Ctrl+X",
statusTip="Quit Scenediagram example", triggered=self.close)
- self.boldAction = QtWidgets.QAction(QtGui.QIcon(':/images/bold.png'),
+ self.boldAction = QtGui.QAction(QtGui.QIcon(':/images/bold.png'),
"Bold", self, checkable=True, shortcut="Ctrl+B",
triggered=self.handleFontChange)
- self.italicAction = QtWidgets.QAction(QtGui.QIcon(':/images/italic.png'),
+ self.italicAction = QtGui.QAction(QtGui.QIcon(':/images/italic.png'),
"Italic", self, checkable=True, shortcut="Ctrl+I",
triggered=self.handleFontChange)
- self.underlineAction = QtWidgets.QAction(
+ self.underlineAction = QtGui.QAction(
QtGui.QIcon(':/images/underline.png'), "Underline", self,
checkable=True, shortcut="Ctrl+U",
triggered=self.handleFontChange)
- self.aboutAction = QtWidgets.QAction("A&bout", self, shortcut="Ctrl+B",
+ self.aboutAction = QtGui.QAction("A&bout", self, shortcut="Ctrl+B",
triggered=self.about)
def createMenus(self):
@@ -726,12 +726,12 @@ class MainWindow(QtWidgets.QMainWindow):
self.pointerTypeGroup.addButton(pointerButton, DiagramScene.MoveItem)
self.pointerTypeGroup.addButton(linePointerButton,
DiagramScene.InsertLine)
- self.pointerTypeGroup.buttonClicked[int].connect(self.pointerGroupClicked)
+ self.pointerTypeGroup.idClicked.connect(self.pointerGroupClicked)
self.sceneScaleCombo = QtWidgets.QComboBox()
self.sceneScaleCombo.addItems(["50%", "75%", "100%", "125%", "150%"])
self.sceneScaleCombo.setCurrentIndex(2)
- self.sceneScaleCombo.currentIndexChanged[str].connect(self.sceneScaleChanged)
+ self.sceneScaleCombo.currentTextChanged.connect(self.sceneScaleChanged)
self.pointerToolbar = self.addToolBar("Pointer type")
self.pointerToolbar.addWidget(pointerButton)
@@ -780,7 +780,7 @@ class MainWindow(QtWidgets.QMainWindow):
colorMenu = QtWidgets.QMenu(self)
for color, name in zip(colors, names):
- action = QtWidgets.QAction(self.createColorIcon(color), name, self,
+ action = QtGui.QAction(self.createColorIcon(color), name, self,
triggered=slot)
action.setData(QtGui.QColor(color))
colorMenu.addAction(action)
diff --git a/examples/widgets/itemviews/addressbook/addressbook.py b/examples/widgets/itemviews/addressbook/addressbook.py
index 262027a6..35d09528 100644
--- a/examples/widgets/itemviews/addressbook/addressbook.py
+++ b/examples/widgets/itemviews/addressbook/addressbook.py
@@ -40,7 +40,8 @@
##
#############################################################################
-from PySide2.QtWidgets import (QMainWindow, QAction, QFileDialog, QApplication)
+from PySide2.QtGui import QAction
+from PySide2.QtWidgets import (QMainWindow, QFileDialog, QApplication)
from addresswidget import AddressWidget
diff --git a/examples/widgets/itemviews/addressbook/addresswidget.py b/examples/widgets/itemviews/addressbook/addresswidget.py
index b70b44b0..d0c1747f 100644
--- a/examples/widgets/itemviews/addressbook/addresswidget.py
+++ b/examples/widgets/itemviews/addressbook/addresswidget.py
@@ -45,7 +45,7 @@ try:
except ImportError:
import pickle
-from PySide2.QtCore import (Qt, Signal, QRegExp, QModelIndex,
+from PySide2.QtCore import (Qt, Signal, QRegularExpression, QModelIndex,
QItemSelection, QSortFilterProxyModel)
from PySide2.QtWidgets import QTabWidget, QMessageBox, QTableView, QAbstractItemView
@@ -193,9 +193,10 @@ class AddressWidget(QTabWidget):
# tab. The regex will end up looking like "^[ABC].*", only
# allowing this tab to display items where the name starts with
# "A", "B", or "C". Notice that we set it to be case-insensitive.
- reFilter = "^[%s].*" % group
-
- proxyModel.setFilterRegExp(QRegExp(reFilter, Qt.CaseInsensitive))
+ re = QRegularExpression("^[{}].*".format(group))
+ assert re.isValid()
+ re.setPatternOptions(QRegularExpression.CaseInsensitiveOption)
+ proxyModel.setFilterRegularExpression(re)
proxyModel.setFilterKeyColumn(0) # Filter on the "name" column
proxyModel.sort(0, Qt.AscendingOrder)
diff --git a/examples/widgets/mainwindows/application/application.py b/examples/widgets/mainwindows/application/application.py
index 8c4626f9..d68e77b4 100644
--- a/examples/widgets/mainwindows/application/application.py
+++ b/examples/widgets/mainwindows/application/application.py
@@ -106,46 +106,46 @@ class MainWindow(QtWidgets.QMainWindow):
self.setWindowModified(self.textEdit.document().isModified())
def createActions(self):
- self.newAct = QtWidgets.QAction(QtGui.QIcon(':/images/new.png'), "&New",
+ self.newAct = QtGui.QAction(QtGui.QIcon(':/images/new.png'), "&New",
self, shortcut=QtGui.QKeySequence.New,
statusTip="Create a new file", triggered=self.newFile)
- self.openAct = QtWidgets.QAction(QtGui.QIcon(':/images/open.png'),
+ self.openAct = QtGui.QAction(QtGui.QIcon(':/images/open.png'),
"&Open...", self, shortcut=QtGui.QKeySequence.Open,
statusTip="Open an existing file", triggered=self.open)
- self.saveAct = QtWidgets.QAction(QtGui.QIcon(':/images/save.png'),
+ self.saveAct = QtGui.QAction(QtGui.QIcon(':/images/save.png'),
"&Save", self, shortcut=QtGui.QKeySequence.Save,
statusTip="Save the document to disk", triggered=self.save)
- self.saveAsAct = QtWidgets.QAction("Save &As...", self,
+ self.saveAsAct = QtGui.QAction("Save &As...", self,
shortcut=QtGui.QKeySequence.SaveAs,
statusTip="Save the document under a new name",
triggered=self.saveAs)
- self.exitAct = QtWidgets.QAction("E&xit", self, shortcut="Ctrl+Q",
+ self.exitAct = QtGui.QAction("E&xit", self, shortcut="Ctrl+Q",
statusTip="Exit the application", triggered=self.close)
- self.cutAct = QtWidgets.QAction(QtGui.QIcon(':/images/cut.png'), "Cu&t",
+ self.cutAct = QtGui.QAction(QtGui.QIcon(':/images/cut.png'), "Cu&t",
self, shortcut=QtGui.QKeySequence.Cut,
statusTip="Cut the current selection's contents to the clipboard",
triggered=self.textEdit.cut)
- self.copyAct = QtWidgets.QAction(QtGui.QIcon(':/images/copy.png'),
+ self.copyAct = QtGui.QAction(QtGui.QIcon(':/images/copy.png'),
"&Copy", self, shortcut=QtGui.QKeySequence.Copy,
statusTip="Copy the current selection's contents to the clipboard",
triggered=self.textEdit.copy)
- self.pasteAct = QtWidgets.QAction(QtGui.QIcon(':/images/paste.png'),
+ self.pasteAct = QtGui.QAction(QtGui.QIcon(':/images/paste.png'),
"&Paste", self, shortcut=QtGui.QKeySequence.Paste,
statusTip="Paste the clipboard's contents into the current selection",
triggered=self.textEdit.paste)
- self.aboutAct = QtWidgets.QAction("&About", self,
+ self.aboutAct = QtGui.QAction("&About", self,
statusTip="Show the application's About box",
triggered=self.about)
- self.aboutQtAct = QtWidgets.QAction("About &Qt", self,
+ self.aboutQtAct = QtGui.QAction("About &Qt", self,
statusTip="Show the Qt library's About box",
triggered=qApp.aboutQt)
diff --git a/examples/widgets/mainwindows/dockwidgets/dockwidgets.py b/examples/widgets/mainwindows/dockwidgets/dockwidgets.py
index 53f6f781..87a818c0 100644
--- a/examples/widgets/mainwindows/dockwidgets/dockwidgets.py
+++ b/examples/widgets/mainwindows/dockwidgets/dockwidgets.py
@@ -43,10 +43,10 @@
"""PySide2 port of the widgets/mainwindows/dockwidgets example from Qt v5.x, originating from PyQt"""
from PySide2.QtCore import QDate, QFile, Qt, QTextStream
-from PySide2.QtGui import (QFont, QIcon, QKeySequence, QTextCharFormat,
- QTextCursor, QTextTableFormat)
+from PySide2.QtGui import (QAction, QFont, QIcon, QKeySequence,
+ QTextCharFormat, QTextCursor, QTextTableFormat)
from PySide2.QtPrintSupport import QPrintDialog, QPrinter
-from PySide2.QtWidgets import (QAction, QApplication, QDialog, QDockWidget,
+from PySide2.QtWidgets import (QApplication, QDialog, QDockWidget,
QFileDialog, QListWidget, QMainWindow, QMessageBox, QTextEdit)
import dockwidgets_rc
diff --git a/examples/widgets/mainwindows/mdi/mdi.py b/examples/widgets/mainwindows/mdi/mdi.py
index 9daca826..18bbfa5f 100644
--- a/examples/widgets/mainwindows/mdi/mdi.py
+++ b/examples/widgets/mainwindows/mdi/mdi.py
@@ -44,8 +44,8 @@
from PySide2.QtCore import (QFile, QFileInfo, QPoint, QSettings, QSignalMapper,
QSaveFile, QSize, QTextStream, Qt)
-from PySide2.QtGui import QIcon, QKeySequence
-from PySide2.QtWidgets import (QAction, QApplication, QFileDialog, QMainWindow,
+from PySide2.QtGui import QAction, QIcon, QKeySequence
+from PySide2.QtWidgets import (QApplication, QFileDialog, QMainWindow,
QMdiArea, QMessageBox, QTextEdit, QWidget)
import mdi_rc
@@ -171,7 +171,7 @@ class MainWindow(QMainWindow):
self.mdiArea.subWindowActivated.connect(self.updateMenus)
self.windowMapper = QSignalMapper(self)
- self.windowMapper.mapped[QWidget].connect(self.setActiveSubWindow)
+ self.windowMapper.mappedObject.connect(self.setActiveSubWindow)
self.createActions()
self.createMenus()
diff --git a/examples/widgets/richtext/syntaxhighlighter.py b/examples/widgets/richtext/syntaxhighlighter.py
index 82e4c79a..9be29940 100644
--- a/examples/widgets/richtext/syntaxhighlighter.py
+++ b/examples/widgets/richtext/syntaxhighlighter.py
@@ -130,65 +130,73 @@ class Highlighter(QtGui.QSyntaxHighlighter):
"\\bunion\\b", "\\bunsigned\\b", "\\bvirtual\\b", "\\bvoid\\b",
"\\bvolatile\\b"]
- self.highlightingRules = [(QtCore.QRegExp(pattern), keywordFormat)
+ self.highlightingRules = [(QtCore.QRegularExpression(pattern), keywordFormat)
for pattern in keywordPatterns]
classFormat = QtGui.QTextCharFormat()
classFormat.setFontWeight(QtGui.QFont.Bold)
classFormat.setForeground(QtCore.Qt.darkMagenta)
- self.highlightingRules.append((QtCore.QRegExp("\\bQ[A-Za-z]+\\b"),
- classFormat))
+ pattern = QtCore.QRegularExpression(r'\bQ[A-Za-z]+\b')
+ assert pattern.isValid()
+ self.highlightingRules.append((pattern, classFormat))
singleLineCommentFormat = QtGui.QTextCharFormat()
singleLineCommentFormat.setForeground(QtCore.Qt.red)
- self.highlightingRules.append((QtCore.QRegExp("//[^\n]*"),
- singleLineCommentFormat))
+ pattern = QtCore.QRegularExpression('//[^\n]*')
+ assert pattern.isValid()
+ self.highlightingRules.append((pattern, singleLineCommentFormat))
self.multiLineCommentFormat = QtGui.QTextCharFormat()
self.multiLineCommentFormat.setForeground(QtCore.Qt.red)
quotationFormat = QtGui.QTextCharFormat()
quotationFormat.setForeground(QtCore.Qt.darkGreen)
- self.highlightingRules.append((QtCore.QRegExp("\".*\""),
- quotationFormat))
+ pattern = QtCore.QRegularExpression('".*"')
+ assert pattern.isValid()
+ self.highlightingRules.append((pattern, quotationFormat))
functionFormat = QtGui.QTextCharFormat()
functionFormat.setFontItalic(True)
functionFormat.setForeground(QtCore.Qt.blue)
- self.highlightingRules.append((QtCore.QRegExp("\\b[A-Za-z0-9_]+(?=\\()"),
- functionFormat))
+ pattern = QtCore.QRegularExpression(r'\b[A-Za-z0-9_]+(?=\()')
+ assert pattern.isValid()
+ self.highlightingRules.append((pattern, functionFormat))
- self.commentStartExpression = QtCore.QRegExp("/\\*")
- self.commentEndExpression = QtCore.QRegExp("\\*/")
+ self.commentStartExpression = QtCore.QRegularExpression(r'/\*')
+ assert self.commentStartExpression.isValid()
+ self.commentEndExpression = QtCore.QRegularExpression(r'\*/')
+ assert self.commentEndExpression.isValid()
def highlightBlock(self, text):
for pattern, format in self.highlightingRules:
- expression = QtCore.QRegExp(pattern)
- index = expression.indexIn(text)
- while index >= 0:
- length = expression.matchedLength()
+ match = pattern.match(text)
+ while match.hasMatch():
+ index = match.capturedStart(0)
+ length = match.capturedLength(0)
self.setFormat(index, length, format)
- index = expression.indexIn(text, index + length)
+ match = pattern.match(text, index + length)
self.setCurrentBlockState(0)
startIndex = 0
if self.previousBlockState() != 1:
- startIndex = self.commentStartExpression.indexIn(text)
+ match = self.commentStartExpression.match(text)
+ startIndex = match.capturedStart(0) if match.hasMatch() else -1
while startIndex >= 0:
- endIndex = self.commentEndExpression.indexIn(text, startIndex)
-
- if endIndex == -1:
+ match = self.commentEndExpression.match(text, startIndex)
+ if match.hasMatch():
+ endIndex = match.capturedStart(0)
+ length = match.capturedLength(0)
+ commentLength = endIndex - startIndex + length
+ else:
self.setCurrentBlockState(1)
commentLength = len(text) - startIndex
- else:
- commentLength = endIndex - startIndex + self.commentEndExpression.matchedLength()
self.setFormat(startIndex, commentLength,
self.multiLineCommentFormat)
- startIndex = self.commentStartExpression.indexIn(text,
- startIndex + commentLength)
+ match = self.commentStartExpression.match(text, startIndex + commentLength)
+ startIndex = match.capturedStart(0) if match.hasMatch() else -1
if __name__ == '__main__':
diff --git a/examples/widgets/state-machine/rogue.py b/examples/widgets/state-machine/rogue.py
index 755b847a..ce5b8059 100644
--- a/examples/widgets/state-machine/rogue.py
+++ b/examples/widgets/state-machine/rogue.py
@@ -146,12 +146,13 @@ class MainWindow(QMainWindow):
def sizeHint(self):
metrics = QFontMetrics(self.font())
- return QSize(metrics.width('X') * self.width, metrics.height() * (self.height + 1))
+ return QSize(metrics.horizontalAdvance('X') * self.width,
+ metrics.height() * (self.height + 1))
def paintEvent(self, event):
metrics = QFontMetrics(self.font())
painter = QPainter(self)
fontHeight = metrics.height()
- fontWidth = metrics.width('X')
+ fontWidth = metrics.horizontalAdvance('X')
painter.fillRect(self.rect(), Qt.black)
painter.setPen(Qt.white)
diff --git a/examples/widgets/systray/window.py b/examples/widgets/systray/window.py
index ca65f04e..63464632 100644
--- a/examples/widgets/systray/window.py
+++ b/examples/widgets/systray/window.py
@@ -39,8 +39,8 @@
#############################################################################
from PySide2.QtCore import Slot
-from PySide2.QtGui import QIcon
-from PySide2.QtWidgets import (QAction, QCheckBox, QComboBox, QDialog,
+from PySide2.QtGui import QAction, QIcon
+from PySide2.QtWidgets import (QCheckBox, QComboBox, QDialog,
QGridLayout, QGroupBox, QHBoxLayout, QLabel,
QLineEdit, QMenu, QMessageBox, QPushButton,
QSpinBox, QStyle, QSystemTrayIcon, QTextEdit,
diff --git a/examples/widgets/widgets/hellogl_openglwidget_legacy.py b/examples/widgets/widgets/hellogl_openglwidget_legacy.py
deleted file mode 100644
index 8745b4e8..00000000
--- a/examples/widgets/widgets/hellogl_openglwidget_legacy.py
+++ /dev/null
@@ -1,288 +0,0 @@
-
-############################################################################
-##
-## Copyright (C) 2017 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$
-##
-############################################################################
-
-"""PySide2 port of the opengl/legacy/hellogl example from Qt v5.x modified to use a QOpenGLWidget to demonstrate porting from QGLWidget to QOpenGLWidget"""
-
-import sys
-import math
-from PySide2 import QtCore, QtGui, QtWidgets
-
-try:
- from OpenGL import GL
-except ImportError:
- app = QtWidgets.QApplication(sys.argv)
- messageBox = QtWidgets.QMessageBox(QtWidgets.QMessageBox.Critical, "OpenGL hellogl",
- "PyOpenGL must be installed to run this example.",
- QtWidgets.QMessageBox.Close)
- messageBox.setDetailedText("Run:\npip install PyOpenGL PyOpenGL_accelerate")
- messageBox.exec_()
- sys.exit(1)
-
-
-class Window(QtWidgets.QWidget):
- def __init__(self, parent=None):
- QtWidgets.QWidget.__init__(self, parent)
-
- self.glWidget = GLWidget()
-
- self.xSlider = self.createSlider(QtCore.SIGNAL("xRotationChanged(int)"),
- self.glWidget.setXRotation)
- self.ySlider = self.createSlider(QtCore.SIGNAL("yRotationChanged(int)"),
- self.glWidget.setYRotation)
- self.zSlider = self.createSlider(QtCore.SIGNAL("zRotationChanged(int)"),
- self.glWidget.setZRotation)
-
- mainLayout = QtWidgets.QHBoxLayout()
- mainLayout.addWidget(self.glWidget)
- mainLayout.addWidget(self.xSlider)
- mainLayout.addWidget(self.ySlider)
- mainLayout.addWidget(self.zSlider)
- self.setLayout(mainLayout)
-
- self.xSlider.setValue(170 * 16)
- self.ySlider.setValue(160 * 16)
- self.zSlider.setValue(90 * 16)
-
- self.setWindowTitle(self.tr("QOpenGLWidget"))
-
- def createSlider(self, changedSignal, setterSlot):
- slider = QtWidgets.QSlider(QtCore.Qt.Vertical)
-
- slider.setRange(0, 360 * 16)
- slider.setSingleStep(16)
- slider.setPageStep(15 * 16)
- slider.setTickInterval(15 * 16)
- slider.setTickPosition(QtWidgets.QSlider.TicksRight)
-
- self.glWidget.connect(slider, QtCore.SIGNAL("valueChanged(int)"), setterSlot)
- self.connect(self.glWidget, changedSignal, slider, QtCore.SLOT("setValue(int)"))
-
- return slider
-
-
-class GLWidget(QtWidgets.QOpenGLWidget):
- xRotationChanged = QtCore.Signal(int)
- yRotationChanged = QtCore.Signal(int)
- zRotationChanged = QtCore.Signal(int)
-
- def __init__(self, parent=None):
- QtWidgets.QOpenGLWidget.__init__(self, parent)
-
- self.object = 0
- self.xRot = 0
- self.yRot = 0
- self.zRot = 0
-
- self.lastPos = QtCore.QPoint()
-
- self.trolltechGreen = QtGui.QColor.fromCmykF(0.40, 0.0, 1.0, 0.0)
- self.trolltechPurple = QtGui.QColor.fromCmykF(0.39, 0.39, 0.0, 0.0)
-
- def xRotation(self):
- return self.xRot
-
- def yRotation(self):
- return self.yRot
-
- def zRotation(self):
- return self.zRot
-
- def minimumSizeHint(self):
- return QtCore.QSize(50, 50)
-
- def sizeHint(self):
- return QtCore.QSize(400, 400)
-
- def setXRotation(self, angle):
- angle = self.normalizeAngle(angle)
- if angle != self.xRot:
- self.xRot = angle
- self.emit(QtCore.SIGNAL("xRotationChanged(int)"), angle)
- self.update()
-
- def setYRotation(self, angle):
- angle = self.normalizeAngle(angle)
- if angle != self.yRot:
- self.yRot = angle
- self.emit(QtCore.SIGNAL("yRotationChanged(int)"), angle)
- self.update()
-
- def setZRotation(self, angle):
- angle = self.normalizeAngle(angle)
- if angle != self.zRot:
- self.zRot = angle
- self.emit(QtCore.SIGNAL("zRotationChanged(int)"), angle)
- self.update()
-
- def initializeGL(self):
- darkTrolltechPurple = self.trolltechPurple.darker()
- GL.glClearColor(darkTrolltechPurple.redF(), darkTrolltechPurple.greenF(), darkTrolltechPurple.blueF(), darkTrolltechPurple.alphaF())
- self.object = self.makeObject()
- GL.glShadeModel(GL.GL_FLAT)
- GL.glEnable(GL.GL_DEPTH_TEST)
- GL.glEnable(GL.GL_CULL_FACE)
-
- def paintGL(self):
- GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT)
- GL.glLoadIdentity()
- GL.glTranslated(0.0, 0.0, -10.0)
- GL.glRotated(self.xRot / 16.0, 1.0, 0.0, 0.0)
- GL.glRotated(self.yRot / 16.0, 0.0, 1.0, 0.0)
- GL.glRotated(self.zRot / 16.0, 0.0, 0.0, 1.0)
- GL.glCallList(self.object)
-
- def resizeGL(self, width, height):
- side = min(width, height)
- GL.glViewport(int((width - side) / 2),int((height - side) / 2), side, side)
-
- GL.glMatrixMode(GL.GL_PROJECTION)
- GL.glLoadIdentity()
- GL.glOrtho(-0.5, +0.5, -0.5, +0.5, 4.0, 15.0)
- GL.glMatrixMode(GL.GL_MODELVIEW)
-
- def mousePressEvent(self, event):
- self.lastPos = QtCore.QPoint(event.pos())
-
- def mouseMoveEvent(self, event):
- dx = event.x() - self.lastPos.x()
- dy = event.y() - self.lastPos.y()
-
- if event.buttons() & QtCore.Qt.LeftButton:
- self.setXRotation(self.xRot + 8 * dy)
- self.setYRotation(self.yRot + 8 * dx)
- elif event.buttons() & QtCore.Qt.RightButton:
- self.setXRotation(self.xRot + 8 * dy)
- self.setZRotation(self.zRot + 8 * dx)
-
- self.lastPos = QtCore.QPoint(event.pos())
-
- def makeObject(self):
- genList = GL.glGenLists(1)
- GL.glNewList(genList, GL.GL_COMPILE)
-
- GL.glBegin(GL.GL_QUADS)
-
- x1 = +0.06
- y1 = -0.14
- x2 = +0.14
- y2 = -0.06
- x3 = +0.08
- y3 = +0.00
- x4 = +0.30
- y4 = +0.22
-
- self.quad(x1, y1, x2, y2, y2, x2, y1, x1)
- self.quad(x3, y3, x4, y4, y4, x4, y3, x3)
-
- self.extrude(x1, y1, x2, y2)
- self.extrude(x2, y2, y2, x2)
- self.extrude(y2, x2, y1, x1)
- self.extrude(y1, x1, x1, y1)
- self.extrude(x3, y3, x4, y4)
- self.extrude(x4, y4, y4, x4)
- self.extrude(y4, x4, y3, x3)
-
- Pi = 3.14159265358979323846
- NumSectors = 200
-
- for i in range(NumSectors):
- angle1 = (i * 2 * Pi) / NumSectors
- x5 = 0.30 * math.sin(angle1)
- y5 = 0.30 * math.cos(angle1)
- x6 = 0.20 * math.sin(angle1)
- y6 = 0.20 * math.cos(angle1)
-
- angle2 = ((i + 1) * 2 * Pi) / NumSectors
- x7 = 0.20 * math.sin(angle2)
- y7 = 0.20 * math.cos(angle2)
- x8 = 0.30 * math.sin(angle2)
- y8 = 0.30 * math.cos(angle2)
-
- self.quad(x5, y5, x6, y6, x7, y7, x8, y8)
-
- self.extrude(x6, y6, x7, y7)
- self.extrude(x8, y8, x5, y5)
-
- GL.glEnd()
- GL.glEndList()
-
- return genList
-
- def quad(self, x1, y1, x2, y2, x3, y3, x4, y4):
- GL.glColor(self.trolltechGreen.redF(), self.trolltechGreen.greenF(), self.trolltechGreen.blueF(), self.trolltechGreen.alphaF())
-
- GL.glVertex3d(x1, y1, +0.05)
- GL.glVertex3d(x2, y2, +0.05)
- GL.glVertex3d(x3, y3, +0.05)
- GL.glVertex3d(x4, y4, +0.05)
-
- GL.glVertex3d(x4, y4, -0.05)
- GL.glVertex3d(x3, y3, -0.05)
- GL.glVertex3d(x2, y2, -0.05)
- GL.glVertex3d(x1, y1, -0.05)
-
- def extrude(self, x1, y1, x2, y2):
- darkTrolltechGreen = self.trolltechGreen.darker(250 + int(100 * x1))
- GL.glColor(darkTrolltechGreen.redF(), darkTrolltechGreen.greenF(), darkTrolltechGreen.blueF(), darkTrolltechGreen.alphaF())
-
- GL.glVertex3d(x1, y1, -0.05)
- GL.glVertex3d(x2, y2, -0.05)
- GL.glVertex3d(x2, y2, +0.05)
- GL.glVertex3d(x1, y1, +0.05)
-
- def normalizeAngle(self, angle):
- while angle < 0:
- angle += 360 * 16
- while angle > 360 * 16:
- angle -= 360 * 16
- return angle
-
- def freeResources(self):
- self.makeCurrent()
- GL.glDeleteLists(self.object, 1)
-
-if __name__ == '__main__':
- app = QtWidgets.QApplication(sys.argv)
- window = Window()
- window.show()
- res = app.exec_()
- window.glWidget.freeResources()
- sys.exit(res)
diff --git a/examples/xml/dombookmarks/dombookmarks.py b/examples/xml/dombookmarks/dombookmarks.py
index 20ec09e2..f645bedc 100644
--- a/examples/xml/dombookmarks/dombookmarks.py
+++ b/examples/xml/dombookmarks/dombookmarks.py
@@ -100,18 +100,18 @@ class MainWindow(QtWidgets.QMainWindow):
"DOM classes to read and write XML documents.")
def createActions(self):
- self.openAct = QtWidgets.QAction("&Open...", self, shortcut="Ctrl+O",
+ self.openAct = QtGui.QAction("&Open...", self, shortcut="Ctrl+O",
triggered=self.open)
- self.saveAsAct = QtWidgets.QAction("&Save As...", self, shortcut="Ctrl+S",
+ self.saveAsAct = QtGui.QAction("&Save As...", self, shortcut="Ctrl+S",
triggered=self.saveAs)
- self.exitAct = QtWidgets.QAction("E&xit", self, shortcut="Ctrl+Q",
+ self.exitAct = QtGui.QAction("E&xit", self, shortcut="Ctrl+Q",
triggered=self.close)
- self.aboutAct = QtWidgets.QAction("&About", self, triggered=self.about)
+ self.aboutAct = QtGui.QAction("&About", self, triggered=self.about)
- self.aboutQtAct = QtWidgets.QAction("About &Qt", self,
+ self.aboutQtAct = QtGui.QAction("About &Qt", self,
triggered=qApp.aboutQt)
def createMenus(self):
diff --git a/examples/xmlpatterns/schema/schema.py b/examples/xmlpatterns/schema/schema.py
index 677b5649..d3c22c18 100644
--- a/examples/xmlpatterns/schema/schema.py
+++ b/examples/xmlpatterns/schema/schema.py
@@ -77,19 +77,22 @@ class XmlSyntaxHighlighter(QtGui.QSyntaxHighlighter):
format = QtGui.QTextCharFormat()
format.setForeground(QtCore.Qt.darkBlue)
format.setFontWeight(QtGui.QFont.Bold)
- pattern = QtCore.QRegExp("(<[a-zA-Z:]+\\b|<\\?[a-zA-Z:]+\\b|\\?>|>|/>|</[a-zA-Z:]+>)")
+ pattern = QtCore.QRegularExpression(r'(<[a-zA-Z:]+\b|<\?[a-zA-Z:]+\b|\?>|>|/>|</[a-zA-Z:]+>)')
+ assert pattern.isValid()
self.highlightingRules.append((pattern, format))
# Attribute format.
format = QtGui.QTextCharFormat()
format.setForeground(QtCore.Qt.darkGreen)
- pattern = QtCore.QRegExp("[a-zA-Z:]+=")
+ pattern = QtCore.QRegularExpression('[a-zA-Z:]+=')
+ assert pattern.isValid()
self.highlightingRules.append((pattern, format))
# Attribute content format.
format = QtGui.QTextCharFormat()
format.setForeground(QtCore.Qt.red)
- pattern = QtCore.QRegExp("(\"[^\"]*\"|'[^']*')")
+ pattern = QtCore.QRegularExpression("(\"[^\"]*\"|'[^']*')")
+ assert pattern.isValid()
self.highlightingRules.append((pattern, format))
# Comment format.
@@ -97,35 +100,41 @@ class XmlSyntaxHighlighter(QtGui.QSyntaxHighlighter):
self.commentFormat.setForeground(QtCore.Qt.lightGray)
self.commentFormat.setFontItalic(True)
- self.commentStartExpression = QtCore.QRegExp("<!--")
- self.commentEndExpression = QtCore.QRegExp("-->")
+ self.commentStartExpression = QtCore.QRegularExpression("<!--")
+ assert self.commentStartExpression.isValid()
+ self.commentEndExpression = QtCore.QRegularExpression("-->")
+ assert self.commentEndExpression.isValid()
def highlightBlock(self, text):
for pattern, format in self.highlightingRules:
- expression = QtCore.QRegExp(pattern)
- index = expression.indexIn(text)
- while index >= 0:
- length = expression.matchedLength()
+ match = pattern.match(text)
+ while match.hasMatch():
+ index = match.capturedStart()
+ length = match.capturedLength(0)
self.setFormat(index, length, format)
- index = expression.indexIn(text, index + length)
+ match = pattern.match(text, index + length)
self.setCurrentBlockState(0)
startIndex = 0
if self.previousBlockState() != 1:
- startIndex = self.commentStartExpression.indexIn(text)
+ match = self.commentStartExpression.match(text)
+ startIndex = match.capturedStart(0) if match.hasMatch() else -1
while startIndex >= 0:
- endIndex = self.commentEndExpression.indexIn(text, startIndex)
- if endIndex == -1:
+ match = self.commentEndExpression.match(text, startIndex)
+ endIndex = match.capturedStart(0) if match.hasMatch() else -1
+ if match.hasMatch():
+ endIndex = match.capturedStart(0)
+ length = match.capturedLength(0)
+ commentLength = endIndex - startIndex + length
+ else:
self.setCurrentBlockState(1)
commentLength = text.length() - startIndex
- else:
- commentLength = endIndex - startIndex + self.commentEndExpression.matchedLength()
self.setFormat(startIndex, commentLength, self.commentFormat)
- startIndex = self.commentStartExpression.indexIn(text,
- startIndex + commentLength)
+ match = self.commentStartExpression.match(text, startIndex + commentLength)
+ startIndex = match.capturedStart(0) if match.hasMatch() else -1
class MessageHandler(QtXmlPatterns.QAbstractMessageHandler):
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/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/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/extra