aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--MANIFEST.in40
-rw-r--r--README.md52
-rw-r--r--README.pyside2.md71
-rw-r--r--README.shiboken2-generator.md37
-rw-r--r--README.shiboken2.md13
-rw-r--r--build_history/blacklist.txt3
-rw-r--r--build_scripts/build_scripts.pyqtc18
-rw-r--r--build_scripts/config.py399
-rw-r--r--build_scripts/main.py448
-rw-r--r--build_scripts/options.py106
-rw-r--r--build_scripts/platforms/linux.py136
-rw-r--r--build_scripts/platforms/macos.py119
-rw-r--r--build_scripts/platforms/unix.py272
-rw-r--r--build_scripts/platforms/windows_desktop.py475
-rw-r--r--build_scripts/setup_runner.py167
-rw-r--r--build_scripts/utils.py233
-rw-r--r--coin_build_instructions.py42
-rw-r--r--coin_test_instructions.py17
-rw-r--r--docs/building/options.rst2
-rwxr-xr-xexamples/opengl/hellogl2.py2
-rw-r--r--examples/samplebinding/CMakeLists.txt26
-rw-r--r--examples/scriptableapplication/CMakeLists.txt36
-rw-r--r--examples/scriptableapplication/pyside2.pri40
-rw-r--r--examples/scriptableapplication/scriptableapplication.pro4
-rw-r--r--examples/utils/pyside2_config.py328
-rw-r--r--keyword-errors.lst43
-rw-r--r--popenasync.py360
-rw-r--r--setup.py195
-rw-r--r--sources/cmake_helpers/helpers.cmake78
m---------sources/pyside2-tools0
-rw-r--r--sources/pyside2/CMakeLists.txt111
-rw-r--r--sources/pyside2/PySide2/CMakeLists.txt49
-rw-r--r--sources/pyside2/PySide2/Qt3DAnimation/CMakeLists.txt15
-rw-r--r--sources/pyside2/PySide2/Qt3DCore/CMakeLists.txt15
-rw-r--r--sources/pyside2/PySide2/Qt3DCore/typesystem_3dcore.xml33
-rw-r--r--sources/pyside2/PySide2/Qt3DExtras/CMakeLists.txt15
-rw-r--r--sources/pyside2/PySide2/Qt3DInput/CMakeLists.txt15
-rw-r--r--sources/pyside2/PySide2/Qt3DInput/typesystem_3dinput.xml25
-rw-r--r--sources/pyside2/PySide2/Qt3DLogic/CMakeLists.txt15
-rw-r--r--sources/pyside2/PySide2/Qt3DRender/CMakeLists.txt15
-rw-r--r--sources/pyside2/PySide2/QtAxContainer/CMakeLists.txt15
-rw-r--r--sources/pyside2/PySide2/QtCharts/CMakeLists.txt13
-rw-r--r--sources/pyside2/PySide2/QtCharts/typesystem_charts.xml10
-rw-r--r--sources/pyside2/PySide2/QtConcurrent/CMakeLists.txt13
-rw-r--r--sources/pyside2/PySide2/QtConcurrent/typesystem_concurrent.xml2
-rw-r--r--sources/pyside2/PySide2/QtCore/CMakeLists.txt33
-rw-r--r--sources/pyside2/PySide2/QtCore/glue/qbytearray_msetitem.cpp158
-rw-r--r--sources/pyside2/PySide2/QtCore/glue/qobject_connect.cpp227
-rw-r--r--sources/pyside2/PySide2/QtCore/typesystem_core_common.xml2391
-rw-r--r--sources/pyside2/PySide2/QtCore/typesystem_core_mac.xml8
-rw-r--r--sources/pyside2/PySide2/QtCore/typesystem_core_win.xml10
-rw-r--r--sources/pyside2/PySide2/QtCore/typesystem_core_x11.xml8
-rw-r--r--sources/pyside2/PySide2/QtDataVisualization/CMakeLists.txt13
-rw-r--r--sources/pyside2/PySide2/QtDataVisualization/typesystem_datavisualization.xml57
-rw-r--r--sources/pyside2/PySide2/QtGui/CMakeLists.txt38
-rw-r--r--sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml1567
-rw-r--r--sources/pyside2/PySide2/QtGui/typesystem_gui_mac.xml4
-rw-r--r--sources/pyside2/PySide2/QtHelp/CMakeLists.txt13
-rw-r--r--sources/pyside2/PySide2/QtHelp/typesystem_help.xml4
-rw-r--r--sources/pyside2/PySide2/QtLocation/CMakeLists.txt16
-rw-r--r--sources/pyside2/PySide2/QtMacExtras/CMakeLists.txt13
-rw-r--r--sources/pyside2/PySide2/QtMultimedia/CMakeLists.txt13
-rw-r--r--sources/pyside2/PySide2/QtMultimedia/typesystem_multimedia_common.xml42
-rw-r--r--sources/pyside2/PySide2/QtMultimediaWidgets/CMakeLists.txt13
-rw-r--r--sources/pyside2/PySide2/QtMultimediaWidgets/typesystem_multimediawidgets.xml8
-rw-r--r--sources/pyside2/PySide2/QtNetwork/CMakeLists.txt82
-rw-r--r--sources/pyside2/PySide2/QtNetwork/typesystem_network.xml108
-rw-r--r--sources/pyside2/PySide2/QtOpenGL/CMakeLists.txt13
-rw-r--r--sources/pyside2/PySide2/QtOpenGL/typesystem_opengl.xml298
-rw-r--r--sources/pyside2/PySide2/QtPositioning/CMakeLists.txt16
-rw-r--r--sources/pyside2/PySide2/QtPrintSupport/CMakeLists.txt13
-rw-r--r--sources/pyside2/PySide2/QtPrintSupport/typesystem_printsupport.xml18
-rw-r--r--sources/pyside2/PySide2/QtQml/CMakeLists.txt14
-rw-r--r--sources/pyside2/PySide2/QtQml/pysideqmlregistertype.cpp6
-rw-r--r--sources/pyside2/PySide2/QtQml/typesystem_qml.xml82
-rw-r--r--sources/pyside2/PySide2/QtQuick/CMakeLists.txt14
-rw-r--r--sources/pyside2/PySide2/QtQuick/pysidequickregistertype.cpp1
-rw-r--r--sources/pyside2/PySide2/QtQuick/typesystem_quick.xml118
-rw-r--r--sources/pyside2/PySide2/QtQuickWidgets/CMakeLists.txt13
-rw-r--r--sources/pyside2/PySide2/QtQuickWidgets/typesystem_quickwidgets.xml4
-rw-r--r--sources/pyside2/PySide2/QtScript/CMakeLists.txt18
-rw-r--r--sources/pyside2/PySide2/QtScript/typesystem_script.xml44
-rw-r--r--sources/pyside2/PySide2/QtScriptTools/CMakeLists.txt13
-rw-r--r--sources/pyside2/PySide2/QtScriptTools/typesystem_scripttools.xml6
-rw-r--r--sources/pyside2/PySide2/QtScxml/CMakeLists.txt16
-rw-r--r--sources/pyside2/PySide2/QtScxml/typesystem_scxml.xml8
-rw-r--r--sources/pyside2/PySide2/QtSensors/CMakeLists.txt16
-rw-r--r--sources/pyside2/PySide2/QtSql/CMakeLists.txt13
-rw-r--r--sources/pyside2/PySide2/QtSql/typesystem_sql.xml65
-rw-r--r--sources/pyside2/PySide2/QtSvg/CMakeLists.txt13
-rw-r--r--sources/pyside2/PySide2/QtSvg/typesystem_svg.xml4
-rw-r--r--sources/pyside2/PySide2/QtTest/CMakeLists.txt13
-rw-r--r--sources/pyside2/PySide2/QtTest/typesystem_test.xml4
-rw-r--r--sources/pyside2/PySide2/QtTextToSpeech/CMakeLists.txt13
-rw-r--r--sources/pyside2/PySide2/QtTextToSpeech/typesystem_texttospeech.xml2
-rw-r--r--sources/pyside2/PySide2/QtUiTools/CMakeLists.txt18
-rw-r--r--sources/pyside2/PySide2/QtUiTools/typesystem_uitools.xml35
-rw-r--r--sources/pyside2/PySide2/QtWebChannel/CMakeLists.txt13
-rw-r--r--sources/pyside2/PySide2/QtWebChannel/typesystem_webchannel.xml4
-rw-r--r--sources/pyside2/PySide2/QtWebEngine/CMakeLists.txt13
-rw-r--r--sources/pyside2/PySide2/QtWebEngineCore/CMakeLists.txt13
-rw-r--r--sources/pyside2/PySide2/QtWebEngineWidgets/CMakeLists.txt13
-rw-r--r--sources/pyside2/PySide2/QtWebEngineWidgets/typesystem_webenginewidgets.xml30
-rw-r--r--sources/pyside2/PySide2/QtWebKit/CMakeLists.txt13
-rw-r--r--sources/pyside2/PySide2/QtWebKitWidgets/CMakeLists.txt13
-rw-r--r--sources/pyside2/PySide2/QtWebKitWidgets/typesystem_webkitwidgets.xml105
-rw-r--r--sources/pyside2/PySide2/QtWebSockets/CMakeLists.txt13
-rw-r--r--sources/pyside2/PySide2/QtWebSockets/typesystem_websockets.xml26
-rw-r--r--sources/pyside2/PySide2/QtWidgets/CMakeLists.txt22
-rw-r--r--sources/pyside2/PySide2/QtWidgets/glue/qlayout_help_functions.cpp161
-rw-r--r--sources/pyside2/PySide2/QtWidgets/glue/qwidget_glue.cpp104
-rw-r--r--sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml779
-rw-r--r--sources/pyside2/PySide2/QtWinExtras/CMakeLists.txt13
-rw-r--r--sources/pyside2/PySide2/QtX11Extras/CMakeLists.txt13
-rw-r--r--sources/pyside2/PySide2/QtXml/CMakeLists.txt13
-rw-r--r--sources/pyside2/PySide2/QtXml/typesystem_xml.xml108
-rw-r--r--sources/pyside2/PySide2/QtXmlPatterns/CMakeLists.txt13
-rw-r--r--sources/pyside2/PySide2/QtXmlPatterns/typesystem_xmlpatterns.xml91
-rw-r--r--sources/pyside2/PySide2/__init__.py.in22
-rw-r--r--sources/pyside2/PySide2/_config.py.in13
-rw-r--r--sources/pyside2/PySide2/glue/qtcharts.cpp (renamed from sources/pyside2/PySide2/QtWidgets/glue/qapplication_init.cpp)16
-rw-r--r--sources/pyside2/PySide2/glue/qtcore.cpp1816
-rw-r--r--sources/pyside2/PySide2/glue/qtdatavisualization.cpp (renamed from sources/pyside2/PySide2/QtCore/glue/qcoreapplication_init.cpp)16
-rw-r--r--sources/pyside2/PySide2/glue/qtgui.cpp539
-rw-r--r--sources/pyside2/PySide2/glue/qtmultimedia.cpp (renamed from sources/pyside2/PySide2/QtGui/glue/qguiapplication_init.cpp)19
-rw-r--r--sources/pyside2/PySide2/glue/qtnetwork.cpp (renamed from sources/pyside2/PySide2/QtCore/glue/qbytearray_bufferprotocol.cpp)65
-rw-r--r--sources/pyside2/PySide2/glue/qtopengl.cpp (renamed from sources/pyside2/libpyside/globalreceiver.h)68
-rw-r--r--sources/pyside2/PySide2/glue/qtqml.cpp (renamed from sources/pyside2/PySide2/QtWidgets/glue/qmenubar_glue.cpp)34
-rw-r--r--sources/pyside2/PySide2/glue/qtquick.cpp42
-rw-r--r--sources/pyside2/PySide2/glue/qtscript.cpp74
-rw-r--r--sources/pyside2/PySide2/glue/qtuitools.cpp (renamed from sources/pyside2/PySide2/QtUiTools/glue/uitools_loadui.cpp)31
-rw-r--r--sources/pyside2/PySide2/glue/qtwebkitwidgets.cpp92
-rw-r--r--sources/pyside2/PySide2/glue/qtwidgets.cpp664
-rw-r--r--sources/pyside2/PySide2/glue/qtxml.cpp (renamed from sources/pyside2/PySide2/QtWidgets/glue/qmenu_glue.cpp)49
-rw-r--r--sources/pyside2/PySide2/glue/qtxmlpatterns.cpp43
-rw-r--r--sources/pyside2/PySide2/support/__init__.py10
-rw-r--r--sources/pyside2/PySide2/support/generate_pyi.py351
-rw-r--r--sources/pyside2/PySide2/support/signature/__init__.py8
-rw-r--r--sources/pyside2/PySide2/support/signature/layout.py42
-rw-r--r--sources/pyside2/PySide2/support/signature/lib/__init__.py40
-rw-r--r--sources/pyside2/PySide2/support/signature/lib/enum_sig.py42
-rw-r--r--sources/pyside2/PySide2/support/signature/loader.py110
-rw-r--r--sources/pyside2/PySide2/support/signature/mapping.py159
-rw-r--r--sources/pyside2/PySide2/support/signature/typing.py42
-rw-r--r--sources/pyside2/PySide2/templates/core_common.xml (renamed from sources/pyside2/PySide2/typesystem_templates.xml)365
-rw-r--r--sources/pyside2/PySide2/templates/datavisualization_common.xml (renamed from sources/pyside2/PySide2/QtCore/glue/qbytearray_mgetitem.cpp)83
-rw-r--r--sources/pyside2/PySide2/templates/gui_common.xml312
-rw-r--r--sources/pyside2/PySide2/templates/opengl_common.xml61
-rw-r--r--sources/pyside2/PySide2/templates/webkitwidgets_common.xml (renamed from sources/pyside2/PySide2/QtCore/glue/qobject_findchild.cpp)67
-rw-r--r--sources/pyside2/PySide2/templates/widgets_common.xml91
-rw-r--r--sources/pyside2/PySide2/templates/xml_common.xml58
-rw-r--r--sources/pyside2/cmake/Macros/PySideModules.cmake225
-rw-r--r--sources/pyside2/doc/CMakeLists.txt11
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/code/doc_src_qtcore.py (renamed from sources/pyside2/doc/codesnippets/doc/src/snippets/code/doc_src_qtcore.cpp)0
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/code/doc_src_qtnetwork.py (renamed from sources/pyside2/doc/codesnippets/doc/src/snippets/code/doc_src_qtnetwork.cpp)0
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/code/doc_src_qtopengl.py (renamed from sources/pyside2/doc/codesnippets/doc/src/snippets/code/doc_src_qtopengl.cpp)0
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/code/doc_src_qtprintsupport.py (renamed from sources/pyside2/doc/codesnippets/doc/src/snippets/code/doc_src_qtprintsupport.cpp)0
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/code/doc_src_qtqml.py (renamed from sources/pyside2/doc/codesnippets/doc/src/snippets/code/doc_src_qtqml.cpp)0
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/code/doc_src_qtquick.py (renamed from sources/pyside2/doc/codesnippets/doc/src/snippets/code/doc_src_qtquick.cpp)0
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/code/doc_src_qtsql.py (renamed from sources/pyside2/doc/codesnippets/doc/src/snippets/code/doc_src_qtsql.cpp)0
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/code/doc_src_qttest.py (renamed from sources/pyside2/doc/codesnippets/doc/src/snippets/code/doc_src_qttest.cpp)0
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/code/doc_src_qtwidgets.py (renamed from sources/pyside2/doc/codesnippets/doc/src/snippets/code/doc_src_qtwidgets.cpp)0
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/code/doc_src_qtxml.py (renamed from sources/pyside2/doc/codesnippets/doc/src/snippets/code/doc_src_qtxml.cpp)0
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/doc_src_qtcharts.py (renamed from sources/pyside2/doc/codesnippets/doc/src/snippets/doc_src_qtcharts.cpp)0
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/doc_src_qtgui.py (renamed from sources/pyside2/doc/codesnippets/doc/src/snippets/doc_src_qtgui.cpp)0
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/doc_src_qtmultimedia.py (renamed from sources/pyside2/doc/codesnippets/doc/src/snippets/doc_src_qtmultimedia.cpp)0
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/doc_src_qtxmlpatterns.py (renamed from sources/pyside2/doc/codesnippets/doc/src/snippets/doc_src_qtxmlpatterns.cpp)0
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/quiloader/doc_src_qtuiloader.py (renamed from sources/pyside2/doc/codesnippets/doc/src/snippets/quiloader/doc_src_qtuiloader.cpp)0
-rw-r--r--sources/pyside2/doc/conf.py.in4
-rw-r--r--sources/pyside2/doc/gettingstarted.rst18
-rw-r--r--sources/pyside2/doc/index.rst3
-rw-r--r--sources/pyside2/doc/pysideapi2.rst7
-rw-r--r--sources/pyside2/doc/pysideversion.rst14
-rw-r--r--sources/pyside2/doc/tutorials/basictutorial/clickablebutton.rst84
-rw-r--r--sources/pyside2/doc/tutorials/basictutorial/dialog.rst139
-rw-r--r--sources/pyside2/doc/tutorials/basictutorial/qml.rst63
-rw-r--r--sources/pyside2/doc/tutorials/basictutorial/uifiles.rst166
-rw-r--r--sources/pyside2/doc/tutorials/basictutorial/widgets.rst40
-rw-r--r--sources/pyside2/doc/tutorials/index.rst9
-rw-r--r--sources/pyside2/libpyside/CMakeLists.txt13
-rw-r--r--sources/pyside2/libpyside/PySide2Config-spec.cmake.in1
-rw-r--r--sources/pyside2/libpyside/destroylistener.cpp3
-rw-r--r--sources/pyside2/libpyside/destroylistener.h6
-rw-r--r--sources/pyside2/libpyside/dynamicqmetaobject.cpp991
-rw-r--r--sources/pyside2/libpyside/dynamicqmetaobject.h45
-rw-r--r--sources/pyside2/libpyside/dynamicqmetaobject_p.h5
-rw-r--r--sources/pyside2/libpyside/globalreceiver.cpp329
-rw-r--r--sources/pyside2/libpyside/globalreceiverv2.cpp48
-rw-r--r--sources/pyside2/libpyside/globalreceiverv2.h26
-rw-r--r--sources/pyside2/libpyside/pyside.cpp90
-rw-r--r--sources/pyside2/libpyside/pyside.h12
-rw-r--r--sources/pyside2/libpyside/pyside2.pc.in1
-rw-r--r--sources/pyside2/libpyside/pyside_p.h71
-rw-r--r--sources/pyside2/libpyside/pysideclassinfo.cpp20
-rw-r--r--sources/pyside2/libpyside/pysideclassinfo.h6
-rw-r--r--sources/pyside2/libpyside/pysidemetafunction.cpp7
-rw-r--r--sources/pyside2/libpyside/pysidemetafunction.h7
-rw-r--r--sources/pyside2/libpyside/pysidemetafunction_p.h4
-rw-r--r--sources/pyside2/libpyside/pysideproperty.cpp33
-rw-r--r--sources/pyside2/libpyside/pysideproperty.h4
-rw-r--r--sources/pyside2/libpyside/pysideqflags.cpp12
-rw-r--r--sources/pyside2/libpyside/pysidesignal.cpp41
-rw-r--r--sources/pyside2/libpyside/pysidesignal.h13
-rw-r--r--sources/pyside2/libpyside/pysideslot.cpp9
-rw-r--r--sources/pyside2/libpyside/pysideweakref.cpp2
-rw-r--r--sources/pyside2/libpyside/signalmanager.cpp (renamed from sources/pyside2/libpyside/signalmanager.cpp.in)132
-rw-r--r--sources/pyside2/libpyside/signalmanager.h34
-rw-r--r--sources/pyside2/pyside_version.py4
-rw-r--r--sources/pyside2/tests/CMakeLists.txt1
-rw-r--r--sources/pyside2/tests/QtCore/CMakeLists.txt2
-rw-r--r--sources/pyside2/tests/QtCore/bug_826.py4
-rw-r--r--sources/pyside2/tests/QtCore/qabstractitemmodel_test.py4
-rw-r--r--sources/pyside2/tests/QtCore/qcbor_test.py74
-rw-r--r--sources/pyside2/tests/QtCore/qenum_test.py18
-rw-r--r--sources/pyside2/tests/QtCore/qjsondocument_test.py56
-rw-r--r--sources/pyside2/tests/QtCore/qmetaobject_test.py6
-rw-r--r--sources/pyside2/tests/QtCore/qmodelindex_internalpointer_test.py23
-rw-r--r--sources/pyside2/tests/QtCore/qrandomgenerator_test.py2
-rw-r--r--sources/pyside2/tests/QtGui/qmatrix_test.py17
-rw-r--r--sources/pyside2/tests/QtNetwork/CMakeLists.txt1
-rw-r--r--sources/pyside2/tests/QtNetwork/qpassworddigestor_test.py45
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_493.py8
-rw-r--r--sources/pyside2/tests/QtWidgets/python_properties_test.py2
-rw-r--r--sources/pyside2/tests/QtWidgets/qlabel_test.py9
-rw-r--r--sources/pyside2/tests/QtWidgets/qstandarditemmodel_test.py9
-rw-r--r--sources/pyside2/tests/QtWidgets/qstyle_test.py8
-rw-r--r--sources/pyside2/tests/QtWidgets/qwidget_test.py23
-rw-r--r--sources/pyside2/tests/pysidetest/CMakeLists.txt8
-rw-r--r--sources/pyside2/tests/pysidetest/new_inherited_functions_test.py153
-rw-r--r--sources/pyside2/tests/registry/existence_test.py2
-rw-r--r--sources/pyside2/tests/registry/init_platform.py99
-rw-r--r--sources/pyside2/tests/support/voidptr_test.py4
-rw-r--r--sources/shiboken2/ApiExtractor/CMakeLists.txt1
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp706
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetabuilder.h14
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetabuilder_p.h45
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetalang.cpp398
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetalang.h99
-rw-r--r--sources/shiboken2/ApiExtractor/apiextractor.cpp34
-rw-r--r--sources/shiboken2/ApiExtractor/apiextractor.h3
-rw-r--r--sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp236
-rw-r--r--sources/shiboken2/ApiExtractor/clangparser/clangparser.cpp2
-rw-r--r--sources/shiboken2/ApiExtractor/clangparser/clangutils.cpp49
-rw-r--r--sources/shiboken2/ApiExtractor/clangparser/clangutils.h14
-rw-r--r--sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp12
-rw-r--r--sources/shiboken2/ApiExtractor/doc/conf.py.in6
-rw-r--r--sources/shiboken2/ApiExtractor/doc/typesystem_conversionrule.rst3
-rw-r--r--sources/shiboken2/ApiExtractor/doc/typesystem_documentation.rst6
-rw-r--r--sources/shiboken2/ApiExtractor/doc/typesystem_manipulating_objects.rst50
-rw-r--r--sources/shiboken2/ApiExtractor/doc/typesystem_specifying_types.rst65
-rw-r--r--sources/shiboken2/ApiExtractor/docparser.cpp79
-rw-r--r--sources/shiboken2/ApiExtractor/docparser.h16
-rw-r--r--sources/shiboken2/ApiExtractor/doxygenparser.cpp30
-rw-r--r--sources/shiboken2/ApiExtractor/fileout.cpp180
-rw-r--r--sources/shiboken2/ApiExtractor/fileout.h15
-rw-r--r--sources/shiboken2/ApiExtractor/include.cpp5
-rw-r--r--sources/shiboken2/ApiExtractor/include.h3
-rw-r--r--sources/shiboken2/ApiExtractor/messages.cpp446
-rw-r--r--sources/shiboken2/ApiExtractor/messages.h142
-rw-r--r--sources/shiboken2/ApiExtractor/parser/codemodel.cpp230
-rw-r--r--sources/shiboken2/ApiExtractor/parser/codemodel.h57
-rw-r--r--sources/shiboken2/ApiExtractor/parser/codemodel_enums.h13
-rw-r--r--sources/shiboken2/ApiExtractor/parser/enumvalue.h1
-rw-r--r--sources/shiboken2/ApiExtractor/qtdocparser.cpp1
-rw-r--r--sources/shiboken2/ApiExtractor/tests/CMakeLists.txt17
-rw-r--r--sources/shiboken2/ApiExtractor/tests/injectedcode.txt5
-rw-r--r--sources/shiboken2/ApiExtractor/tests/testabstractmetatype.cpp37
-rw-r--r--sources/shiboken2/ApiExtractor/tests/testabstractmetatype.h2
-rw-r--r--sources/shiboken2/ApiExtractor/tests/testaddfunction.cpp3
-rw-r--r--sources/shiboken2/ApiExtractor/tests/testcodeinjection.cpp45
-rw-r--r--sources/shiboken2/ApiExtractor/tests/testcodeinjection.h3
-rw-r--r--sources/shiboken2/ApiExtractor/tests/testcodeinjection.qrc6
-rw-r--r--sources/shiboken2/ApiExtractor/tests/testdroptypeentries.cpp6
-rw-r--r--sources/shiboken2/ApiExtractor/tests/testenum.cpp3
-rw-r--r--sources/shiboken2/ApiExtractor/tests/testmodifydocumentation.cpp2
-rw-r--r--sources/shiboken2/ApiExtractor/tests/testmodifydocumentation.qrc5
-rw-r--r--sources/shiboken2/ApiExtractor/tests/testmodifyfunction.cpp99
-rw-r--r--sources/shiboken2/ApiExtractor/tests/testmodifyfunction.h2
-rw-r--r--sources/shiboken2/ApiExtractor/tests/testrefcounttag.cpp3
-rw-r--r--sources/shiboken2/ApiExtractor/tests/testtemplates.cpp119
-rw-r--r--sources/shiboken2/ApiExtractor/tests/testtemplates.h2
-rw-r--r--sources/shiboken2/ApiExtractor/tests/testtyperevision.cpp49
-rw-r--r--sources/shiboken2/ApiExtractor/tests/testtyperevision.h2
-rw-r--r--sources/shiboken2/ApiExtractor/tests/testutil.h11
-rw-r--r--sources/shiboken2/ApiExtractor/typedatabase.cpp390
-rw-r--r--sources/shiboken2/ApiExtractor/typedatabase.h28
-rw-r--r--sources/shiboken2/ApiExtractor/typedatabase_typedefs.h25
-rw-r--r--sources/shiboken2/ApiExtractor/typeparser.cpp57
-rw-r--r--sources/shiboken2/ApiExtractor/typesystem.cpp3913
-rw-r--r--sources/shiboken2/ApiExtractor/typesystem.h381
-rw-r--r--sources/shiboken2/ApiExtractor/typesystem_enums.h21
-rw-r--r--sources/shiboken2/ApiExtractor/typesystem_p.h115
-rw-r--r--sources/shiboken2/CMakeLists.txt24
-rw-r--r--sources/shiboken2/data/generatorrunner.16
-rw-r--r--sources/shiboken2/doc/commandlineoptions.rst110
-rw-r--r--sources/shiboken2/doc/conf.py.in8
-rw-r--r--sources/shiboken2/doc/contents.rst4
-rw-r--r--sources/shiboken2/doc/images/icecream.pngbin0 -> 4272 bytes
-rw-r--r--sources/shiboken2/doc/images/qtforpython-underthehood.pngbin0 -> 19144 bytes
-rw-r--r--sources/shiboken2/doc/index.rst28
-rw-r--r--sources/shiboken2/doc/samplebinding.rst250
-rw-r--r--sources/shiboken2/generator/CMakeLists.txt30
-rw-r--r--sources/shiboken2/generator/__init__.py.in2
-rw-r--r--sources/shiboken2/generator/_config.py.in9
-rw-r--r--sources/shiboken2/generator/generator.cpp413
-rw-r--r--sources/shiboken2/generator/generator.h182
-rw-r--r--sources/shiboken2/generator/main.cpp329
-rw-r--r--sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp132
-rw-r--r--sources/shiboken2/generator/qtdoc/qtdocgenerator.h6
-rw-r--r--sources/shiboken2/generator/shiboken2/cppgenerator.cpp706
-rw-r--r--sources/shiboken2/generator/shiboken2/cppgenerator.h15
-rw-r--r--sources/shiboken2/generator/shiboken2/headergenerator.cpp145
-rw-r--r--sources/shiboken2/generator/shiboken2/headergenerator.h4
-rw-r--r--sources/shiboken2/generator/shiboken2/overloaddata.cpp18
-rw-r--r--sources/shiboken2/generator/shiboken2/overloaddata.h2
-rw-r--r--sources/shiboken2/generator/shiboken2/shibokengenerator.cpp451
-rw-r--r--sources/shiboken2/generator/shiboken2/shibokengenerator.h284
-rw-r--r--sources/shiboken2/libshiboken/autodecref.h29
-rw-r--r--sources/shiboken2/libshiboken/basewrapper.cpp360
-rw-r--r--sources/shiboken2/libshiboken/basewrapper.h8
-rw-r--r--sources/shiboken2/libshiboken/basewrapper_p.h106
-rw-r--r--sources/shiboken2/libshiboken/bindingmanager.cpp49
-rw-r--r--sources/shiboken2/libshiboken/bindingmanager.h13
-rw-r--r--sources/shiboken2/libshiboken/gilstate.h5
-rw-r--r--sources/shiboken2/libshiboken/helper.cpp26
-rw-r--r--sources/shiboken2/libshiboken/helper.h11
-rw-r--r--sources/shiboken2/libshiboken/pep384impl.cpp49
-rw-r--r--sources/shiboken2/libshiboken/pep384impl.h17
-rw-r--r--sources/shiboken2/libshiboken/pep384impl_doc.rst4
-rw-r--r--sources/shiboken2/libshiboken/qt_attribution.json2
-rw-r--r--sources/shiboken2/libshiboken/sbkconverter.cpp12
-rw-r--r--sources/shiboken2/libshiboken/sbkconverter.h3
-rw-r--r--sources/shiboken2/libshiboken/sbkconverter_p.h36
-rw-r--r--sources/shiboken2/libshiboken/sbkdbg.h5
-rw-r--r--sources/shiboken2/libshiboken/sbkenum.cpp193
-rw-r--r--sources/shiboken2/libshiboken/sbkpython.h58
-rw-r--r--sources/shiboken2/libshiboken/sbkstring.cpp5
-rw-r--r--sources/shiboken2/libshiboken/shibokenbuffer.cpp4
-rw-r--r--sources/shiboken2/libshiboken/signature.cpp820
-rw-r--r--sources/shiboken2/libshiboken/signature.h6
-rw-r--r--sources/shiboken2/libshiboken/threadstatesaver.h8
-rw-r--r--sources/shiboken2/libshiboken/typespec.cpp45
-rw-r--r--sources/shiboken2/libshiboken/typespec.h4
-rw-r--r--sources/shiboken2/libshiboken/voidptr.cpp8
-rwxr-xr-xsources/shiboken2/shiboken_tool.py53
-rw-r--r--sources/shiboken2/shiboken_version.py6
-rw-r--r--sources/shiboken2/shibokenmodule/CMakeLists.txt54
-rw-r--r--sources/shiboken2/shibokenmodule/__init__.py.in4
-rw-r--r--sources/shiboken2/shibokenmodule/_config.py.in11
-rw-r--r--sources/shiboken2/shibokenmodule/support/__init__.py40
-rw-r--r--sources/shiboken2/shibokenmodule/support/signature/PSF-3.7.0.txt (renamed from sources/pyside2/PySide2/support/signature/PSF-3.7.0.txt)0
-rw-r--r--sources/shiboken2/shibokenmodule/support/signature/__init__.py47
-rw-r--r--sources/shiboken2/shibokenmodule/support/signature/backport_inspect.py (renamed from sources/pyside2/PySide2/support/signature/backport_inspect.py)4
-rw-r--r--sources/shiboken2/shibokenmodule/support/signature/fix-complaints.py (renamed from sources/pyside2/PySide2/support/signature/fix-complaints.py)2
-rw-r--r--sources/shiboken2/shibokenmodule/support/signature/layout.py246
-rw-r--r--sources/shiboken2/shibokenmodule/support/signature/lib/__init__.py40
-rw-r--r--sources/shiboken2/shibokenmodule/support/signature/lib/enum_sig.py168
-rw-r--r--sources/shiboken2/shibokenmodule/support/signature/loader.py202
-rw-r--r--sources/shiboken2/shibokenmodule/support/signature/mapping.py210
-rw-r--r--sources/shiboken2/shibokenmodule/support/signature/parser.py (renamed from sources/pyside2/PySide2/support/signature/parser.py)51
-rw-r--r--sources/shiboken2/shibokenmodule/support/signature/qt_attribution.json (renamed from sources/pyside2/PySide2/support/signature/qt_attribution.json)0
-rw-r--r--sources/shiboken2/shibokenmodule/support/signature/typing27.py (renamed from sources/pyside2/PySide2/support/signature/typing27.py)117
-rw-r--r--sources/shiboken2/tests/libsample/CMakeLists.txt1
-rw-r--r--sources/shiboken2/tests/libsample/exceptiontest.cpp64
-rw-r--r--sources/shiboken2/tests/libsample/exceptiontest.h48
-rw-r--r--sources/shiboken2/tests/libsample/mapuser.cpp5
-rw-r--r--sources/shiboken2/tests/libsample/mapuser.h2
-rw-r--r--sources/shiboken2/tests/libsample/nontypetemplate.h51
-rw-r--r--sources/shiboken2/tests/libsample/objecttype.cpp1
-rw-r--r--sources/shiboken2/tests/libsample/objecttype.h2
-rw-r--r--sources/shiboken2/tests/libsample/samplenamespace.cpp7
-rw-r--r--sources/shiboken2/tests/libsample/samplenamespace.h6
-rw-r--r--sources/shiboken2/tests/minimalbinding/CMakeLists.txt5
-rw-r--r--sources/shiboken2/tests/otherbinding/CMakeLists.txt5
-rwxr-xr-xsources/shiboken2/tests/otherbinding/extended_multiply_operator_test.py2
-rw-r--r--sources/shiboken2/tests/samplebinding/CMakeLists.txt8
-rw-r--r--sources/shiboken2/tests/samplebinding/exception_test.py78
-rw-r--r--sources/shiboken2/tests/samplebinding/global.h2
-rw-r--r--sources/shiboken2/tests/samplebinding/nontypetemplate_test.py44
-rw-r--r--sources/shiboken2/tests/samplebinding/typesystem_sample.xml9
-rw-r--r--sources/shiboken2/tests/smartbinding/CMakeLists.txt5
-rw-r--r--testing/runner.py34
-rw-r--r--testing/testing.pyqtc9
-rw-r--r--testing/wheel_tester.py295
385 files changed, 21281 insertions, 14223 deletions
diff --git a/.gitignore b/.gitignore
index 6a8b6928..903fc81f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,6 @@
/build
/dist
/pyside*_build
-/pyside*_package
/pyside*_install
/PySide
/PySide-*.*.*
@@ -13,3 +12,5 @@ distribute-*.egg
distribute-*.tar.gz
explore2
build_history/2*
+*.qdocconf
+*.qdocconf.in
diff --git a/MANIFEST.in b/MANIFEST.in
deleted file mode 100644
index dd79b238..00000000
--- a/MANIFEST.in
+++ /dev/null
@@ -1,40 +0,0 @@
-#
-# MANIFEST.in
-#
-# Manifest template for creating the PySide source distribution.
-
-include MANIFEST.in
-include CHANGES.rst
-include README.rst
-include ez_setup.py
-include setup.py
-include popenasync.py
-include qtinfo.py
-include utils.py
-
-# sources
-recursive-include sources/patchelf **
-recursive-include sources/shiboken2 **
-recursive-include sources/pyside2 **
-recursive-include sources/pyside2-tools **
-# ignore .git
-recursive-exclude sources/shiboken2/.git **
-recursive-exclude sources/pyside2/.git **
-recursive-exclude sources/pyside2-tools/.git **
-
-# PySide package
-recursive-include pyside_package/PySide2 **
-recursive-include pyside_package/PySide2/docs **
-recursive-include pyside_package/PySide2/plugins **
-recursive-include pyside_package/PySide2s **
-recursive-include pyside_package/PySide2/translations **
-recursive-include pyside_package/PySide2include **
-recursive-include pyside_package/PySide2/typesystems **
-recursive-include pyside_package/PySide2/examples **
-
-# pysideuic package
-recursive-include pyside_package/pysideuic **
-recursive-include pyside_package/pysideuic/Compiler **
-recursive-include pyside_package/pysideuic/port_v2 **
-recursive-include pyside_package/pysideuic/port_v3 **
-recursive-include pyside_package/pysideuic/widget-plugins **
diff --git a/README.md b/README.md
index cde05940..fe61136b 100644
--- a/README.md
+++ b/README.md
@@ -1,53 +1,9 @@
-# PySide2
+# Qt For Python
-### Introduction
-
-PySide is the [Python Qt bindings project](http://wiki.qt.io/PySide2), providing
+Qt For Python is the [Python Qt bindings project](http://wiki.qt.io/PySide2), providing
access to the complete Qt 5.x framework as well as to generator tools for rapidly
generating bindings for any C++ libraries.
-The PySide project is developed in the open, with all facilities you'd expect
-from any modern OSS project such as all code in a git repository and an open
-design process. We welcome any contribution conforming to the
-[Qt Contribution Agreement](https://www.qt.io/contributionagreement/).
-
-
-PySide 2 supports Qt5. For building, please read about
-[getting started](https://wiki.qt.io/PySide2_GettingStarted).
-Then download the sources by running
-
- git clone https://code.qt.io/pyside/pyside-setup
-
-### Building
-
-#### Dependencies
-
-PySide versions following 5.6 use a C++ parser based on
-[Clang](http://clang.org/). The Clang library (C-bindings), version 3.9 or
-higher is required for building. Prebuilt versions of it can be downloaded from
-[download.qt.io](http://download.qt.io/development_releases/prebuilt/libclang/).
-
-After unpacking the archive, set the environment variable *LLVM_INSTALL_DIR* to
-point to the folder containing the *include* and *lib* directories of Clang:
-
- 7z x .../libclang-release_39-linux-Rhel7.2-gcc5.3-x86_64.7z
- export LLVM_INSTALL_DIR=$PWD/libclang
-
-On Windows:
-
- 7z x .../libclang-release_39-windows-vs2015_64.7z
- SET LLVM_INSTALL_DIR=%CD%\libclang
-
-#### Build Instructions
-
-You might consider using a virtual environment as described at
-[getting started](https://wiki.qt.io/PySide2_GettingStarted).
-You should be able to build:
-
- cd pyside-setup
- python setup.py install
+shiboken2 is the generator used to build the bindings.
-The setup script will try to find the location of the qmake tool of the Qt
-version to be used and the cmake build tool in the path. Non-standard
-locations can be specified by the *--qmake=path_to_qmake* or
-*--cmake=path_to_cmake* command line options.
+See README.pyside2.md and README.shiboken2.md for details.
diff --git a/README.pyside2.md b/README.pyside2.md
new file mode 100644
index 00000000..53f7bc9d
--- /dev/null
+++ b/README.pyside2.md
@@ -0,0 +1,71 @@
+# PySide2
+
+### Introduction
+
+PySide is the [Python Qt bindings project](http://wiki.qt.io/Qt_for_Python),
+providing access to the complete Qt 5.12+ framework as well as to generator
+tools for rapidly generating Python bindings for any C++ libraries.
+
+The PySide project is developed in the open, with all facilities you'd expect
+from any modern OSS project such as all code in a git repository and an open
+design process. We welcome any contribution conforming to the
+[Qt Contribution Agreement](https://www.qt.io/contributionagreement/).
+
+### Installation
+
+Since the release of the [Technical Preview](https://blog.qt.io/blog/2018/06/13/qt-python-5-11-released/)
+it is possible to install via `pip`, both from Qt's servers
+and [PyPi](https://pypi.org/project/PySide2/):
+
+ pip install PySide2
+
+#### Dependencies
+
+PySide versions following 5.12 use a C++ parser based on
+[Clang](http://clang.org/). The Clang library (C-bindings), version 6.0 or
+higher is required for building. Prebuilt versions of it can be downloaded from
+[download.qt.io](http://download.qt.io/development_releases/prebuilt/libclang/).
+
+After unpacking the archive, set the environment variable *LLVM_INSTALL_DIR* to
+point to the folder containing the *include* and *lib* directories of Clang:
+
+ 7z x .../libclang-release_60-linux-Rhel7.2-gcc5.3-x86_64-clazy.7z
+ export LLVM_INSTALL_DIR=$PWD/libclang
+
+On Windows:
+
+ 7z x .../libclang-release_60-windows-vs2015_64-clazy.7z
+ SET LLVM_INSTALL_DIR=%CD%\libclang
+
+### Building from source
+
+For building PySide2 from scratch, please read about
+[getting started](https://wiki.qt.io/Qt_for_Python/GettingStarted).
+This process will include getting the code:
+
+ git clone https://code.qt.io/pyside/pyside-setup
+ cd pyside-setup
+ git branch --track 5.12 origin/5.12
+ git checkout 5.12
+
+then install the dependencies, and following the instructions per platform.
+A common build command will look like:
+
+ python setup.py install --qmake=<path/to/qmake/> --jobs=8 --build-tests
+
+You can obtain more information about the options to build PySide
+and Shiboken in [our wiki](https://wiki.qt.io/Qt_for_Python/).
+
+### Documentation and Bugs
+
+You can find more information about the PySide2 module API in the
+[official Qt for Python documentation](https://doc.qt.io/qtforpython/).
+
+If you come across any issue, please file a bug report at our
+[JIRA tracker](https://bugreports.qt.io/projects/PYSIDE) following
+our [guidelines](https://wiki.qt.io/Qt_for_Python/Reporting_Bugs).
+
+### Community
+
+Check *#qt-pyside*, our official IRC channel on FreeNode,
+or contact us via our [mailing list](http://lists.qt-project.org/mailman/listinfo/pyside).
diff --git a/README.shiboken2-generator.md b/README.shiboken2-generator.md
new file mode 100644
index 00000000..f29f4063
--- /dev/null
+++ b/README.shiboken2-generator.md
@@ -0,0 +1,37 @@
+# shiboken2-generator
+
+Shiboken is the generator used by the Qt for Python project.
+It outputs C++ code for CPython extensions, which can be compiled
+and transformed into a Python module.
+
+C++ projects based on Qt can be wrapped, but also projects
+which are not related to Qt.
+
+## How does it work?
+
+Shiboken uses an API Extractor that does most of the job,
+but it requires a typesystem (XML file) to customize how the
+C++ classes/methods will be exposed to Python.
+
+The typesystem allows you to remove arguments from signatures,
+modify return types, inject code and add conversion rules
+from the C++ data types to Python data types, manipulate
+the ownership of the objects, etc.
+
+# Examples
+
+An example related to wrap a C++ library not depending on Qt
+can be found in our [repository](https://code.qt.io/cgit/pyside/pyside-setup.git/tree/examples/samplebinding).
+
+Additionally, you can find a couple of tests inside the
+[git repository](https://code.qt.io/cgit/pyside/pyside-setup.git/tree/sources/shiboken2/tests).
+
+For a more advanced case regarding extending a Qt/C++ application
+with Python bindings based on the idea of the PySide module,
+you can check the [scriptableapplication](https://code.qt.io/cgit/pyside/pyside-setup.git/tree/examples/scriptableapplication)
+example in our repository.
+
+# Documentation
+
+You can find more information about Shiboken in our
+[official documentation page](https://doc.qt.io/qtforpython/shiboken2/).
diff --git a/README.shiboken2.md b/README.shiboken2.md
new file mode 100644
index 00000000..d9cd32a4
--- /dev/null
+++ b/README.shiboken2.md
@@ -0,0 +1,13 @@
+# shiboken2 module
+
+The purpose of the shiboken2 Python module is to access information
+related to the binding generation that could be used to integrate
+C++ programs to Python, or even to get useful information to debug
+an application.
+
+Mostly the idea is to interact with Shiboken objects,
+where one can check if it is valid, or if the generated Python wrapper
+is invalid after the underlying C++ object has been destroyed.
+
+More information on the available functions can be found
+in our [official documentation](https://doc.qt.io/qtforpython/shiboken2/shibokenmodule.html)
diff --git a/build_history/blacklist.txt b/build_history/blacklist.txt
index a228f9e2..c20760c7 100644
--- a/build_history/blacklist.txt
+++ b/build_history/blacklist.txt
@@ -88,3 +88,6 @@
win32
linux
darwin
+
+[QtPositioning::positioning]
+ win32
diff --git a/build_scripts/build_scripts.pyqtc b/build_scripts/build_scripts.pyqtc
new file mode 100644
index 00000000..1fc1c966
--- /dev/null
+++ b/build_scripts/build_scripts.pyqtc
@@ -0,0 +1,18 @@
+__init__.py
+config.py
+main.py
+options.py
+platforms
+qtinfo.py
+setup_runner.py
+utils.py
+wheel_override.py
+platforms/__init__.py
+platforms/linux.py
+platforms/macos.py
+platforms/unix.py
+platforms/windows_desktop.py
+../setup.py
+../coin_build_instructions.py
+../coin_test_instructions.py
+
diff --git a/build_scripts/config.py b/build_scripts/config.py
new file mode 100644
index 00000000..f47230a6
--- /dev/null
+++ b/build_scripts/config.py
@@ -0,0 +1,399 @@
+#############################################################################
+##
+## Copyright (C) 2018 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of Qt for Python.
+##
+## $QT_BEGIN_LICENSE:LGPL$
+## Commercial License Usage
+## Licensees holding valid commercial Qt licenses may use this file in
+## accordance with the commercial license agreement provided with the
+## Software or, alternatively, in accordance with the terms contained in
+## a written agreement between you and The Qt Company. For licensing terms
+## and conditions see https://www.qt.io/terms-conditions. For further
+## information use the contact form at https://www.qt.io/contact-us.
+##
+## GNU Lesser General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU Lesser
+## General Public License version 3 as published by the Free Software
+## Foundation and appearing in the file LICENSE.LGPL3 included in the
+## packaging of this file. Please review the following information to
+## ensure the GNU Lesser General Public License version 3 requirements
+## will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+##
+## GNU General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU
+## General Public License version 2.0 or (at your option) the GNU General
+## Public license version 3 or any later version approved by the KDE Free
+## Qt Foundation. The licenses are as published by the Free Software
+## Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+## included in the packaging of this file. Please review the following
+## information to ensure the GNU General Public License requirements will
+## be met: https://www.gnu.org/licenses/gpl-2.0.html and
+## https://www.gnu.org/licenses/gpl-3.0.html.
+##
+## $QT_END_LICENSE$
+##
+#############################################################################
+
+import sys, os
+import distutils.log as log
+
+
+class Config(object):
+ def __init__(self):
+ # Constants
+ self._build_type_all = "all"
+ self._invocation_type_top_level = "top-level"
+ self._invocation_type_internal = "internal"
+
+ # The keyword arguments which will be given to setuptools.setup
+ self.setup_kwargs = {}
+
+ # The setup.py invocation type.
+ # top-level
+ # internal
+ self.invocation_type = None
+
+ # The type of the top-level build.
+ # all - build shiboken2 module, shiboken2-generator and PySide2
+ # modules
+ # shiboken2 - build only shiboken2 module
+ # shiboken2-generator - build only the shiboken2-generator
+ # pyside2 - build only PySide2 modules
+ self.build_type = None
+
+ # The internal build type, used for internal invocations of
+ # setup.py to build a specific module only.
+ self.internal_build_type = None
+
+ # Options that can be given to --build-type and
+ # --internal-build-type
+ self.shiboken_module_option_name = "shiboken2"
+ self.shiboken_generator_option_name = "shiboken2-generator"
+ self.pyside_option_name = "pyside2"
+
+ # Names to be passed to setuptools.setup() name key,
+ # so not package name, but rather project name as it appears
+ # in the wheel name and on PyPi.
+ self.shiboken_module_st_name = "shiboken2"
+ self.shiboken_generator_st_name = "shiboken2-generator"
+ self.pyside_st_name = "PySide2"
+
+ # Used by check_allowed_python_version to validate the
+ # interpreter version.
+ self.python_version_classifiers = [
+ 'Programming Language :: Python',
+ 'Programming Language :: Python :: 2',
+ 'Programming Language :: Python :: 2.7',
+ 'Programming Language :: Python :: 3',
+ 'Programming Language :: Python :: 3.3',
+ 'Programming Language :: Python :: 3.4',
+ 'Programming Language :: Python :: 3.5',
+ 'Programming Language :: Python :: 3.6',
+ 'Programming Language :: Python :: 3.7',
+ ]
+
+ self.setup_script_dir = None
+
+ def init_config(self, build_type=None, internal_build_type=None,
+ cmd_class_dict=None, package_version=None,
+ ext_modules=None, setup_script_dir=None,
+ quiet=False):
+ """
+ Sets up the global singleton config which is used in many parts
+ of the setup process.
+ """
+
+ # if --internal-build-type was passed, it means that this is a
+ # sub-invocation to build a specific package.
+ if internal_build_type:
+ self.set_is_internal_invocation()
+ self.set_internal_build_type(internal_build_type)
+ else:
+ self.set_is_top_level_invocation()
+
+ # --build-type was specified explicitly, so set it. Otherwise
+ # default to all.
+ if build_type:
+ self.build_type = build_type
+ else:
+ self.build_type = self._build_type_all
+
+ self.setup_script_dir = setup_script_dir
+
+ setup_kwargs = {}
+ setup_kwargs['long_description'] = self.get_long_description()
+ setup_kwargs['long_description_content_type'] = 'text/markdown',
+ setup_kwargs['keywords'] = 'Qt'
+ setup_kwargs['author'] = 'Qt for Python Team'
+ setup_kwargs['author_email'] = 'pyside@qt-project.org'
+ setup_kwargs['url'] = 'https://www.pyside.org'
+ setup_kwargs['download_url'] = 'https://download.qt.io/official_releases/QtForPython'
+ setup_kwargs['license'] = 'LGPL'
+ setup_kwargs['zip_safe'] = False
+ setup_kwargs['cmdclass'] = cmd_class_dict
+ setup_kwargs['version'] = package_version
+
+ if quiet:
+ # Tells distutils / setuptools to be quiet, and only print warnings or errors.
+ # Makes way less noise in the terminal when building.
+ setup_kwargs['verbose'] = 0
+
+ # Setting these two keys is still a bit of a discussion point.
+ # In general not setting them will allow using "build" and
+ # "bdist_wheel" just fine. What they do, is they specify to the
+ # setuptools.command.build_py command that certain pure python
+ # modules (.py files) exist in the specified package location,
+ # and that they should be copied over to the setuptools build
+ # dir.
+ # But it doesn't really make sense for us, because we copy all
+ # the necessary files to the build dir via prepare_packages()
+ # function anyway.
+ # If we don't set them, the build_py sub-command will be
+ # skipped, but the build command will still be executed, which
+ # is where we run cmake / make.
+ # The only plausible usage of it, is if we will implement a
+ # correctly functioning setup.py develop command (or bdist_egg).
+ # But currently that doesn't seem to work.
+ setup_kwargs['packages'] = self.get_setup_tools_packages_for_current_build()
+ setup_kwargs['package_dir'] = self.get_package_name_to_dir_path_mapping()
+
+ # Add a bogus extension module (will never be built here since
+ # we are overriding the build command to do it using cmake) so
+ # things like bdist_egg will know that there are extension
+ # modules and will name the dist with the full platform info.
+ setup_kwargs['ext_modules'] = ext_modules
+
+ common_classifiers = [
+ 'Development Status :: 5 - Production/Stable',
+ 'Environment :: Console',
+ 'Environment :: MacOS X',
+ 'Environment :: X11 Applications :: Qt',
+ 'Environment :: Win32 (MS Windows)',
+ 'Intended Audience :: Developers',
+ 'License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)',
+ 'Operating System :: MacOS :: MacOS X',
+ 'Operating System :: POSIX',
+ 'Operating System :: POSIX :: Linux',
+ 'Operating System :: Microsoft',
+ 'Operating System :: Microsoft :: Windows',
+ 'Programming Language :: C++']
+ common_classifiers.extend(self.python_version_classifiers)
+ common_classifiers.extend([
+ 'Topic :: Database',
+ 'Topic :: Software Development',
+ 'Topic :: Software Development :: Code Generators',
+ 'Topic :: Software Development :: Libraries :: Application Frameworks',
+ 'Topic :: Software Development :: User Interfaces',
+ 'Topic :: Software Development :: Widget Sets'])
+ setup_kwargs['classifiers'] = common_classifiers
+
+ if self.internal_build_type == self.shiboken_module_option_name:
+ setup_kwargs['name'] = self.shiboken_module_st_name
+ setup_kwargs['description'] = "Python / C++ bindings helper module",
+ setup_kwargs['entry_points'] = {}
+
+ elif self.internal_build_type == self.shiboken_generator_option_name:
+ setup_kwargs['name'] = self.shiboken_generator_st_name
+ setup_kwargs['description'] = "Python / C++ bindings generator",
+ setup_kwargs['install_requires'] = [self.shiboken_module_st_name]
+ setup_kwargs['entry_points'] = {
+ 'console_scripts': [
+ 'shiboken2 = {}.scripts.shiboken_tool:main'.format(self.package_name()),
+ ]
+ }
+
+ elif self.internal_build_type == self.pyside_option_name:
+ setup_kwargs['name'] = self.pyside_st_name
+ setup_kwargs['description'] = ("Python bindings for the Qt cross-platform application"
+ " and UI framework"),
+ setup_kwargs['install_requires'] = [self.shiboken_module_st_name]
+ setup_kwargs['entry_points'] = {
+ 'console_scripts': [
+ 'pyside2-uic = {}.scripts.uic:main'.format(self.package_name()),
+ 'pyside2-rcc = {}.scripts.pyside_tool:main'.format(self.package_name()),
+ 'pyside2-lupdate = {}.scripts.pyside_tool:main'.format(self.package_name()),
+ ]
+ }
+ self.setup_kwargs = setup_kwargs
+
+ def get_long_description(self):
+ readme_filename = 'README.md'
+ changes_filename = 'CHANGES.rst'
+
+ if self.is_internal_shiboken_module_build():
+ readme_filename = 'README.shiboken2.md'
+ elif self.is_internal_shiboken_generator_build():
+ readme_filename = 'README.shiboken2-generator.md'
+ elif self.is_internal_pyside_build():
+ readme_filename = 'README.pyside2.md'
+
+ content = ''
+ changes = ''
+ try:
+ with open(os.path.join(self.setup_script_dir, readme_filename)) as f:
+ readme = f.read()
+ except Exception as e:
+ log.error("Couldn't read contents of {}.".format(readme_filename))
+ raise
+
+ # Don't include CHANGES.rst for now, because we have not decided
+ # how to handle change files yet.
+ include_changes = False
+ if include_changes:
+ try:
+ with open(os.path.join(self.setup_script_dir, changes_filename)) as f:
+ changes = f.read()
+ except Exception as e:
+ log.error("Couldn't read contents of {}".format(changes_filename))
+ raise
+ content += readme
+
+ if changes:
+ content += "\n\n" + changes
+
+ return content
+
+ def package_name(self):
+ """
+ Returns package name as it appears in Python's site-packages
+ directory.
+
+ Package names can only be delimited by underscores, and not by
+ dashes.
+ """
+ if self.is_internal_shiboken_module_build():
+ return "shiboken2"
+ elif self.is_internal_shiboken_generator_build():
+ return "shiboken2_generator"
+ elif self.is_internal_pyside_build():
+ return "PySide2"
+ else:
+ return None
+
+ def get_setup_tools_packages_for_current_build(self):
+ """
+ Returns a list of packages for setup tools to consider in the
+ build_py command, so that it can copy the pure python files.
+ Not really necessary because it's done in prepare_packages()
+ anyway.
+
+ This is really just to satisfy some checks in setuptools
+ build_py command, and if we ever properly implement the develop
+ command.
+ """
+ if self.internal_build_type == self.pyside_option_name:
+ return [
+ config.package_name(),
+ 'pyside2uic',
+ 'pyside2uic.Compiler',
+ 'pyside2uic.port_v{}'.format(sys.version_info[0])
+ ]
+ elif self.internal_build_type == self.shiboken_module_option_name:
+ return [self.package_name()]
+ else:
+ return []
+
+ def get_package_name_to_dir_path_mapping(self):
+ """
+ Used in setuptools.setup 'package_dir' argument to specify where
+ the actual module packages are located.
+
+ For example when building the shiboken module, setuptools will
+ expect to find the "shiboken2" module sources under
+ "sources/shiboken2/shibokenmodule".
+
+ This is really just to satisfy some checks in setuptools
+ build_py command, and if we ever properly implement the develop
+ command.
+ """
+ if self.is_internal_shiboken_module_build():
+ return {
+ self.package_name(): "sources/shiboken2/shibokenmodule"
+ }
+ elif self.is_internal_shiboken_generator_build():
+ # This is left empty on purpose, because the shiboken
+ # generator doesn't have a python module for now.
+ return {}
+ elif self.is_internal_pyside_build():
+ return {
+ self.package_name(): "sources/pyside2/PySide2",
+ "pyside2uic": "sources/pyside2-tools/pyside2uic"
+ }
+ else:
+ return {}
+
+ def get_buildable_extensions(self):
+ """
+ Used by PysideBuild.run to build the CMake projects.
+ :return: A list of directory names under the sources directory.
+ """
+ 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 None
+
+ def set_is_top_level_invocation(self):
+ self.invocation_type = self._invocation_type_top_level
+
+ def set_is_internal_invocation(self):
+ self.invocation_type = self._invocation_type_internal
+
+ def is_top_level_invocation(self):
+ return self.invocation_type == self._invocation_type_top_level
+
+ def is_internal_invocation(self):
+ return self.invocation_type == self._invocation_type_internal
+
+ def is_top_level_build_all(self):
+ return self.build_type == self._build_type_all
+
+ def is_top_level_build_shiboken_module(self):
+ return self.build_type == self.shiboken_module_option_name
+
+ def is_top_level_build_shiboken_generator(self):
+ return self.build_type == self.shiboken_generator_option_name
+
+ def is_top_level_build_pyside(self):
+ return self.build_type == self.pyside_option_name
+
+ def set_internal_build_type(self, internal_build_type):
+ self.internal_build_type = internal_build_type
+
+ def is_internal_shiboken_module_build(self):
+ return self.internal_build_type == self.shiboken_module_option_name
+
+ def is_internal_shiboken_generator_build(self):
+ return self.internal_build_type == self.shiboken_generator_option_name
+
+ def is_internal_pyside_build(self):
+ return self.internal_build_type == self.pyside_option_name
+
+ def is_internal_shiboken_generator_build_and_part_of_top_level_all(self):
+ """
+ Used to skip certain build rules and output, when we know that
+ the CMake build of shiboken was already done as part of the
+ top-level "all" build when shiboken2-module was built.
+ """
+ return self.is_internal_shiboken_generator_build() and self.is_top_level_build_all()
+
+ def get_allowed_top_level_build_values(self):
+ return [
+ self._build_type_all,
+ self.shiboken_module_option_name,
+ self.shiboken_generator_option_name,
+ self.pyside_option_name
+ ]
+
+ def get_allowed_internal_build_values(self):
+ return [
+ self.shiboken_module_option_name,
+ self.shiboken_generator_option_name,
+ self.pyside_option_name
+ ]
+
+
+config = Config()
diff --git a/build_scripts/main.py b/build_scripts/main.py
index b64d6f1a..cdc6dce7 100644
--- a/build_scripts/main.py
+++ b/build_scripts/main.py
@@ -42,6 +42,7 @@ from distutils.version import LooseVersion
import os
import time
+from .config import config
from .utils import memoize, get_python_dict
from .options import *
@@ -49,14 +50,17 @@ setup_script_dir = os.getcwd()
build_scripts_dir = os.path.join(setup_script_dir, 'build_scripts')
setup_py_path = os.path.join(setup_script_dir, "setup.py")
+start_time = int(time.time())
+
+def elapsed():
+ return int(time.time()) - start_time
+
@memoize
def get_package_timestamp():
""" In a Coin CI build the returned timestamp will be the
Coin integration id timestamp. For regular builds it's
just the current timestamp or a user provided one."""
- if OPTION_PACKAGE_TIMESTAMP:
- return OPTION_PACKAGE_TIMESTAMP
- return int(time.time())
+ return OPTION_PACKAGE_TIMESTAMP if OPTION_PACKAGE_TIMESTAMP else start_time
@memoize
def get_package_version():
@@ -90,15 +94,11 @@ def get_setuptools_extension_modules():
extension_modules = [Extension(*extension_args, **extension_kwargs)]
return extension_modules
-# Buildable extensions.
-contained_modules = ['shiboken2', 'pyside2', 'pyside2-tools']
# Git submodules: ["submodule_name",
# "location_relative_to_sources_folder"]
submodules = [["pyside2-tools"]]
-pyside_package_dir_name = "pyside_package"
-
try:
import setuptools
except ImportError:
@@ -108,13 +108,8 @@ except ImportError:
import sys
import platform
import re
-import fnmatch
-import difflib # for a close match of dirname and module
-import functools
-
-from distutils import log
-from distutils.errors import DistutilsOptionError
+import distutils.log as log
from distutils.errors import DistutilsSetupError
from distutils.sysconfig import get_config_var
from distutils.sysconfig import get_python_lib
@@ -123,7 +118,7 @@ from distutils.command.build import build as _build
from distutils.command.build_ext import build_ext as _build_ext
from distutils.util import get_platform
-from setuptools import setup, Extension
+from setuptools import Extension
from setuptools.command.install import install as _install
from setuptools.command.install_lib import install_lib as _install_lib
from setuptools.command.bdist_egg import bdist_egg as _bdist_egg
@@ -132,39 +127,40 @@ from setuptools.command.build_py import build_py as _build_py
from .qtinfo import QtInfo
from .utils import rmtree, detect_clang, copyfile, copydir, run_process_output, run_process
-from .utils import update_env_path, init_msvc_env, filter_match, macos_fix_rpaths_for_library
+from .utils import update_env_path, init_msvc_env, filter_match
+from .utils import macos_fix_rpaths_for_library
+from .utils import linux_fix_rpaths_for_library
from .platforms.unix import prepare_packages_posix
from .platforms.windows_desktop import prepare_packages_win32
from .wheel_override import wheel_module_exists, get_bdist_wheel_override
from textwrap import dedent
-# make sure that setup.py is run with an allowed python version
+
def check_allowed_python_version():
+ """
+ Make sure that setup.py is run with an allowed python version.
+ """
+
import re
- pattern = "'Programming Language :: Python :: (\d+)\.(\d+)'"
+ pattern = r'Programming Language :: Python :: (\d+)\.(\d+)'
supported = []
- with open(setup_py_path) as setup:
- for line in setup.readlines():
- found = re.search(pattern, line)
- if found:
- major = int(found.group(1))
- minor = int(found.group(2))
- supported.append( (major, minor) )
+
+ for line in config.python_version_classifiers:
+ found = re.search(pattern, line)
+ if found:
+ major = int(found.group(1))
+ minor = int(found.group(2))
+ supported.append( (major, minor) )
this_py = sys.version_info[:2]
if this_py not in supported:
- print("only these python versions are supported:", supported)
+ print("Unsupported python version detected. Only these python versions are supported: {}"
+ .format(supported))
sys.exit(1)
-check_allowed_python_version()
qt_src_dir = ''
-# This is used automatically by distutils.command.install object, to
-# specify final installation location.
-OPTION_FINAL_INSTALL_PREFIX = option_value("prefix")
-
-
if OPTION_QT_VERSION is None:
OPTION_QT_VERSION = "5"
if OPTION_QMAKE is None:
@@ -205,20 +201,16 @@ if not os.path.exists(OPTION_CMAKE):
print("'{}' does not exist.".format(OPTION_CMAKE))
sys.exit(1)
-if sys.platform == "win32":
- if OPTION_MAKESPEC is None:
- OPTION_MAKESPEC = "msvc"
- if not OPTION_MAKESPEC in ["msvc", "mingw"]:
- print("Invalid option --make-spec. Available values are {}".format(
- ["msvc", "mingw"]))
- sys.exit(1)
-else:
- if OPTION_MAKESPEC is None:
- OPTION_MAKESPEC = "make"
- if not OPTION_MAKESPEC in ["make"]:
- print("Invalid option --make-spec. Available values are {}".format(
- ["make"]))
- sys.exit(1)
+# First element is default
+available_mkspecs = ["msvc", "mingw", "ninja"] if sys.platform == "win32" else ["make", "ninja"]
+
+if OPTION_MAKESPEC is None:
+ OPTION_MAKESPEC = available_mkspecs[0]
+
+if not OPTION_MAKESPEC in available_mkspecs:
+ print('Invalid option --make-spec "{}". Available values are {}'.format(
+ OPTION_MAKESPEC, available_mkspecs))
+ sys.exit(1)
if OPTION_JOBS:
if sys.platform == 'win32' and OPTION_NO_JOM:
@@ -293,8 +285,7 @@ def get_qt_version():
qt_version = qtinfo.version
if not qt_version:
- log.error("Failed to query the Qt version with qmake {0}".format(
- self.qtinfo.qmake_command))
+ log.error("Failed to query the Qt version with qmake {0}".format(qtinfo.qmake_command))
sys.exit(1)
if LooseVersion(qtinfo.version) < LooseVersion("5.7"):
@@ -304,27 +295,22 @@ def get_qt_version():
return qt_version
+
def prepare_build():
if (os.path.isdir(".git") and not OPTION_IGNOREGIT and
not OPTION_ONLYPACKAGE and not OPTION_REUSE_BUILD):
prepare_sub_modules()
- # Clean up temp and package folders
- for n in [pyside_package_dir_name, "build"]:
+ # Clean up temp build folder.
+ for n in ["build"]:
d = os.path.join(setup_script_dir, n)
if os.path.isdir(d):
- print("Removing {}".format(d))
+ log.info("Removing {}".format(d))
try:
rmtree(d)
except Exception as e:
print('***** problem removing "{}"'.format(d))
print('ignored error: {}'.format(e))
- # Prepare package folders
- ppdn = pyside_package_dir_name
- absolute_paths = [os.path.join(ppdn, "PySide2"),
- os.path.join(ppdn, "pyside2uic")]
- for pkg in absolute_paths:
- pkg_dir = os.path.join(setup_script_dir, pkg)
- os.makedirs(pkg_dir)
+
# locate Qt sources for the documentation
if OPTION_QT_SRC is None:
install_prefix = qtinfo.prefix_dir
@@ -360,7 +346,7 @@ class PysideInstall(_install):
def run(self):
_install.run(self)
- log.info('*** Install completed')
+ print('*** Install completed ({}s)'.format(elapsed()))
class PysideDevelop(_develop):
@@ -389,26 +375,15 @@ class PysideBuildExt(_build_ext):
pass
-
-# pyside_build_py and pyside_install_lib are reimplemented to preserve
-# symlinks when distutils / setuptools copy files to various
-# directories through the different build stages.
class PysideBuildPy(_build_py):
def __init__(self, *args, **kwargs):
_build_py.__init__(self, *args, **kwargs)
- def build_package_data(self):
- """Copies files from pyside_package into build/xxx directory"""
-
- for package, src_dir, build_dir, filenames in self.data_files:
- for filename in filenames:
- target = os.path.join(build_dir, filename)
- self.mkpath(os.path.dirname(target))
- srcfile = os.path.abspath(os.path.join(src_dir, filename))
- # Using our own copyfile makes sure to preserve symlinks.
- copyfile(srcfile, target)
+# _install_lib is reimplemented to preserve
+# symlinks when distutils / setuptools copy files to various
+# directories from the setup tools build dir to the install dir.
class PysideInstallLib(_install_lib):
def __init__(self, *args, **kwargs):
@@ -512,6 +487,9 @@ class PysideBuild(_build):
elif OPTION_MAKESPEC == "mingw":
make_name = "mingw32-make"
make_generator = "MinGW Makefiles"
+ elif OPTION_MAKESPEC == "ninja":
+ make_name = "ninja"
+ make_generator = "Ninja"
else:
raise DistutilsSetupError(
"Invalid option --make-spec.")
@@ -539,10 +517,12 @@ class PysideBuild(_build):
py_prefix = get_config_var("prefix")
if not py_prefix or not os.path.exists(py_prefix):
py_prefix = sys.prefix
+ self.py_prefix = py_prefix
if sys.platform == "win32":
py_scripts_dir = os.path.join(py_prefix, "Scripts")
else:
py_scripts_dir = os.path.join(py_prefix, "bin")
+ self.py_scripts_dir = py_scripts_dir
if py_libdir is None or not os.path.exists(py_libdir):
if sys.platform == "win32":
py_libdir = os.path.join(py_prefix, "libs")
@@ -656,7 +636,7 @@ class PysideBuild(_build):
qt_version = get_qt_version()
# Update the PATH environment variable
- additional_paths = [py_scripts_dir, qt_dir]
+ additional_paths = [self.py_scripts_dir, qt_dir]
# Add Clang to path for Windows.
# Revisit once Clang is bundled with Qt.
@@ -685,19 +665,11 @@ class PysideBuild(_build):
install_dir = os.path.join(script_dir, prefix() + "_install",
"{}".format(build_name))
- # Try to ensure that tools built by this script (such as shiboken2)
- # are found before any that may already be installed on the system.
- update_env_path([os.path.join(install_dir, 'bin')])
-
- # Tell cmake to look here for *.cmake files
- os.environ['CMAKE_PREFIX_PATH'] = install_dir
-
self.make_path = make_path
self.make_generator = make_generator
self.debug = OPTION_DEBUG
self.script_dir = script_dir
- self.pyside_package_dir = os.path.join(self.script_dir,
- pyside_package_dir_name)
+ self.st_build_dir = os.path.join(self.script_dir, self.build_lib)
self.sources_dir = sources_dir
self.build_dir = build_dir
self.install_dir = install_dir
@@ -709,14 +681,61 @@ class PysideBuild(_build):
self.site_packages_dir = get_python_lib(1, 0, prefix=install_dir)
self.build_tests = OPTION_BUILDTESTS
- setuptools_install_prefix = get_python_lib(1)
- if OPTION_FINAL_INSTALL_PREFIX:
- setuptools_install_prefix = OPTION_FINAL_INSTALL_PREFIX
-
# Save the shiboken build dir path for clang deployment
# purposes.
self.shiboken_build_dir = os.path.join(self.build_dir, "shiboken2")
+ self.log_pre_build_info()
+
+ # Prepare folders
+ if not os.path.exists(self.sources_dir):
+ log.info("Creating sources folder {}...".format(self.sources_dir))
+ os.makedirs(self.sources_dir)
+ if not os.path.exists(self.build_dir):
+ log.info("Creating build folder {}...".format(self.build_dir))
+ os.makedirs(self.build_dir)
+ if not os.path.exists(self.install_dir):
+ log.info("Creating install folder {}...".format(self.install_dir))
+ os.makedirs(self.install_dir)
+
+ if not (OPTION_ONLYPACKAGE
+ and not config.is_internal_shiboken_generator_build_and_part_of_top_level_all()):
+ # Build extensions
+ for ext in config.get_buildable_extensions():
+ self.build_extension(ext)
+
+ if OPTION_BUILDTESTS:
+ # we record the latest successful build and note the
+ # build directory for supporting the tests.
+ timestamp = time.strftime('%Y-%m-%d_%H%M%S')
+ build_history = os.path.join(setup_script_dir, 'build_history')
+ unique_dir = os.path.join(build_history, timestamp)
+ os.makedirs(unique_dir)
+ fpath = os.path.join(unique_dir, 'build_dir.txt')
+ with open(fpath, 'w') as f:
+ print(build_dir, file=f)
+ log.info("Created {}".format(build_history))
+
+ if not OPTION_SKIP_PACKAGING:
+ # Build patchelf if needed
+ self.build_patchelf()
+
+ # Prepare packages
+ self.prepare_packages()
+
+ # Build packages
+ _build.run(self)
+ else:
+ log.info("Skipped preparing and building packages.")
+ 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():
+ return
+
+ setuptools_install_prefix = get_python_lib(1)
+ if OPTION_FINAL_INSTALL_PREFIX:
+ 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))
@@ -726,40 +745,34 @@ class PysideBuild(_build):
log.info("Make generator: {}".format(self.make_generator))
log.info("Make jobs: {}".format(OPTION_JOBS))
log.info("-" * 3)
-
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(dedent("""
- Building PySide2 will create and touch directories
+ Building {st_package_name} will create and touch directories
in the following order:
make build directory (py*_build/*/*) ->
make install directory (py*_install/*/*) ->
- {} directory (pyside_package/*) ->
setuptools build directory (build/*/*) ->
setuptools install directory
(usually path-installed-python/lib/python*/site-packages/*)
- """).format(pyside_package_dir_name))
-
+ """).format(st_package_name=config.package_name()))
log.info("make build directory: {}".format(self.build_dir))
log.info("make install directory: {}".format(self.install_dir))
- log.info("{} directory: {}".format(pyside_package_dir_name,
- self.pyside_package_dir))
- log.info("setuptools build directory: {}".format(
- os.path.join(self.script_dir, "build")))
- log.info("setuptools install directory: {}".format(
- setuptools_install_prefix))
- log.info("make-installed site-packages directory: {} \n"
- " (only relevant for copying files from "
- "'make install directory' to '{} directory'".format(
- self.site_packages_dir, pyside_package_dir_name))
+ 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: {}
+ (only relevant for copying files from 'make install directory'
+ to 'setuptools build directory'
+ """).format(
+ 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(py_prefix))
- log.info("Python scripts: {}".format(py_scripts_dir))
+ 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 version: {}".format(self.qtinfo.version))
@@ -772,52 +785,11 @@ class PysideBuild(_build):
if sys.platform == 'darwin':
pyside_macos_deployment_target = (
PysideBuild.macos_pyside_min_deployment_target()
- )
+ )
log.info("MACOSX_DEPLOYMENT_TARGET set to: {}".format(
pyside_macos_deployment_target))
log.info("=" * 30)
- # Prepare folders
- if not os.path.exists(self.sources_dir):
- log.info("Creating sources folder {}...".format(self.sources_dir))
- os.makedirs(self.sources_dir)
- if not os.path.exists(self.build_dir):
- log.info("Creating build folder {}...".format(self.build_dir))
- os.makedirs(self.build_dir)
- if not os.path.exists(self.install_dir):
- log.info("Creating install folder {}...".format(self.install_dir))
- os.makedirs(self.install_dir)
-
- if not OPTION_ONLYPACKAGE:
- # Build extensions
- for ext in contained_modules:
- self.build_extension(ext)
-
- if OPTION_BUILDTESTS:
- # we record the latest successful build and note the
- # build directory for supporting the tests.
- timestamp = time.strftime('%Y-%m-%d_%H%M%S')
- build_history = os.path.join(setup_script_dir, 'build_history')
- unique_dir = os.path.join(build_history, timestamp)
- os.makedirs(unique_dir)
- fpath = os.path.join(unique_dir, 'build_dir.txt')
- with open(fpath, 'w') as f:
- print(build_dir, file=f)
- log.info("Created {}".format(build_history))
-
- if not OPTION_SKIP_PACKAGING:
- # Build patchelf if needed
- self.build_patchelf()
-
- # Prepare packages
- self.prepare_packages()
-
- # Build packages
- _build.run(self)
- else:
- log.info("Skipped preparing and building packages.")
- log.info('*** Build completed')
-
@staticmethod
def macos_qt_min_deployment_target():
target = qtinfo.macos_min_deployment_target
@@ -941,8 +913,17 @@ class PysideBuild(_build):
module_src_dir = os.path.join(self.sources_dir, extension)
# Build module
- cmake_cmd = [
- OPTION_CMAKE,
+ cmake_cmd = [OPTION_CMAKE]
+ if OPTION_QUIET:
+ # Pass a special custom option, to allow printing a lot less information when doing
+ # a quiet build.
+ cmake_cmd.append('-DQUIET_BUILD=1')
+ if self.make_generator == "Unix Makefiles":
+ # Hide progress messages for each built source file.
+ # Doesn't seem to work if set within the cmake files themselves.
+ cmake_cmd.append('-DCMAKE_RULE_MESSAGES=0')
+
+ cmake_cmd += [
"-G", self.make_generator,
"-DBUILD_TESTS={}".format(self.build_tests),
"-DQt5Help_DIR={}".format(self.qtinfo.docs_dir),
@@ -953,6 +934,17 @@ class PysideBuild(_build):
cmake_cmd.append("-DPYTHON_EXECUTABLE={}".format(self.py_executable))
cmake_cmd.append("-DPYTHON_INCLUDE_DIR={}".format(self.py_include_dir))
cmake_cmd.append("-DPYTHON_LIBRARY={}".format(self.py_library))
+
+ # If a custom shiboken cmake config directory path was provided, pass it to CMake.
+ if OPTION_SHIBOKEN_CONFIG_DIR and config.is_internal_pyside_build():
+ if os.path.exists(OPTION_SHIBOKEN_CONFIG_DIR):
+ log.info("Using custom provided shiboken2 installation: {}"
+ .format(OPTION_SHIBOKEN_CONFIG_DIR))
+ cmake_cmd.append("-DShiboken2_DIR={}".format(OPTION_SHIBOKEN_CONFIG_DIR))
+ else:
+ log.info("Custom provided shiboken2 installation not found. Path given: {}"
+ .format(OPTION_SHIBOKEN_CONFIG_DIR))
+
if OPTION_MODULE_SUBSET:
module_sub_set = ''
for m in OPTION_MODULE_SUBSET.split(','):
@@ -1014,20 +1006,20 @@ class PysideBuild(_build):
cmake_cmd.append("-DPYSIDE_QT_CONF_PREFIX={}".format(
pyside_qt_conf_prefix))
- # Pass package version to CMake, so this string can be
- # embedded into _config.py file.
- package_version = get_package_version()
- cmake_cmd.append("-DPYSIDE_SETUP_PY_PACKAGE_VERSION={}".format(
- package_version))
-
- # In case if this is a snapshot build, also pass the
- # timestamp as a separate value, because it the only
- # version component that is actually generated by setup.py.
- timestamp = ''
- if OPTION_SNAPSHOT_BUILD:
- timestamp = get_package_timestamp()
- cmake_cmd.append("-DPYSIDE_SETUP_PY_PACKAGE_TIMESTAMP={}".format(
- timestamp))
+ # Pass package version to CMake, so this string can be
+ # embedded into _config.py file.
+ package_version = get_package_version()
+ cmake_cmd.append("-DPACKAGE_SETUP_PY_PACKAGE_VERSION={}".format(
+ package_version))
+
+ # In case if this is a snapshot build, also pass the
+ # timestamp as a separate value, because it is the only
+ # version component that is actually generated by setup.py.
+ timestamp = ''
+ if OPTION_SNAPSHOT_BUILD:
+ timestamp = get_package_timestamp()
+ cmake_cmd.append("-DPACKAGE_SETUP_PY_PACKAGE_TIMESTAMP={}".format(
+ timestamp))
if extension.lower() in ["shiboken2", "pyside2-tools"]:
cmake_cmd.append("-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=yes")
@@ -1120,7 +1112,9 @@ class PysideBuild(_build):
log.info("Waiting 1 second, to ensure installation is "
"successful...")
time.sleep(1)
- if run_process([self.make_path, "install/fast"]) != 0:
+ # ninja: error: unknown target 'install/fast'
+ target = 'install/fast' if self.make_generator != 'Ninja' else 'install'
+ if run_process([self.make_path, target]) != 0:
raise DistutilsSetupError("Error pseudo installing {}".format(
extension))
else:
@@ -1129,15 +1123,24 @@ class PysideBuild(_build):
os.chdir(self.script_dir)
def prepare_packages(self):
+ """
+ This will copy all relevant files from the various locations in the "cmake install dir",
+ to the setup tools build dir (which is read from self.build_lib provided by distutils).
+
+ After that setuptools.command.build_py is smart enough to copy everything
+ from the build dir to the install dir (the virtualenv site-packages for example).
+ """
try:
- log.info("Preparing packages...")
+ log.info("\nPreparing setup tools build directory.\n")
vars = {
"site_packages_dir": self.site_packages_dir,
"sources_dir": self.sources_dir,
"install_dir": self.install_dir,
"build_dir": self.build_dir,
"script_dir": self.script_dir,
- "pyside_package_dir": self.pyside_package_dir,
+ "st_build_dir": self.st_build_dir,
+ "cmake_package_name": config.package_name(),
+ "st_package_name": config.package_name(),
"ssl_libs_dir": OPTION_OPENSSL,
"py_version": self.py_version,
"qt_version": self.qtinfo.version,
@@ -1151,6 +1154,12 @@ class PysideBuild(_build):
"qt_qml_dir": self.qtinfo.qml_dir,
"target_arch": self.py_arch,
}
+
+ # Needed for correct file installation in generator build
+ # case.
+ if config.is_internal_shiboken_generator_build():
+ vars['cmake_package_name'] = config.shiboken_module_option_name
+
os.chdir(self.script_dir)
if sys.platform == "win32":
@@ -1170,19 +1179,21 @@ class PysideBuild(_build):
def get_built_pyside_config(self, vars):
# Get config that contains list of built modules, and
# SOVERSIONs of the built libraries.
- pyside_package_dir = vars['pyside_package_dir']
- config_path = os.path.join(pyside_package_dir, "PySide2", "_config.py")
- config = get_python_dict(config_path)
- return config
+ st_build_dir = vars['st_build_dir']
+ config_path = os.path.join(st_build_dir, config.package_name(), "_config.py")
+ temp_config = get_python_dict(config_path)
+ if 'built_modules' not in temp_config:
+ temp_config['built_modules'] = []
+ return temp_config
def is_webengine_built(self, built_modules):
return ('WebEngineWidgets' in built_modules or 'WebEngineCore' in built_modules
or 'WebEngine' in built_modules)
- def prepare_standalone_clang(self, is_win = False):
+ def prepare_standalone_clang(self, is_win=False):
"""
- Copies the libclang library to the pyside package so that
- shiboken executable works.
+ Copies the libclang library to the shiboken2-generator
+ package so that the shiboken executable works.
"""
log.info('Finding path to the libclang shared library.')
cmake_cmd = [
@@ -1205,47 +1216,54 @@ class PysideBuild(_build):
if not clang_lib_path:
raise RuntimeError("Could not find the location of the libclang "
- "library inside the CMake cache file.")
+ "library inside the CMake cache file.")
- target_name = None
if is_win:
# clang_lib_path points to the static import library
# (lib/libclang.lib), whereas we want to copy the shared
# library (bin/libclang.dll).
- clang_lib_path = re.sub(r'lib/libclang.lib$', 'bin/libclang.dll',
- clang_lib_path)
+ clang_lib_path = re.sub(r'lib/libclang.lib$',
+ 'bin/libclang.dll',
+ clang_lib_path)
else:
- if sys.platform != 'darwin' and os.path.islink(clang_lib_path):
- # On Linux, we get "libclang.so" from CMake which is
- # a symlink:
- # libclang.so -> libclang.so.6 -> libclang.so.6.0.
- # shiboken2 links against libclang.so.6. So, we
- # determine the target name by resolving just
- # one symlink (note: os.path.realpath() resolves all).
- target_name = os.readlink(clang_lib_path)
- # We want to resolve any symlink on Linux and macOS, and
- # copy the actual file.
- clang_lib_path = os.path.realpath(clang_lib_path)
-
- if not target_name:
- target_name = os.path.basename(clang_lib_path)
-
- # Path to directory containing libclang.
- clang_lib_dir = os.path.dirname(clang_lib_path)
-
- # The destination will be the package folder near the other
- # extension modules.
- destination_dir = "{}/PySide2".format(os.path.join(self.script_dir,
- 'pyside_package'))
+ # shiboken2 links against libclang.so.6 or a similarly
+ # named library.
+ # If the linked against library is a symlink, resolve
+ # the symlink once (but not all the way to the real
+ # file) on Linux and macOS,
+ # so that we get the path to the "SO version" symlink
+ # (the one used as the install name in the shared library
+ # dependency section).
+ # E.g. On Linux libclang.so -> libclang.so.6 ->
+ # libclang.so.6.0.
+ # "libclang.so.6" is the name we want for the copied file.
+ if os.path.islink(clang_lib_path):
+ link_target = os.readlink(clang_lib_path)
+ if os.path.isabs(link_target):
+ clang_lib_path = link_target
+ else:
+ # link_target is relative, transform to absolute.
+ clang_lib_path = os.path.join(os.path.dirname(clang_lib_path), link_target)
+ clang_lib_path = os.path.abspath(clang_lib_path)
+
+ # The destination will be the shiboken package folder.
+ vars = {}
+ vars['st_build_dir'] = self.st_build_dir
+ vars['st_package_name'] = config.package_name()
+ destination_dir = "{st_build_dir}/{st_package_name}".format(**vars)
+
if os.path.exists(clang_lib_path):
- log.info('Copying libclang shared library {} to the package folder as {}.'.format(
- clang_lib_path, target_name))
basename = os.path.basename(clang_lib_path)
- destination_path = os.path.join(destination_dir, target_name)
+ log.info('Copying libclang shared library {} to the package folder as {}.'.format(
+ clang_lib_path, basename))
+ destination_path = os.path.join(destination_dir, basename)
# Need to modify permissions in case file is not writable
# (a reinstall would cause a permission denied error).
- copyfile(clang_lib_path, destination_path, make_writable_by_owner=True)
+ copyfile(clang_lib_path,
+ destination_path,
+ force_copy_symlink=True,
+ make_writable_by_owner=True)
else:
raise RuntimeError("Error copying libclang library "
"from {} to {}. ".format(
@@ -1265,18 +1283,17 @@ class PysideBuild(_build):
else:
# Add rpath values pointing to $ORIGIN and the
# installed qt lib directory.
- local_rpath = '$ORIGIN/'
- qt_lib_dir = self.qtinfo.libs_dir
+ final_rpath = self.qtinfo.libs_dir
if OPTION_STANDALONE:
- qt_lib_dir = "$ORIGIN/Qt/lib"
- final_rpath = local_rpath + ':' + qt_lib_dir
- cmd = [self._patchelf_path, '--set-rpath', final_rpath, srcpath]
- if run_process(cmd) != 0:
- raise RuntimeError("Error patching rpath in " + srcpath)
+ final_rpath = "$ORIGIN/Qt/lib"
+ override = OPTION_STANDALONE
+ linux_fix_rpaths_for_library(self._patchelf_path, srcpath, final_rpath,
+ override=override)
elif sys.platform == 'darwin':
pyside_libs = [lib for lib in os.listdir(
package_path) if filter_match(lib, ["*.so", "*.dylib"])]
+
def rpath_cmd(srcpath):
final_rpath = ''
# Command line rpath option takes precedence over
@@ -1304,17 +1321,8 @@ class PysideBuild(_build):
if not os.path.exists(srcpath):
continue
rpath_cmd(srcpath)
- print("Patched rpath to '$ORIGIN/' (Linux) or "
- "updated rpath (OS/X) in {}.".format(srcpath))
-
-
-try:
- with open(os.path.join(setup_script_dir, 'README.rst')) as f:
- README = f.read()
- with open(os.path.join(setup_script_dir, 'CHANGES.rst')) as f:
- CHANGES = f.read()
-except IOError:
- README = CHANGES = ''
+ log.info("Patched rpath to '$ORIGIN/' (Linux) or "
+ "updated rpath (OS/X) in {}.".format(srcpath))
cmd_class_dict = {
diff --git a/build_scripts/options.py b/build_scripts/options.py
index fd8b0718..64464993 100644
--- a/build_scripts/options.py
+++ b/build_scripts/options.py
@@ -38,16 +38,109 @@
#############################################################################
from __future__ import print_function
+import sys
+import os
+import warnings
+
+
+def _warn_multiple_option(option):
+ w = 'Option "{}" occurs multiple times on the command line.'.format(option)
+ warnings.warn(w)
+
+def _warn_deprecated_option(option, replacement=None):
+ w = 'Option "{}" is deprecated and may be removed in a future release.'.format(option)
+ if replacement:
+ w = '{}\nUse "{}" instead.'.format(w, replacement)
+ warnings.warn(w)
+
+class Options(object):
+ def __init__(self):
+
+ # Dictionary containing values of all the possible options.
+ self.dict = {}
+
+ def has_option(self, name, remove=True):
+ """ Returns True if argument '--name' was passed on the command
+ line. """
+ option = '--' + name
+ count = sys.argv.count(option)
+ remove_count = count
+ if not remove and count > 0:
+ remove_count -= 1
+ for i in range(remove_count):
+ sys.argv.remove(option)
+ if count > 1:
+ _warn_multiple_option(option)
+ return count > 0
+
+ def option_value(self, name, short_option_name=None, remove=True):
+ """
+ Returns the value of a command line option or environment
+ variable.
+
+ :param name: The name of the command line option or environment
+ variable.
+
+ :param remove: Whether the option and its value should be
+ removed from sys.argv. Useful when there's a need to query for
+ the value and also pass it along to setuptools for example.
+
+ :return: Either the option value or None.
+ """
+ option = '--' + name
+ short_option = '-' + short_option_name if short_option_name else None
+ single_option_prefix = option + '='
+ value = None
+ for index in reversed(range(len(sys.argv))):
+ arg = sys.argv[index]
+ if arg == option or short_option and arg == short_option:
+ if value:
+ _warn_multiple_option(option)
+ else:
+ if index + 1 >= len(sys.argv):
+ raise RuntimeError("The option {} requires a value".format(option))
+ value = sys.argv[index + 1]
+
+ if remove:
+ sys.argv[index:index + 2] = []
+
+ elif arg.startswith(single_option_prefix):
+ if value:
+ _warn_multiple_option(option)
+ else:
+ value = arg[len(single_option_prefix):]
+
+ if remove:
+ sys.argv[index:index + 1] = []
+
+ if value is None:
+ value = os.getenv(name.upper().replace('-', '_'))
+
+ self.dict[name] = value
+ return value
+
+
+options = Options()
+
+
+def has_option(*args, **kwargs):
+ return options.has_option(*args, **kwargs)
+
+
+def option_value(*args,**kwargs):
+ return options.option_value(*args,**kwargs)
-from .utils import has_option, option_value
# Declare options
+OPTION_BUILD_TYPE = option_value("build-type")
+OPTION_INTERNAL_BUILD_TYPE = option_value("internal-build-type")
OPTION_DEBUG = has_option("debug")
OPTION_RELWITHDEBINFO = has_option('relwithdebinfo')
OPTION_QMAKE = option_value("qmake")
OPTION_QT_VERSION = option_value("qt")
OPTION_CMAKE = option_value("cmake")
OPTION_OPENSSL = option_value("openssl")
+OPTION_SHIBOKEN_CONFIG_DIR = option_value("shiboken-config-dir")
OPTION_ONLYPACKAGE = has_option("only-package")
OPTION_STANDALONE = has_option("standalone")
OPTION_MAKESPEC = option_value("make-spec")
@@ -57,7 +150,11 @@ OPTION_SKIP_DOCS = has_option("skip-docs")
# don't include pyside2-examples
OPTION_NOEXAMPLES = has_option("no-examples")
# number of parallel build jobs
-OPTION_JOBS = option_value('jobs')
+OPTION_JOBS = option_value('parallel', short_option_name='j')
+_deprecated_option_jobs = option_value('jobs')
+if _deprecated_option_jobs:
+ _warn_deprecated_option('jobs', 'parallel')
+ OPTION_JOBS = _deprecated_option_jobs
# Legacy, not used any more.
OPTION_JOM = has_option('jom')
# Do not use jom instead of nmake with msvc
@@ -77,8 +174,13 @@ OPTION_MODULE_SUBSET = option_value("module-subset")
OPTION_RPATH_VALUES = option_value("rpath")
OPTION_QT_CONF_PREFIX = option_value("qt-conf-prefix")
OPTION_QT_SRC = option_value("qt-src-dir")
+OPTION_QUIET = has_option('quiet', remove=False)
OPTION_VERBOSE_BUILD = has_option("verbose-build")
OPTION_SANITIZE_ADDRESS = has_option("sanitize-address")
OPTION_SNAPSHOT_BUILD = has_option("snapshot-build")
OPTION_LIMITED_API = option_value("limited-api")
OPTION_PACKAGE_TIMESTAMP = option_value("package-timestamp")
+
+# This is used automatically by distutils.command.install object, to
+# specify the final installation location.
+OPTION_FINAL_INSTALL_PREFIX = option_value("prefix", remove=False)
diff --git a/build_scripts/platforms/linux.py b/build_scripts/platforms/linux.py
index 4c38fef6..067179cd 100644
--- a/build_scripts/platforms/linux.py
+++ b/build_scripts/platforms/linux.py
@@ -37,76 +37,100 @@
##
#############################################################################
-from ..options import *
from ..utils import copydir, copyfile, copy_icu_libs, find_files_using_glob
+from ..config import config
-def prepare_standalone_package_linux(self, executables, vars):
+
+def prepare_standalone_package_linux(self, vars):
built_modules = vars['built_modules']
- # <qt>/lib/* -> <setup>/PySide2/Qt/lib
- destination_lib_dir = "{pyside_package_dir}/PySide2/Qt/lib"
+ constrain_modules = None
+ copy_plugins = True
+ copy_qml = True
+ copy_translations = True
+ copy_qt_conf = True
+ should_copy_icu_libs = True
+
+ if config.is_internal_shiboken_generator_build():
+ constrain_modules = ["Core", "Network", "Xml", "XmlPatterns"]
+ copy_plugins = False
+ copy_qml = False
+ copy_translations = False
+ copy_qt_conf = False
+ should_copy_icu_libs = False
+
+ # <qt>/lib/* -> <setup>/{st_package_name}/Qt/lib
+ destination_lib_dir = "{st_build_dir}/{st_package_name}/Qt/lib"
+
+ accepted_modules = ['libQt5*.so.?']
+ if constrain_modules:
+ accepted_modules = ["libQt5" + module + "*.so.?" for module in constrain_modules]
+ accepted_modules.append("libicu*.so.??")
+
copydir("{qt_lib_dir}", destination_lib_dir,
- filter=[
- "libQt5*.so.?",
- "libicu*.so.??",
- ],
- recursive=False, vars=vars, force_copy_symlinks=True)
-
- # Check if ICU libraries were copied over to the destination
- # Qt libdir.
- resolved_destination_lib_dir = destination_lib_dir.format(**vars)
- maybe_icu_libs = find_files_using_glob(resolved_destination_lib_dir,
- "libicu*")
-
- # If no ICU libraries are present in the Qt libdir (like when
- # Qt is built against system ICU, or in the Coin CI where ICU
- # libs are in a different directory) try to find out / resolve
- # which ICU libs are used by QtCore (if used at all) using a
- # custom written ldd, and copy the ICU libs to the Pyside Qt
- # dir if necessary. We choose the QtCore lib to inspect, by
- # checking which QtCore library the shiboken2 executable uses.
- if not maybe_icu_libs:
- copy_icu_libs(self._patchelf_path, resolved_destination_lib_dir)
+ filter=accepted_modules,
+ recursive=False, vars=vars, force_copy_symlinks=True)
+
+ if should_copy_icu_libs:
+ # Check if ICU libraries were copied over to the destination
+ # Qt libdir.
+ resolved_destination_lib_dir = destination_lib_dir.format(**vars)
+ maybe_icu_libs = find_files_using_glob(resolved_destination_lib_dir,
+ "libicu*")
+
+ # If no ICU libraries are present in the Qt libdir (like when
+ # Qt is built against system ICU, or in the Coin CI where ICU
+ # libs are in a different directory) try to find out / resolve
+ # which ICU libs are used by QtCore (if used at all) using a
+ # custom written ldd, and copy the ICU libs to the Pyside Qt
+ # dir if necessary. We choose the QtCore lib to inspect, by
+ # checking which QtCore library the shiboken2 executable uses.
+ if not maybe_icu_libs:
+ copy_icu_libs(self._patchelf_path, resolved_destination_lib_dir)
if self.is_webengine_built(built_modules):
copydir("{qt_lib_execs_dir}",
- "{pyside_package_dir}/PySide2/Qt/libexec",
+ "{st_build_dir}/{st_package_name}/Qt/libexec",
filter=None,
recursive=False,
vars=vars)
copydir("{qt_prefix_dir}/resources",
- "{pyside_package_dir}/PySide2/Qt/resources",
+ "{st_build_dir}/{st_package_name}/Qt/resources",
filter=None,
recursive=False,
vars=vars)
- # <qt>/plugins/* -> <setup>/PySide2/Qt/plugins
- copydir("{qt_plugins_dir}",
- "{pyside_package_dir}/PySide2/Qt/plugins",
- filter=["*.so"],
- recursive=True,
- vars=vars)
-
- # <qt>/qml/* -> <setup>/PySide2/Qt/qml
- copydir("{qt_qml_dir}",
- "{pyside_package_dir}/PySide2/Qt/qml",
- filter=None,
- force=False,
- recursive=True,
- ignore=["*.so.debug"],
- vars=vars)
-
- # <qt>/translations/* -> <setup>/PySide2/Qt/translations
-
- copydir("{qt_translations_dir}",
- "{pyside_package_dir}/PySide2/Qt/translations",
- filter=["*.qm", "*.pak"],
- force=False,
- vars=vars)
-
- # Copy the qt.conf file to libexec.
- copyfile(
- "{build_dir}/pyside2/PySide2/qt.conf",
- "{pyside_package_dir}/PySide2/Qt/libexec",
- vars=vars)
+ if copy_plugins:
+ # <qt>/plugins/* -> <setup>/{st_package_name}/Qt/plugins
+ copydir("{qt_plugins_dir}",
+ "{st_build_dir}/{st_package_name}/Qt/plugins",
+ filter=["*.so"],
+ recursive=True,
+ vars=vars)
+
+ if copy_qml:
+ # <qt>/qml/* -> <setup>/{st_package_name}/Qt/qml
+ copydir("{qt_qml_dir}",
+ "{st_build_dir}/{st_package_name}/Qt/qml",
+ filter=None,
+ force=False,
+ recursive=True,
+ ignore=["*.so.debug"],
+ vars=vars)
+
+ if copy_translations:
+ # <qt>/translations/* ->
+ # <setup>/{st_package_name}/Qt/translations
+ copydir("{qt_translations_dir}",
+ "{st_build_dir}/{st_package_name}/Qt/translations",
+ filter=["*.qm", "*.pak"],
+ force=False,
+ vars=vars)
+
+ if copy_qt_conf:
+ # Copy the qt.conf file to libexec.
+ copyfile(
+ "{build_dir}/pyside2/{st_package_name}/qt.conf",
+ "{st_build_dir}/{st_package_name}/Qt/libexec",
+ vars=vars)
diff --git a/build_scripts/platforms/macos.py b/build_scripts/platforms/macos.py
index 936f4ca9..49f02754 100644
--- a/build_scripts/platforms/macos.py
+++ b/build_scripts/platforms/macos.py
@@ -37,12 +37,29 @@
##
#############################################################################
-import fnmatch, os
+import fnmatch
+import os
from ..utils import copydir, copyfile, macos_fix_rpaths_for_library
+from ..config import config
-def prepare_standalone_package_macos(self, executables, vars):
+
+def prepare_standalone_package_macos(self, vars):
built_modules = vars['built_modules']
+ constrain_modules = None
+ copy_plugins = True
+ copy_qml = True
+ copy_translations = True
+ copy_qt_conf = True
+
+ if config.is_internal_shiboken_generator_build():
+ constrain_modules = ["Core", "Network", "Xml", "XmlPatterns"]
+ constrain_frameworks = ['Qt' + name + '.framework' for name in constrain_modules]
+ copy_plugins = False
+ copy_qml = False
+ copy_translations = False
+ copy_qt_conf = False
+
# Directory filter for skipping unnecessary files.
def general_dir_filter(dir_name, parent_full_path, dir_full_path):
if fnmatch.fnmatch(dir_name, "*.dSYM"):
@@ -52,6 +69,7 @@ def prepare_standalone_package_macos(self, executables, vars):
# Filter out debug plugins and qml plugins in the
# debug_and_release config.
no_copy_debug = True
+
def file_variant_filter(file_name, file_full_path):
if self.qtinfo.build_type != 'debug_and_release':
return True
@@ -59,17 +77,16 @@ def prepare_standalone_package_macos(self, executables, vars):
return False
return True
- # <qt>/lib/* -> <setup>/PySide2/Qt/lib
+ # <qt>/lib/* -> <setup>/{st_package_name}/Qt/lib
if self.qt_is_framework_build():
- framework_built_modules = [
- 'Qt' + name + '.framework' for name in built_modules]
-
- def framework_dir_filter(dir_name, parent_full_path,
- dir_full_path):
+ def framework_dir_filter(dir_name, parent_full_path, dir_full_path):
if '.framework' in dir_name:
- if dir_name.startswith('QtWebEngine') and not \
- self.is_webengine_built(built_modules):
+ if (dir_name.startswith('QtWebEngine') and
+ not self.is_webengine_built(built_modules)):
+ return False
+ if constrain_modules and dir_name not in constrain_frameworks:
return False
+
if dir_name in ['Headers', 'fonts']:
return False
if dir_full_path.endswith('Versions/Current'):
@@ -84,6 +101,7 @@ def prepare_standalone_package_macos(self, executables, vars):
# Filter out debug frameworks in the
# debug_and_release config.
no_copy_debug = True
+
def framework_variant_filter(file_name, file_full_path):
if self.qtinfo.build_type != 'debug_and_release':
return True
@@ -93,7 +111,7 @@ def prepare_standalone_package_macos(self, executables, vars):
return False
return True
- copydir("{qt_lib_dir}", "{pyside_package_dir}/PySide2/Qt/lib",
+ copydir("{qt_lib_dir}", "{st_build_dir}/{st_package_name}/Qt/lib",
recursive=True, vars=vars,
ignore=["*.la", "*.a", "*.cmake", "*.pc", "*.prl"],
dir_filter_function=framework_dir_filter,
@@ -104,7 +122,7 @@ def prepare_standalone_package_macos(self, executables, vars):
# from Versions/5/Helpers, thus adding two more levels of
# directory hierarchy.
if self.is_webengine_built(built_modules):
- qt_lib_path = "{pyside_package_dir}/PySide2/Qt/lib".format(
+ qt_lib_path = "{st_build_dir}/{st_package_name}/Qt/lib".format(
**vars)
bundle = "QtWebEngineCore.framework/Helpers/"
bundle += "QtWebEngineProcess.app"
@@ -120,9 +138,11 @@ def prepare_standalone_package_macos(self, executables, vars):
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]
copydir("{qt_lib_dir}",
- "{pyside_package_dir}/PySide2/Qt/lib",
+ "{st_build_dir}/{st_package_name}/Qt/lib",
filter=accepted_modules,
ignore=ignored_modules,
file_filter_function=file_variant_filter,
@@ -130,53 +150,58 @@ def prepare_standalone_package_macos(self, executables, vars):
if self.is_webengine_built(built_modules):
copydir("{qt_lib_execs_dir}",
- "{pyside_package_dir}/PySide2/Qt/libexec",
+ "{st_build_dir}/{st_package_name}/Qt/libexec",
filter=None,
recursive=False,
vars=vars)
copydir("{qt_prefix_dir}/resources",
- "{pyside_package_dir}/PySide2/Qt/resources",
+ "{st_build_dir}/{st_package_name}/Qt/resources",
filter=None,
recursive=False,
vars=vars)
# Fix rpath for WebEngine process executable.
- pyside_package_dir = vars['pyside_package_dir']
- qt_libexec_path = "{}/PySide2/Qt/libexec".format(pyside_package_dir)
+ qt_libexec_path = "{st_build_dir}/{st_package_name}/Qt/libexec".format(**vars)
binary = "QtWebEngineProcess"
final_path = os.path.join(qt_libexec_path, binary)
rpath = "@loader_path/../lib"
macos_fix_rpaths_for_library(final_path, rpath)
- # Copy the qt.conf file to libexec.
- copyfile(
- "{build_dir}/pyside2/PySide2/qt.conf",
- "{pyside_package_dir}/PySide2/Qt/libexec",
- vars=vars)
+ if copy_qt_conf:
+ # Copy the qt.conf file to libexec.
+ copyfile(
+ "{build_dir}/pyside2/{st_package_name}/qt.conf",
+ "{st_build_dir}/{st_package_name}/Qt/libexec",
+ vars=vars)
+
+ if copy_plugins:
+ # <qt>/plugins/* -> <setup>/{st_package_name}/Qt/plugins
+ copydir("{qt_plugins_dir}",
+ "{st_build_dir}/{st_package_name}/Qt/plugins",
+ filter=["*.dylib"],
+ recursive=True,
+ dir_filter_function=general_dir_filter,
+ file_filter_function=file_variant_filter,
+ vars=vars)
+
- # <qt>/plugins/* -> <setup>/PySide2/Qt/plugins
- copydir("{qt_plugins_dir}",
- "{pyside_package_dir}/PySide2/Qt/plugins",
- filter=["*.dylib"],
- recursive=True,
- dir_filter_function=general_dir_filter,
- file_filter_function=file_variant_filter,
- vars=vars)
-
- # <qt>/qml/* -> <setup>/PySide2/Qt/qml
- copydir("{qt_qml_dir}",
- "{pyside_package_dir}/PySide2/Qt/qml",
- filter=None,
- recursive=True,
- force=False,
- dir_filter_function=general_dir_filter,
- file_filter_function=file_variant_filter,
- vars=vars)
-
- # <qt>/translations/* -> <setup>/PySide2/Qt/translations
- copydir("{qt_translations_dir}",
- "{pyside_package_dir}/PySide2/Qt/translations",
- filter=["*.qm", "*.pak"],
- force=False,
- vars=vars)
+ if copy_qml:
+ # <qt>/qml/* -> <setup>/{st_package_name}/Qt/qml
+ copydir("{qt_qml_dir}",
+ "{st_build_dir}/{st_package_name}/Qt/qml",
+ filter=None,
+ recursive=True,
+ force=False,
+ dir_filter_function=general_dir_filter,
+ file_filter_function=file_variant_filter,
+ vars=vars)
+
+ if copy_translations:
+ # <qt>/translations/* ->
+ # <setup>/{st_package_name}/Qt/translations
+ copydir("{qt_translations_dir}",
+ "{st_build_dir}/{st_package_name}/Qt/translations",
+ filter=["*.qm", "*.pak"],
+ force=False,
+ vars=vars)
diff --git a/build_scripts/platforms/unix.py b/build_scripts/platforms/unix.py
index c93bbbbb..d3767976 100644
--- a/build_scripts/platforms/unix.py
+++ b/build_scripts/platforms/unix.py
@@ -37,69 +37,31 @@
##
#############################################################################
-import os, re, sys
+import os
+import sys
from .linux import prepare_standalone_package_linux
from .macos import prepare_standalone_package_macos
+
+from ..config import config
from ..options import *
from ..utils import copydir, copyfile, rmtree, makefile
from ..utils import regenerate_qt_resources
+
def prepare_packages_posix(self, vars):
executables = []
- # <build>/shiboken2/doc/html/* ->
- # <setup>/PySide2/docs/shiboken2
- copydir(
- "{build_dir}/shiboken2/doc/html",
- "{pyside_package_dir}/PySide2/docs/shiboken2",
- force=False, vars=vars)
- # <install>/lib/site-packages/PySide2/* -> <setup>/PySide2
- copydir(
- "{site_packages_dir}/PySide2",
- "{pyside_package_dir}/PySide2",
- vars=vars)
- # <install>/lib/site-packages/shiboken2.so ->
- # <setup>/PySide2/shiboken2.so
- shiboken_module_name = 'shiboken2.so'
- shiboken_src_path = "{site_packages_dir}".format(**vars)
- maybe_shiboken_names = [f for f in os.listdir(shiboken_src_path)
- if re.match(r'shiboken.*\.so', f)]
- if maybe_shiboken_names:
- shiboken_module_name = maybe_shiboken_names[0]
- vars.update({'shiboken_module_name': shiboken_module_name})
- copyfile(
- "{site_packages_dir}/{shiboken_module_name}",
- "{pyside_package_dir}/PySide2/{shiboken_module_name}",
- vars=vars)
- # <install>/lib/site-packages/pyside2uic/* ->
- # <setup>/pyside2uic
+
+ # <install>/lib/site-packages/{st_package_name}/* ->
+ # <setup>/{st_package_name}
+ # This copies the module .so/.dylib files and various .py files
+ # (__init__, config, git version, etc.)
copydir(
- "{site_packages_dir}/pyside2uic",
- "{pyside_package_dir}/pyside2uic",
- force=False, vars=vars)
- if sys.version_info[0] > 2:
- rmtree("{pyside_package_dir}/pyside2uic/port_v2".format(**vars))
- else:
- rmtree("{pyside_package_dir}/pyside2uic/port_v3".format(**vars))
- # <install>/bin/pyside2-uic -> PySide2/scripts/uic.py
- makefile(
- "{pyside_package_dir}/PySide2/scripts/__init__.py",
+ "{site_packages_dir}/{st_package_name}",
+ "{st_build_dir}/{st_package_name}",
vars=vars)
- copyfile(
- "{install_dir}/bin/pyside2-uic",
- "{pyside_package_dir}/PySide2/scripts/uic.py",
- force=False, vars=vars)
- # <install>/bin/* -> PySide2/
- executables.extend(copydir(
- "{install_dir}/bin/",
- "{pyside_package_dir}/PySide2",
- filter=[
- "pyside2-lupdate",
- "pyside2-rcc",
- "shiboken2",
- ],
- recursive=False, vars=vars))
- # <install>/lib/lib* -> PySide2/
- config = self.get_built_pyside_config(vars)
+
+ generated_config = self.get_built_pyside_config(vars)
+
def adjusted_lib_name(name, version):
postfix = ''
if sys.platform.startswith('linux'):
@@ -107,61 +69,159 @@ def prepare_packages_posix(self, vars):
elif sys.platform == 'darwin':
postfix = '.' + version + '.dylib'
return name + postfix
- copydir(
- "{install_dir}/lib/",
- "{pyside_package_dir}/PySide2",
- filter=[
- adjusted_lib_name("libpyside*",
- config['pyside_library_soversion']),
- adjusted_lib_name("libshiboken*",
- config['shiboken_library_soversion']),
- ],
- recursive=False, vars=vars, force_copy_symlinks=True)
- # <install>/share/PySide2/typesystems/* ->
- # <setup>/PySide2/typesystems
- copydir(
- "{install_dir}/share/PySide2/typesystems",
- "{pyside_package_dir}/PySide2/typesystems",
- vars=vars)
- # <install>/include/* -> <setup>/PySide2/include
- copydir(
- "{install_dir}/include",
- "{pyside_package_dir}/PySide2/include",
- vars=vars)
- # <source>/pyside2/PySide2/support/* ->
- # <setup>/PySide2/support/*
- copydir(
- "{build_dir}/pyside2/PySide2/support",
- "{pyside_package_dir}/PySide2/support",
- vars=vars)
- if not OPTION_NOEXAMPLES:
- # examples/* -> <setup>/PySide2/examples
- copydir(os.path.join(self.script_dir, "examples"),
- "{pyside_package_dir}/PySide2/examples",
- force=False, vars=vars)
- # Re-generate examples Qt resource files for Python 3
- # compatibility
- if sys.version_info[0] == 3:
- examples_path = "{pyside_package_dir}/PySide2/examples".format(
- **vars)
- pyside_rcc_path = "{install_dir}/bin/pyside2-rcc".format(
- **vars)
- pyside_rcc_options = '-py3'
- regenerate_qt_resources(examples_path, pyside_rcc_path,
- pyside_rcc_options)
+
+ if config.is_internal_shiboken_module_build():
+ # <build>/shiboken2/doc/html/* ->
+ # <setup>/{st_package_name}/docs/shiboken2
+ copydir(
+ "{build_dir}/shiboken2/doc/html",
+ "{st_build_dir}/{st_package_name}/docs/shiboken2",
+ force=False, vars=vars)
+
+ # <install>/lib/lib* -> {st_package_name}/
+ copydir(
+ "{install_dir}/lib/",
+ "{st_build_dir}/{st_package_name}",
+ filter=[
+ adjusted_lib_name("libshiboken*",
+ generated_config['shiboken_library_soversion']),
+ ],
+ recursive=False, vars=vars, force_copy_symlinks=True)
+
+ if config.is_internal_shiboken_generator_build():
+ # <install>/bin/* -> {st_package_name}/
+ executables.extend(copydir(
+ "{install_dir}/bin/",
+ "{st_build_dir}/{st_package_name}",
+ filter=[
+ "shiboken2",
+ ],
+ recursive=False, vars=vars))
+
+ # Used to create scripts directory.
+ makefile(
+ "{st_build_dir}/{st_package_name}/scripts/shiboken_tool.py",
+ vars=vars)
+
+ # For setting up setuptools entry points.
+ copyfile(
+ "{install_dir}/bin/shiboken_tool.py",
+ "{st_build_dir}/{st_package_name}/scripts/shiboken_tool.py",
+ force=False, vars=vars)
+
+ if config.is_internal_shiboken_generator_build() or config.is_internal_pyside_build():
+ # <install>/include/* -> <setup>/{st_package_name}/include
+ copydir(
+ "{install_dir}/include/{cmake_package_name}",
+ "{st_build_dir}/{st_package_name}/include",
+ vars=vars)
+
+ if config.is_internal_pyside_build():
+ # <install>/lib/site-packages/pyside2uic/* ->
+ # <setup>/pyside2uic
+ copydir(
+ "{site_packages_dir}/pyside2uic",
+ "{st_build_dir}/pyside2uic",
+ force=False, vars=vars)
+ if sys.version_info[0] > 2:
+ rmtree("{st_build_dir}/pyside2uic/port_v2".format(**vars))
+ else:
+ rmtree("{st_build_dir}/pyside2uic/port_v3".format(**vars))
+
+ # <install>/bin/pyside2-uic -> {st_package_name}/scripts/uic.py
+ makefile(
+ "{st_build_dir}/{st_package_name}/scripts/__init__.py",
+ vars=vars)
+ copyfile(
+ "{install_dir}/bin/pyside2-uic",
+ "{st_build_dir}/{st_package_name}/scripts/uic.py",
+ force=False, vars=vars)
+
+ # For setting up setuptools entry points
+ copyfile(
+ "{install_dir}/bin/pyside_tool.py",
+ "{st_build_dir}/{st_package_name}/scripts/pyside_tool.py",
+ force=False, vars=vars)
+
+ # <install>/bin/* -> {st_package_name}/
+ executables.extend(copydir(
+ "{install_dir}/bin/",
+ "{st_build_dir}/{st_package_name}",
+ filter=[
+ "pyside2-lupdate",
+ "pyside2-rcc",
+ ],
+ recursive=False, vars=vars))
+
+ # <install>/lib/lib* -> {st_package_name}/
+ copydir(
+ "{install_dir}/lib/",
+ "{st_build_dir}/{st_package_name}",
+ filter=[
+ adjusted_lib_name("libpyside*",
+ generated_config['pyside_library_soversion']),
+ ],
+ recursive=False, vars=vars, force_copy_symlinks=True)
+
+ # <install>/share/{st_package_name}/typesystems/* ->
+ # <setup>/{st_package_name}/typesystems
+ copydir(
+ "{install_dir}/share/{st_package_name}/typesystems",
+ "{st_build_dir}/{st_package_name}/typesystems",
+ vars=vars)
+
+ # <install>/share/{st_package_name}/glue/* ->
+ # <setup>/{st_package_name}/glue
+ copydir(
+ "{install_dir}/share/{st_package_name}/glue",
+ "{st_build_dir}/{st_package_name}/glue",
+ vars=vars)
+
+ # <source>/pyside2/{st_package_name}/support/* ->
+ # <setup>/{st_package_name}/support/*
+ copydir(
+ "{build_dir}/pyside2/{st_package_name}/support",
+ "{st_build_dir}/{st_package_name}/support",
+ vars=vars)
+
+ # <source>/pyside2/{st_package_name}/*.pyi ->
+ # <setup>/{st_package_name}/*.pyi
+ copydir(
+ "{build_dir}/pyside2/{st_package_name}",
+ "{st_build_dir}/{st_package_name}",
+ filter=["*.pyi"],
+ vars=vars)
+
+ if not OPTION_NOEXAMPLES:
+ # examples/* -> <setup>/{st_package_name}/examples
+ copydir(os.path.join(self.script_dir, "examples"),
+ "{st_build_dir}/{st_package_name}/examples",
+ force=False, vars=vars)
+ # Re-generate examples Qt resource files for Python 3
+ # compatibility
+ if sys.version_info[0] == 3:
+ examples_path = "{st_build_dir}/{st_package_name}/examples".format(
+ **vars)
+ pyside_rcc_path = "{install_dir}/bin/pyside2-rcc".format(
+ **vars)
+ pyside_rcc_options = '-py3'
+ regenerate_qt_resources(examples_path, pyside_rcc_path,
+ pyside_rcc_options)
+
# Copy Qt libs to package
if OPTION_STANDALONE:
- vars['built_modules'] = config['built_modules']
- if sys.platform == 'darwin':
- prepare_standalone_package_macos(self, executables, vars)
- else:
- prepare_standalone_package_linux(self, executables, vars)
+ if config.is_internal_pyside_build() or config.is_internal_shiboken_generator_build():
+ vars['built_modules'] = generated_config['built_modules']
+ if sys.platform == 'darwin':
+ prepare_standalone_package_macos(self, vars)
+ else:
+ prepare_standalone_package_linux(self, vars)
- # Copy over clang before rpath patching.
- self.prepare_standalone_clang(is_win=False)
+ if config.is_internal_shiboken_generator_build():
+ # Copy over clang before rpath patching.
+ self.prepare_standalone_clang(is_win=False)
# Update rpath to $ORIGIN
- if (sys.platform.startswith('linux') or
- sys.platform.startswith('darwin')):
- self.update_rpath("{pyside_package_dir}/PySide2".format(**vars),
- executables)
+ if sys.platform.startswith('linux') or sys.platform.startswith('darwin'):
+ rpath_path = "{st_build_dir}/{st_package_name}".format(**vars)
+ self.update_rpath(rpath_path, executables)
diff --git a/build_scripts/platforms/windows_desktop.py b/build_scripts/platforms/windows_desktop.py
index 3bf386a1..c98ef395 100644
--- a/build_scripts/platforms/windows_desktop.py
+++ b/build_scripts/platforms/windows_desktop.py
@@ -38,147 +38,240 @@
#############################################################################
import functools
-import os, re, sys
+import os
+import sys
+
+from ..config import config
from ..options import *
from ..utils import copydir, copyfile, rmtree, makefile
from ..utils import regenerate_qt_resources, filter_match
from ..utils import download_and_extract_7z
+
def prepare_packages_win32(self, vars):
# For now, debug symbols will not be shipped into the package.
copy_pdbs = False
pdbs = []
if (self.debug or self.build_type == 'RelWithDebInfo') and copy_pdbs:
pdbs = ['*.pdb']
- # <install>/lib/site-packages/PySide2/* -> <setup>/PySide2
+
+ # <install>/lib/site-packages/{st_package_name}/* ->
+ # <setup>/{st_package_name}
+ # This copies the module .pyd files and various .py files
+ # (__init__, config, git version, etc.)
copydir(
- "{site_packages_dir}/PySide2",
- "{pyside_package_dir}/PySide2",
+ "{site_packages_dir}/{st_package_name}",
+ "{st_build_dir}/{st_package_name}",
vars=vars)
- built_modules = self.get_built_pyside_config(vars)['built_modules']
- # <build>/pyside2/PySide2/*.pdb -> <setup>/PySide2
- copydir(
- "{build_dir}/pyside2/PySide2",
- "{pyside_package_dir}/PySide2",
- filter=pdbs,
- recursive=False, vars=vars)
+ if config.is_internal_shiboken_module_build():
+ # <build>/shiboken2/doc/html/* ->
+ # <setup>/{st_package_name}/docs/shiboken2
+ copydir(
+ "{build_dir}/shiboken2/doc/html",
+ "{st_build_dir}/{st_package_name}/docs/shiboken2",
+ force=False, vars=vars)
+
+ # <install>/bin/*.dll -> {st_package_name}/
+ copydir(
+ "{install_dir}/bin/",
+ "{st_build_dir}/{st_package_name}",
+ filter=["shiboken*.dll"],
+ recursive=False, vars=vars)
- # <build>/shiboken2/doc/html/* ->
- # <setup>/PySide2/docs/shiboken2
- copydir(
- "{build_dir}/shiboken2/doc/html",
- "{pyside_package_dir}/PySide2/docs/shiboken2",
- force=False, vars=vars)
-
- # <install>/lib/site-packages/shiboken2.pyd ->
- # <setup>/PySide2/shiboken2.pyd
- shiboken_module_name = 'shiboken2.pyd'
- shiboken_src_path = "{site_packages_dir}".format(**vars)
- maybe_shiboken_names = [f for f in os.listdir(shiboken_src_path)
- if re.match(r'shiboken.*\.pyd', f)]
- if maybe_shiboken_names:
- shiboken_module_name = maybe_shiboken_names[0]
- vars.update({'shiboken_module_name': shiboken_module_name})
- copyfile(
- "{site_packages_dir}/{shiboken_module_name}",
- "{pyside_package_dir}/PySide2/{shiboken_module_name}",
- vars=vars)
- # @TODO: Fix this .pdb file not to overwrite release
- # {shibokengenerator}.pdb file.
- # Task-number: PYSIDE-615
- copydir(
- "{build_dir}/shiboken2/shibokenmodule",
- "{pyside_package_dir}/PySide2",
- filter=pdbs,
- recursive=False, vars=vars)
+ # <install>/lib/*.lib -> {st_package_name}/
+ copydir(
+ "{install_dir}/lib/",
+ "{st_build_dir}/{st_package_name}",
+ filter=["shiboken*.lib"],
+ recursive=False, vars=vars)
- # <install>/lib/site-packages/pyside2uic/* ->
- # <setup>/pyside2uic
- copydir(
- "{site_packages_dir}/pyside2uic",
- "{pyside_package_dir}/pyside2uic",
- force=False, vars=vars)
- if sys.version_info[0] > 2:
- rmtree("{pyside_package_dir}/pyside2uic/port_v2".format(**vars))
- else:
- rmtree("{pyside_package_dir}/pyside2uic/port_v3".format(**vars))
+ # @TODO: Fix this .pdb file not to overwrite release
+ # {shibokengenerator}.pdb file.
+ # Task-number: PYSIDE-615
+ copydir(
+ "{build_dir}/shiboken2/shibokenmodule",
+ "{st_build_dir}/{st_package_name}",
+ filter=pdbs,
+ recursive=False, vars=vars)
- # <install>/bin/pyside2-uic -> PySide2/scripts/uic.py
- makefile(
- "{pyside_package_dir}/PySide2/scripts/__init__.py",
- vars=vars)
- copyfile(
- "{install_dir}/bin/pyside2-uic",
- "{pyside_package_dir}/PySide2/scripts/uic.py",
- force=False, vars=vars)
+ # pdb files for libshiboken and libpyside
+ copydir(
+ "{build_dir}/shiboken2/libshiboken",
+ "{st_build_dir}/{st_package_name}",
+ filter=pdbs,
+ recursive=False, vars=vars)
- # <install>/bin/*.exe,*.dll,*.pdb -> PySide2/
- copydir(
- "{install_dir}/bin/",
- "{pyside_package_dir}/PySide2",
- filter=["*.exe", "*.dll"],
- recursive=False, vars=vars)
- # @TODO: Fix this .pdb file not to overwrite release
- # {shibokenmodule}.pdb file.
- # Task-number: PYSIDE-615
- copydir(
- "{build_dir}/shiboken2/generator",
- "{pyside_package_dir}/PySide2",
- filter=pdbs,
- recursive=False, vars=vars)
+ if config.is_internal_shiboken_generator_build():
+ # <install>/bin/*.dll -> {st_package_name}/
+ copydir(
+ "{install_dir}/bin/",
+ "{st_build_dir}/{st_package_name}",
+ filter=["shiboken*.exe"],
+ recursive=False, vars=vars)
- # <install>/lib/*.lib -> PySide2/
- copydir(
- "{install_dir}/lib/",
- "{pyside_package_dir}/PySide2",
- filter=["*.lib"],
- recursive=False, vars=vars)
+ # Used to create scripts directory.
+ makefile(
+ "{st_build_dir}/{st_package_name}/scripts/shiboken_tool.py",
+ vars=vars)
- # <install>/share/PySide2/typesystems/* ->
- # <setup>/PySide2/typesystems
- copydir(
- "{install_dir}/share/PySide2/typesystems",
- "{pyside_package_dir}/PySide2/typesystems",
- vars=vars)
+ # For setting up setuptools entry points.
+ copyfile(
+ "{install_dir}/bin/shiboken_tool.py",
+ "{st_build_dir}/{st_package_name}/scripts/shiboken_tool.py",
+ force=False, vars=vars)
+
+ # @TODO: Fix this .pdb file not to overwrite release
+ # {shibokenmodule}.pdb file.
+ # Task-number: PYSIDE-615
+ copydir(
+ "{build_dir}/shiboken2/generator",
+ "{st_build_dir}/{st_package_name}",
+ filter=pdbs,
+ recursive=False, vars=vars)
- # <install>/include/* -> <setup>/PySide2/include
- copydir(
- "{install_dir}/include",
- "{pyside_package_dir}/PySide2/include",
- vars=vars)
+ if config.is_internal_shiboken_generator_build() or config.is_internal_pyside_build():
+ # <install>/include/* -> <setup>/{st_package_name}/include
+ copydir(
+ "{install_dir}/include/{cmake_package_name}",
+ "{st_build_dir}/{st_package_name}/include",
+ vars=vars)
- # <source>/pyside2/PySide2/support/* ->
- # <setup>/PySide2/support/*
- copydir(
- "{build_dir}/pyside2/PySide2/support",
- "{pyside_package_dir}/PySide2/support",
- vars=vars)
+ if config.is_internal_pyside_build():
+ # <build>/pyside2/{st_package_name}/*.pdb ->
+ # <setup>/{st_package_name}
+ copydir(
+ "{build_dir}/pyside2/{st_package_name}",
+ "{st_build_dir}/{st_package_name}",
+ filter=pdbs,
+ recursive=False, vars=vars)
+
+ # <install>/lib/site-packages/pyside2uic/* ->
+ # <setup>/pyside2uic
+ copydir(
+ "{site_packages_dir}/pyside2uic",
+ "{st_build_dir}/pyside2uic",
+ force=False, vars=vars)
+ if sys.version_info[0] > 2:
+ rmtree("{st_build_dir}/pyside2uic/port_v2".format(**vars))
+ else:
+ rmtree("{st_build_dir}/pyside2uic/port_v3".format(**vars))
+
+ # <install>/bin/pyside2-uic -> {st_package_name}/scripts/uic.py
+ makefile(
+ "{st_build_dir}/{st_package_name}/scripts/__init__.py",
+ vars=vars)
+ copyfile(
+ "{install_dir}/bin/pyside2-uic",
+ "{st_build_dir}/{st_package_name}/scripts/uic.py",
+ force=False, vars=vars)
+
+ # For setting up setuptools entry points
+ copyfile(
+ "{install_dir}/bin/pyside_tool.py",
+ "{st_build_dir}/{st_package_name}/scripts/pyside_tool.py",
+ force=False, vars=vars)
+
+ # <install>/bin/*.exe,*.dll -> {st_package_name}/
+ copydir(
+ "{install_dir}/bin/",
+ "{st_build_dir}/{st_package_name}",
+ filter=["pyside*.exe", "pyside*.dll"],
+ recursive=False, vars=vars)
+
+ # <install>/lib/*.lib -> {st_package_name}/
+ copydir(
+ "{install_dir}/lib/",
+ "{st_build_dir}/{st_package_name}",
+ filter=["pyside*.lib"],
+ recursive=False, vars=vars)
- if not OPTION_NOEXAMPLES:
- # examples/* -> <setup>/PySide2/examples
- copydir(os.path.join(self.script_dir, "examples"),
- "{pyside_package_dir}/PySide2/examples",
+ # <install>/share/{st_package_name}/typesystems/* ->
+ # <setup>/{st_package_name}/typesystems
+ copydir(
+ "{install_dir}/share/{st_package_name}/typesystems",
+ "{st_build_dir}/{st_package_name}/typesystems",
+ vars=vars)
+
+ # <install>/share/{st_package_name}/glue/* ->
+ # <setup>/{st_package_name}/glue
+ copydir(
+ "{install_dir}/share/{st_package_name}/glue",
+ "{st_build_dir}/{st_package_name}/glue",
+ vars=vars)
+
+ # <source>/pyside2/{st_package_name}/support/* ->
+ # <setup>/{st_package_name}/support/*
+ copydir(
+ "{build_dir}/pyside2/{st_package_name}/support",
+ "{st_build_dir}/{st_package_name}/support",
+ vars=vars)
+
+ # <source>/pyside2/{st_package_name}/*.pyi ->
+ # <setup>/{st_package_name}/*.pyi
+ copydir(
+ "{build_dir}/pyside2/{st_package_name}",
+ "{st_build_dir}/{st_package_name}",
+ filter=["*.pyi"],
+ vars=vars)
+
+ copydir(
+ "{build_dir}/pyside2/libpyside",
+ "{st_build_dir}/{st_package_name}",
+ filter=pdbs,
+ recursive=False, vars=vars)
+
+ if not OPTION_NOEXAMPLES:
+ # examples/* -> <setup>/{st_package_name}/examples
+ copydir(os.path.join(self.script_dir, "examples"),
+ "{st_build_dir}/{st_package_name}/examples",
+ force=False, vars=vars)
+ # Re-generate examples Qt resource files for Python 3
+ # compatibility
+ if sys.version_info[0] == 3:
+ examples_path = "{st_build_dir}/{st_package_name}/examples".format(
+ **vars)
+ pyside_rcc_path = "{install_dir}/bin/pyside2-rcc".format(
+ **vars)
+ pyside_rcc_options = '-py3'
+ regenerate_qt_resources(examples_path, pyside_rcc_path,
+ pyside_rcc_options)
+
+ if vars['ssl_libs_dir']:
+ # <ssl_libs>/* -> <setup>/{st_package_name}/openssl
+ copydir("{ssl_libs_dir}", "{st_build_dir}/{st_package_name}/openssl",
+ filter=[
+ "libeay32.dll",
+ "ssleay32.dll"],
force=False, vars=vars)
- # Re-generate examples Qt resource files for Python 3
- # compatibility
- if sys.version_info[0] == 3:
- examples_path = "{pyside_package_dir}/PySide2/examples".format(
- **vars)
- pyside_rcc_path = "{install_dir}/bin/pyside2-rcc".format(
- **vars)
- pyside_rcc_options = '-py3'
- regenerate_qt_resources(examples_path, pyside_rcc_path,
- pyside_rcc_options)
-
- # <ssl_libs>/* -> <setup>/PySide2/openssl
- copydir("{ssl_libs_dir}", "{pyside_package_dir}/PySide2/openssl",
- filter=[
- "libeay32.dll",
- "ssleay32.dll"],
- force=False, vars=vars)
-
- # <qt>/bin/*.dll and Qt *.exe -> <setup>/PySide2
+
+ if config.is_internal_pyside_build() or config.is_internal_shiboken_generator_build():
+ copy_qt_artifacts(self, copy_pdbs, vars)
+
+
+def copy_qt_artifacts(self, copy_pdbs, vars):
+ built_modules = self.get_built_pyside_config(vars)['built_modules']
+
+ constrain_modules = None
+ copy_plugins = True
+ copy_qml = True
+ copy_translations = True
+ copy_qt_conf = True
+ copy_qt_permanent_artifacts = True
+ copy_msvc_redist = False
+ copy_clang = False
+
+ if config.is_internal_shiboken_generator_build():
+ constrain_modules = ["Core", "Network", "Xml", "XmlPatterns"]
+ copy_plugins = False
+ copy_qml = False
+ copy_translations = False
+ copy_qt_conf = False
+ copy_qt_permanent_artifacts = False
+ copy_msvc_redist = True
+ copy_clang = True
+
+ # <qt>/bin/*.dll and Qt *.exe -> <setup>/{st_package_name}
qt_artifacts_permanent = [
"opengl*.dll",
"d3d*.dll",
@@ -189,6 +282,7 @@ def prepare_packages_win32(self, vars):
"lconvert.exe",
"qtdiag.exe"
]
+
# MSVC redistributable
msvc_redist = [
"concrt140.dll",
@@ -212,8 +306,14 @@ def prepare_packages_win32(self, vars):
else:
egl_suffix = ''
qt_artifacts_egl = [a.format(egl_suffix) for a in qt_artifacts_egl]
- qt_artifacts_permanent += qt_artifacts_egl
- qt_artifacts_permanent += msvc_redist
+
+ artifacts = []
+ if copy_qt_permanent_artifacts:
+ artifacts += qt_artifacts_permanent
+ artifacts += qt_artifacts_egl
+
+ if copy_msvc_redist:
+ artifacts += msvc_redist
# Extract Qt dependency dll's when building on Qt CI
# There is no proper CI env variable, so using agent launch params
@@ -225,15 +325,22 @@ def prepare_packages_win32(self, vars):
zip_file = "pyside_qt_deps_32.7z"
download_and_extract_7z(redist_url + zip_file, "{qt_bin_dir}".format(**vars))
- copydir("{qt_bin_dir}", "{pyside_package_dir}/PySide2",
- filter=qt_artifacts_permanent,
- recursive=False, vars=vars)
+ if artifacts:
+ copydir("{qt_bin_dir}",
+ "{st_build_dir}/{st_package_name}",
+ filter=artifacts, recursive=False, vars=vars)
- # <qt>/bin/*.dll and Qt *.pdbs -> <setup>/PySide2 part two
+ # <qt>/bin/*.dll and Qt *.pdbs -> <setup>/{st_package_name} part two
# File filter to copy only debug or only release files.
- qt_dll_patterns = ["Qt5*{}.dll", "lib*{}.dll"]
- if copy_pdbs:
- qt_dll_patterns += ["Qt5*{}.pdb", "lib*{}.pdb"]
+ if constrain_modules:
+ qt_dll_patterns = ["Qt5" + x + "{}.dll" for x in constrain_modules]
+ if copy_pdbs:
+ qt_dll_patterns += ["Qt5" + x + "{}.pdb" for x in constrain_modules]
+ else:
+ qt_dll_patterns = ["Qt5*{}.dll", "lib*{}.dll"]
+ if copy_pdbs:
+ qt_dll_patterns += ["Qt5*{}.pdb", "lib*{}.pdb"]
+
def qt_build_config_filter(patterns, file_name, file_full_path):
release = [a.format('') for a in patterns]
debug = [a.format('d') for a in patterns]
@@ -283,56 +390,60 @@ def prepare_packages_win32(self, vars):
return False
qt_dll_filter = functools.partial(qt_build_config_filter,
- qt_dll_patterns)
- copydir("{qt_bin_dir}", "{pyside_package_dir}/PySide2",
- file_filter_function=qt_dll_filter,
- recursive=False, vars=vars)
-
- # <qt>/plugins/* -> <setup>/PySide2/plugins
- plugin_dll_patterns = ["*{}.dll"]
- pdb_pattern = "*{}.pdb"
- if copy_pdbs:
- plugin_dll_patterns += [pdb_pattern]
- plugin_dll_filter = functools.partial(qt_build_config_filter,
- plugin_dll_patterns)
- copydir("{qt_plugins_dir}", "{pyside_package_dir}/PySide2/plugins",
- file_filter_function=plugin_dll_filter,
- vars=vars)
+ qt_dll_patterns)
+ copydir("{qt_bin_dir}",
+ "{st_build_dir}/{st_package_name}",
+ file_filter_function=qt_dll_filter,
+ recursive=False, vars=vars)
- # <qt>/translations/* -> <setup>/PySide2/translations
- copydir("{qt_translations_dir}",
- "{pyside_package_dir}/PySide2/translations",
- filter=["*.qm", "*.pak"],
- force=False,
- vars=vars)
+ if copy_plugins:
+ # <qt>/plugins/* -> <setup>/{st_package_name}/plugins
+ plugin_dll_patterns = ["*{}.dll"]
+ pdb_pattern = "*{}.pdb"
+ if copy_pdbs:
+ plugin_dll_patterns += [pdb_pattern]
+ plugin_dll_filter = functools.partial(qt_build_config_filter,
+ plugin_dll_patterns)
+ copydir("{qt_plugins_dir}", "{st_build_dir}/{st_package_name}/plugins",
+ file_filter_function=plugin_dll_filter,
+ vars=vars)
- # <qt>/qml/* -> <setup>/PySide2/qml
- qml_dll_patterns = ["*{}.dll"]
- qml_ignore_patterns = qml_dll_patterns + [pdb_pattern]
- qml_ignore = [a.format('') for a in qml_ignore_patterns]
+ if copy_translations:
+ # <qt>/translations/* -> <setup>/{st_package_name}/translations
+ copydir("{qt_translations_dir}",
+ "{st_build_dir}/{st_package_name}/translations",
+ filter=["*.qm", "*.pak"],
+ force=False,
+ vars=vars)
- # Copy all files that are not dlls and pdbs (.qml, qmldir).
- copydir("{qt_qml_dir}", "{pyside_package_dir}/PySide2/qml",
- ignore=qml_ignore,
- force=False,
- recursive=True,
- vars=vars)
+ if copy_qml:
+ # <qt>/qml/* -> <setup>/{st_package_name}/qml
+ qml_dll_patterns = ["*{}.dll"]
+ qml_ignore_patterns = qml_dll_patterns + [pdb_pattern]
+ qml_ignore = [a.format('') for a in qml_ignore_patterns]
+
+ # Copy all files that are not dlls and pdbs (.qml, qmldir).
+ copydir("{qt_qml_dir}", "{st_build_dir}/{st_package_name}/qml",
+ ignore=qml_ignore,
+ force=False,
+ recursive=True,
+ vars=vars)
- if copy_pdbs:
- qml_dll_patterns += [pdb_pattern]
- qml_dll_filter = functools.partial(qt_build_config_filter,
- qml_dll_patterns)
+ if copy_pdbs:
+ qml_dll_patterns += [pdb_pattern]
+ qml_dll_filter = functools.partial(qt_build_config_filter,
+ qml_dll_patterns)
- # Copy all dlls (and possibly pdbs).
- copydir("{qt_qml_dir}", "{pyside_package_dir}/PySide2/qml",
- file_filter_function=qml_dll_filter,
- force=False,
- recursive=True,
- vars=vars)
+ # Copy all dlls (and possibly pdbs).
+ copydir("{qt_qml_dir}", "{st_build_dir}/{st_package_name}/qml",
+ file_filter_function=qml_dll_filter,
+ force=False,
+ recursive=True,
+ vars=vars)
if self.is_webengine_built(built_modules):
copydir("{qt_prefix_dir}/resources",
- "{pyside_package_dir}/PySide2/resources",
+ "{st_build_dir}/{st_package_name}/resources",
filter=None,
recursive=False,
vars=vars)
@@ -340,26 +451,16 @@ def prepare_packages_win32(self, vars):
filter = 'QtWebEngineProcess{}.exe'.format(
'd' if self.debug else '')
copydir("{qt_bin_dir}",
- "{pyside_package_dir}/PySide2",
+ "{st_build_dir}/{st_package_name}",
filter=[filter],
recursive=False, vars=vars)
- # Copy the qt.conf file to prefix dir.
- copyfile(
- "{build_dir}/pyside2/PySide2/qt.conf",
- "{pyside_package_dir}/PySide2",
- vars=vars)
-
- self.prepare_standalone_clang(is_win=True)
+ if copy_qt_conf:
+ # Copy the qt.conf file to prefix dir.
+ copyfile(
+ "{build_dir}/pyside2/{st_package_name}/qt.conf",
+ "{st_build_dir}/{st_package_name}",
+ vars=vars)
- # pdb files for libshiboken and libpyside
- copydir(
- "{build_dir}/shiboken2/libshiboken",
- "{pyside_package_dir}/PySide2",
- filter=pdbs,
- recursive=False, vars=vars)
- copydir(
- "{build_dir}/pyside2/libpyside",
- "{pyside_package_dir}/PySide2",
- filter=pdbs,
- recursive=False, vars=vars)
+ if copy_clang:
+ self.prepare_standalone_clang(is_win=True)
diff --git a/build_scripts/setup_runner.py b/build_scripts/setup_runner.py
new file mode 100644
index 00000000..8efb2883
--- /dev/null
+++ b/build_scripts/setup_runner.py
@@ -0,0 +1,167 @@
+#############################################################################
+##
+## Copyright (C) 2018 The Qt Company Ltd.
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of Qt for Python.
+##
+## $QT_BEGIN_LICENSE:LGPL$
+## Commercial License Usage
+## Licensees holding valid commercial Qt licenses may use this file in
+## accordance with the commercial license agreement provided with the
+## Software or, alternatively, in accordance with the terms contained in
+## a written agreement between you and The Qt Company. For licensing terms
+## and conditions see https://www.qt.io/terms-conditions. For further
+## information use the contact form at https://www.qt.io/contact-us.
+##
+## GNU Lesser General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU Lesser
+## General Public License version 3 as published by the Free Software
+## Foundation and appearing in the file LICENSE.LGPL3 included in the
+## packaging of this file. Please review the following information to
+## ensure the GNU Lesser General Public License version 3 requirements
+## will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+##
+## GNU General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU
+## General Public License version 2.0 or (at your option) the GNU General
+## Public license version 3 or any later version approved by the KDE Free
+## Qt Foundation. The licenses are as published by the Free Software
+## Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+## included in the packaging of this file. Please review the following
+## information to ensure the GNU General Public License requirements will
+## be met: https://www.gnu.org/licenses/gpl-2.0.html and
+## https://www.gnu.org/licenses/gpl-3.0.html.
+##
+## $QT_END_LICENSE$
+##
+#############################################################################
+
+import sys, os, textwrap
+
+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
+from build_scripts.options import OPTION_BUILD_TYPE, OPTION_INTERNAL_BUILD_TYPE
+from build_scripts.options import OPTION_QUIET
+from build_scripts.utils import run_process
+
+from setuptools import setup
+
+
+class SetupRunner(object):
+ def __init__(self, orig_argv):
+ self.invocations_list = []
+
+ # Keep the original args around in case we ever need to pass
+ # modified arguments to the sub invocations.
+ self.orig_argv = orig_argv
+ self.sub_argv = list(orig_argv)
+
+ self.setup_script_dir = os.getcwd()
+
+ @staticmethod
+ def cmd_line_argument_is_in_args(argument, args):
+ """ Check if command line argument was passed in args. """
+ return any(arg for arg in list(args) if "--" + argument in arg)
+
+ @staticmethod
+ def remove_cmd_line_argument_in_args(argument, args):
+ """ Remove command line argument from args. """
+ return [arg for arg in list(args) if "--" + argument not in arg]
+
+ @staticmethod
+ def construct_cmd_line_argument(name, value=None):
+ """ Constructs a command line argument given name and value. """
+ if not value:
+ return "--{}".format(name)
+ return "--{}={}".format(name, value)
+
+ @staticmethod
+ def construct_internal_build_type_cmd_line_argument(internal_build_type):
+ return SetupRunner.construct_cmd_line_argument("internal-build-type", internal_build_type)
+
+ def add_setup_internal_invocation(self, build_type, reuse_build=False):
+ """ Enqueues a script sub-invocation to be executed later. """
+ internal_build_type_arg = self.construct_internal_build_type_cmd_line_argument(build_type)
+ setup_cmd = [sys.executable] + self.sub_argv + [internal_build_type_arg]
+
+ # Add --reuse-build option if requested and not already present.
+ if reuse_build and not self.cmd_line_argument_is_in_args("reuse-build", self.sub_argv):
+ setup_cmd.append(self.construct_cmd_line_argument("reuse-build"))
+ self.invocations_list.append(setup_cmd)
+
+ def run_setup(self):
+ """
+ Decide what kind of build is requested and then execute it.
+ In the top-level invocation case, the script
+ will spawn setup.py again (possibly multiple times).
+ In the internal invocation case, the script
+ will run setuptools.setup().
+ """
+
+ # Prepare initial config.
+ config.init_config(build_type=OPTION_BUILD_TYPE,
+ internal_build_type=OPTION_INTERNAL_BUILD_TYPE,
+ cmd_class_dict=cmd_class_dict,
+ package_version=get_package_version(),
+ ext_modules=get_setuptools_extension_modules(),
+ setup_script_dir=self.setup_script_dir,
+ quiet=OPTION_QUIET)
+
+ # This is an internal invocation of setup.py, so start actual
+ # build.
+ if config.is_internal_invocation():
+ if config.internal_build_type not in config.get_allowed_internal_build_values():
+ raise RuntimeError("Invalid '{}' option given to --internal-build-type. "
+ .format(config.internal_build_type))
+ self.run_setuptools_setup()
+ return
+
+ # This is a top-level invocation of setup.py, so figure out what
+ # modules we will build and depending on that, call setup.py
+ # multiple times with different arguments.
+ if config.build_type not in config.get_allowed_top_level_build_values():
+ raise RuntimeError("Invalid '{}' option given to --build-type. "
+ .format(config.build_type))
+
+ # Build everything: shiboken2, shiboken2-generator and PySide2.
+ if config.is_top_level_build_all():
+ self.add_setup_internal_invocation(config.shiboken_module_option_name)
+
+ # Reuse the shiboken build for the generator package instead
+ # of rebuilding it again.
+ self.add_setup_internal_invocation(config.shiboken_generator_option_name,
+ reuse_build=True)
+
+ self.add_setup_internal_invocation(config.pyside_option_name)
+
+ elif config.is_top_level_build_shiboken_module():
+ self.add_setup_internal_invocation(config.shiboken_module_option_name)
+
+ elif config.is_top_level_build_shiboken_generator():
+ self.add_setup_internal_invocation(config.shiboken_generator_option_name)
+
+ elif config.is_top_level_build_pyside():
+ self.add_setup_internal_invocation(config.pyside_option_name)
+
+ for cmd in self.invocations_list:
+ cmd_as_string = " ".join(cmd)
+ print("\nRunning process: {}\n".format(cmd_as_string))
+ exit_code = run_process(cmd, redirect_stderr_to_stdout=False)
+ if exit_code != 0:
+ msg = textwrap.dedent("""
+ setup.py invocation failed with exit code: {}.\n\n
+ setup.py invocation was: {}
+ """).format(exit_code, cmd_as_string)
+ raise RuntimeError(msg)
+
+ @staticmethod
+ def run_setuptools_setup():
+ """
+ Runs setuptools.setup() once in a single setup.py
+ sub-invocation.
+ """
+
+ kwargs = config.setup_kwargs
+ setup(**kwargs)
diff --git a/build_scripts/utils.py b/build_scripts/utils.py
index 4c23a627..924b698d 100644
--- a/build_scripts/utils.py
+++ b/build_scripts/utils.py
@@ -39,17 +39,13 @@
import sys
import os
-import stat
import re
import stat
import errno
-import time
import shutil
import subprocess
import fnmatch
-import glob
import itertools
-import popenasync
import glob
# There is no urllib.request in Python2
@@ -58,11 +54,9 @@ try:
except ImportError:
import urllib
-from distutils import log
+import distutils.log as log
from distutils.errors import DistutilsOptionError
from distutils.errors import DistutilsSetupError
-from distutils.spawn import spawn
-from distutils.spawn import DistutilsExecError
try:
WindowsError
@@ -70,32 +64,6 @@ except NameError:
WindowsError = None
-def has_option(name):
- try:
- sys.argv.remove("--{}".format(name))
- return True
- except ValueError:
- pass
- return False
-
-
-def option_value(name):
- for index, option in enumerate(sys.argv):
- if option == '--' + name:
- if index+1 >= len(sys.argv):
- raise DistutilsOptionError("The option {} requires a "
- "value".format(option))
- value = sys.argv[index+1]
- sys.argv[index:index+2] = []
- return value
- if option.startswith('--' + name + '='):
- value = option[len(name)+3:]
- sys.argv[index:index+1] = []
- return value
- env_val = os.getenv(name.upper().replace('-', '_'))
- return env_val
-
-
def filter_match(name, patterns):
for pattern in patterns:
if pattern is None:
@@ -182,7 +150,6 @@ def find_vcdir(version):
"""
from distutils.msvc9compiler import VS_BASE
from distutils.msvc9compiler import Reg
- from distutils import log
vsbase = VS_BASE % version
try:
productdir = Reg.get_value(r"{}\Setup\VC".format(vsbase), "productdir")
@@ -304,7 +271,7 @@ def copyfile(src, dst, force=True, vars=None, force_copy_symlink=False,
if os.path.exists(link_name):
os.remove(link_name)
log.info("Symlinking {} -> {} in {}.".format(link_name,
- link_target, target_dir))
+ link_target, target_dir))
os.symlink(link_target, link_name)
except OSError:
log.error("{} -> {}: Error creating symlink".format(link_name,
@@ -355,8 +322,8 @@ def copydir(src, dst, filter=None, ignore=None, force=True, recursive=True,
"filter={}. ignore={}.".format(src, dst, filter, ignore))
return []
- log.info("Copying tree {} to {}. filter={}. ignore={}.".format(src, dst,
- filter, ignore))
+ log.info("Copying tree {} to {}. filter={}. ignore={}.".format(src,
+ dst, filter, ignore))
names = os.listdir(src)
@@ -416,13 +383,15 @@ def rmtree(dirname, ignore=False):
os.chmod(path, stat.S_IRWXU| stat.S_IRWXG| stat.S_IRWXO) # 0777
func(path)
else:
- raise
+ raise IOError
shutil.rmtree(dirname, ignore_errors=ignore, onerror=handle_remove_readonly)
def run_process_output(args, initial_env=None):
if initial_env is None:
initial_env = os.environ
- std_out = subprocess.Popen(args, env = initial_env, universal_newlines = 1,
+ std_out = subprocess.Popen(args,
+ env = initial_env,
+ universal_newlines = 1,
stdout=subprocess.PIPE).stdout
result = []
for raw_line in std_out.readlines():
@@ -430,54 +399,27 @@ def run_process_output(args, initial_env=None):
result.append(line.rstrip())
return result
-def run_process(args, initial_env=None):
- def _log(buffer, check_new_line=False):
- ends_with_new_line = False
- if buffer.endswith('\n'):
- ends_with_new_line = True
- if check_new_line and buffer.find('\n') == -1:
- return buffer
- lines = buffer.splitlines()
- buffer = ''
- if check_new_line and not ends_with_new_line:
- buffer = lines[-1]
- lines = lines[:-1]
- for line in lines:
- log.info(line.rstrip('\r'))
- return buffer
- _log("Running process in {0}: {1}".format(os.getcwd(),
- " ".join([(" " in x and '"{0}"'.format(x) or x) for x in args])))
-
- if sys.platform != "win32":
- try:
- spawn(args)
- return 0
- except DistutilsExecError:
- return -1
-
- shell = False
- if sys.platform == "win32":
- shell = True
+def run_process(args, initial_env=None, redirect_stderr_to_stdout=True):
+ """
+ Run process until completion and return the process exit code.
+ Prints both stdout and stderr to the console.
+ No output is captured.
+ """
+ log.info("Running process in directory {0}: command {1}".format(
+ os.getcwd(),
+ " ".join([(" " in x and '"{0}"'.format(x) or x) for x in args]))
+ )
if initial_env is None:
initial_env = os.environ
- proc = popenasync.Popen(args,
- stdin = subprocess.PIPE,
- stdout = subprocess.PIPE,
- stderr = subprocess.STDOUT,
- universal_newlines = 1,
- shell = shell,
- env = initial_env)
-
- log_buffer = None;
- while proc.poll() is None:
- log_buffer = _log(proc.read_async(wait=0.1, e=0))
- if log_buffer:
- _log(log_buffer)
+ kwargs = {}
+ kwargs['env'] = initial_env
+ if redirect_stderr_to_stdout:
+ kwargs['stderr'] = subprocess.STDOUT
- proc.wait()
- return proc.returncode
+ exit_code = subprocess.call(args, **kwargs)
+ return exit_code
def get_environment_from_batch_command(env_cmd, initial=None):
@@ -552,7 +494,7 @@ def regenerate_qt_resources(src, pyside_rcc_path, pyside_rcc_options):
dstname = '_rc.py'.join(srcname_split)
if os.path.exists(dstname):
log.info('Regenerating {} from {}'.format(dstname,
- os.path.basename(srcname)))
+ os.path.basename(srcname)))
run_process([pyside_rcc_path,
pyside_rcc_options,
srcname, '-o', dstname])
@@ -607,8 +549,7 @@ def back_tick(cmd, ret_err=False):
return out, err.strip(), retcode
-MACOS_OUTNAME_RE = re.compile(r'\(compatibility version [\d.]+, current version '
- '[\d.]+\)')
+MACOS_OUTNAME_RE = re.compile(r'\(compatibility version [\d.]+, current version [\d.]+\)')
def macos_get_install_names(libpath):
"""
@@ -665,6 +606,9 @@ def macos_get_rpaths(libpath):
ctr += 3
return rpaths
+def macos_add_rpath(rpath, library_path):
+ back_tick('install_name_tool -add_rpath {rpath} {library_path}'.format(
+ rpath=rpath, library_path=library_path))
def macos_fix_rpaths_for_library(library_path, qt_lib_dir):
""" Adds required rpath load commands to given library.
@@ -703,8 +647,7 @@ def macos_fix_rpaths_for_library(library_path, qt_lib_dir):
break
if needs_loader_path and "@loader_path" not in existing_rpath_commands:
- back_tick('install_name_tool -add_rpath {rpath} {library_path}'.format(
- rpath="@loader_path", library_path=library_path))
+ macos_add_rpath("@loader_path", library_path)
# If the library depends on a Qt library, add an rpath load comment
# pointing to the Qt lib directory.
@@ -738,8 +681,7 @@ def macos_add_qt_rpath(library_path, qt_lib_dir,
break
if needs_qt_rpath:
- back_tick('install_name_tool -add_rpath {rpath} {library_path}'.format(
- rpath=qt_lib_dir, library_path=library_path))
+ macos_add_rpath(qt_lib_dir, library_path)
# Find an executable specified by a glob pattern ('foo*') in the OS path
def find_glob_in_path(pattern):
@@ -754,7 +696,7 @@ def find_glob_in_path(pattern):
# Locate the most recent version of llvm_config in the path.
def find_llvm_config():
- version_re = re.compile('(\d+)\.(\d+)\.(\d+)')
+ version_re = re.compile(r'(\d+)\.(\d+)\.(\d+)')
result = None
last_version_string = '000000'
for llvm_config in find_glob_in_path('llvm-config*'):
@@ -996,6 +938,17 @@ def copy_icu_libs(patchelf, destination_lib_dir):
new_rpaths_string = ":".join(rpaths)
linux_set_rpaths(patchelf, qt_core_library_path, new_rpaths_string)
+
+def linux_run_read_elf(executable_path):
+ cmd = "readelf -d {}".format(executable_path)
+ (out, err, code) = back_tick(cmd, True)
+ if code != 0:
+ raise RuntimeError("Running `readelf -d {}` failed with error "
+ "output:\n {}. ".format(executable_path, err))
+ lines = split_and_strip(out)
+ return lines
+
+
def linux_set_rpaths(patchelf, executable_path, rpath_string):
""" Patches the `executable_path` with a new rpath string. """
@@ -1005,18 +958,32 @@ def linux_set_rpaths(patchelf, executable_path, rpath_string):
raise RuntimeError("Error patching rpath in {}".format(
executable_path))
+
+def linux_get_dependent_libraries(executable_path):
+ """
+ Returns a list of libraries that executable_path depends on.
+ """
+
+ lines = linux_run_read_elf(executable_path)
+ pattern = re.compile(r"^.+?\(NEEDED\).+?\[(.+?)\]$")
+
+ library_lines = []
+ for line in lines:
+ match = pattern.search(line)
+ if match:
+ library_line = match.group(1)
+ library_lines.append(library_line)
+
+ return library_lines
+
+
def linux_get_rpaths(executable_path):
"""
Returns a list of run path values embedded in the executable or just
an empty list.
"""
- cmd = "readelf -d {}".format(executable_path)
- (out, err, code) = back_tick(cmd, True)
- if code != 0:
- raise RuntimeError("Running `readelf -d {}` failed with error "
- "output:\n {}. ".format(executable_path, err))
- lines = split_and_strip(out)
+ lines = linux_run_read_elf(executable_path)
pattern = re.compile(r"^.+?\(RUNPATH\).+?\[(.+?)\]$")
rpath_line = None
@@ -1033,6 +1000,7 @@ def linux_get_rpaths(executable_path):
return rpaths
+
def rpaths_has_origin(rpaths):
"""
Return True if the specified list of rpaths has an "$ORIGIN" value
@@ -1048,6 +1016,39 @@ def rpaths_has_origin(rpaths):
return True
return False
+
+def linux_needs_qt_rpath(executable_path):
+ """
+ Returns true if library_path depends on Qt libraries.
+ """
+
+ dependencies = linux_get_dependent_libraries(executable_path)
+
+ # Check if any library dependencies are Qt libraries (hacky).
+ needs_qt_rpath = False
+ for dep in dependencies:
+ if 'Qt' in dep:
+ needs_qt_rpath = True
+ break
+ return needs_qt_rpath
+
+
+def linux_fix_rpaths_for_library(patchelf, executable_path, qt_rpath, override=False):
+ """
+ Adds or overrides required rpaths in given executable / library.
+ """
+ rpaths = ['$ORIGIN/']
+ existing_rpaths = []
+ if not override:
+ existing_rpaths = linux_get_rpaths(executable_path)
+ rpaths.extend(existing_rpaths)
+
+ if linux_needs_qt_rpath(executable_path) and qt_rpath not in existing_rpaths:
+ rpaths.append(qt_rpath)
+
+ rpaths_string = ':'.join(rpaths)
+ linux_set_rpaths(patchelf, executable_path, rpaths_string)
+
def memoize(function):
"""
Decorator to wrap a function with a memoizing callable.
@@ -1076,9 +1077,27 @@ def get_python_dict(python_script_path):
"file: {}.".format(python_script_path))
raise
-def install_pip_dependencies(env_pip, packages):
+def install_pip_wheel_package(env_pip):
+ # Need to install an unreleased wheel version, due to a bug that
+ # will generate a wheel which will not be installable.
+ # See https://github.com/pypa/wheel/issues/263
+ wheel_url = "git+https://github.com/pypa/wheel.git@fbf3e3ada64d36ca7bb9c1422f5a1ccdba7e4dcf"
+ install_pip_package_from_url_specifier(env_pip, wheel_url)
+
+def install_pip_package_from_url_specifier(env_pip, url, upgrade=True):
+ args = [env_pip, "install", url]
+ if upgrade:
+ args.append("--upgrade")
+ args.append(url)
+ run_instruction(args, "Failed to install {}".format(url))
+
+def install_pip_dependencies(env_pip, packages, upgrade=True):
for p in packages:
- run_instruction([env_pip, "install", p], "Failed to install " + p)
+ args = [env_pip, "install"]
+ if upgrade:
+ args.append("--upgrade")
+ args.append(p)
+ run_instruction(args, "Failed to install " + p)
def get_qtci_virtualEnv(python_ver, host, hostArch, targetArch):
_pExe = "python"
@@ -1105,16 +1124,18 @@ def get_qtci_virtualEnv(python_ver, host, hostArch, targetArch):
_pExe = "python3"
return(_pExe, _env, env_pip, env_python)
-def run_instruction(instruction, error):
+def run_instruction(instruction, error, initial_env=None):
+ if initial_env is None:
+ initial_env = os.environ
print("Running Coin instruction: " + ' '.join(str(e) for e in instruction))
- result = subprocess.call(instruction)
+ result = subprocess.call(instruction, env=initial_env)
if result != 0:
print("ERROR : " + error)
exit(result)
def acceptCITestConfiguration(hostOS, hostOSVer, targetArch, compiler):
# Disable unsupported CI configs for now
- # NOTE: String must match with QT CI's storagesturct thrift
+ # NOTE: String must match with QT CI's storagestruct thrift
if hostOSVer in ["WinRT_10"]:
print("Disabled " + hostOSVer + " from Coin configuration")
return False
@@ -1124,3 +1145,13 @@ def acceptCITestConfiguration(hostOS, hostOSVer, targetArch, compiler):
print("Disabled " + compiler + " to " + targetArch + " from Coin configuration")
return False
return True
+
+
+def get_ci_qmake_path(ci_install_dir, ci_host_os):
+ qmake_path = "--qmake={}".format(ci_install_dir)
+ if ci_host_os == "MacOS":
+ return qmake_path + "/bin/qmake"
+ elif ci_host_os == "Windows":
+ return qmake_path + "\\bin\\qmake.exe"
+ else:
+ return qmake_path + "/bin/qmake"
diff --git a/coin_build_instructions.py b/coin_build_instructions.py
index aee0bf26..969b9272 100644
--- a/coin_build_instructions.py
+++ b/coin_build_instructions.py
@@ -36,14 +36,16 @@
## $QT_END_LICENSE$
##
#############################################################################
-from build_scripts.utils import has_option
-from build_scripts.utils import option_value
+from build_scripts.options import has_option
+from build_scripts.options import option_value
from build_scripts.utils import install_pip_dependencies
+from build_scripts.utils import install_pip_wheel_package
from build_scripts.utils import get_qtci_virtualEnv
from build_scripts.utils import run_instruction
from build_scripts.utils import rmtree
from build_scripts.utils import get_python_dict
from build_scripts.utils import acceptCITestConfiguration
+from build_scripts.utils import get_ci_qmake_path
import os
# Values must match COIN thrift
@@ -98,21 +100,19 @@ def call_setup(python_ver):
_pExe, _env, env_pip, env_python = get_qtci_virtualEnv(python_ver, CI_HOST_OS, CI_HOST_ARCH, CI_TARGET_ARCH)
rmtree(_env, True)
run_instruction(["virtualenv", "-p", _pExe, _env], "Failed to create virtualenv")
- install_pip_dependencies(env_pip, ["six", "wheel"])
- cmd = [env_python, "setup.py"]
+
+ install_pip_dependencies(env_pip, ["six", "setuptools"])
+ install_pip_wheel_package(env_pip)
+
+ cmd = [env_python, "-u", "setup.py"]
if CI_RELEASE_CONF:
cmd += ["bdist_wheel", "--standalone"]
else:
cmd += ["build"]
- if CI_HOST_OS == "MacOS":
- cmd += ["--qmake=" + CI_ENV_INSTALL_DIR + "/bin/qmake"]
- elif CI_HOST_OS == "Windows":
-
- cmd += ["--qmake=" + CI_ENV_INSTALL_DIR + "\\bin\\qmake.exe"]
- else:
- cmd += ["--qmake=" + CI_ENV_INSTALL_DIR + "/bin/qmake"]
+ qmake_path = get_ci_qmake_path(CI_ENV_INSTALL_DIR, CI_HOST_OS)
+ cmd.append(qmake_path)
cmd += ["--build-tests",
- "--jobs=4",
+ "--parallel=4",
"--verbose-build"]
if python_ver == "3":
cmd += ["--limited-api=yes"]
@@ -121,7 +121,23 @@ def call_setup(python_ver):
cmd += ["--package-timestamp=" + CI_INTEGRATION_ID]
- run_instruction(cmd, "Failed to run setup.py")
+ env = os.environ
+ if CI_HOST_OS == "MacOS":
+ # On Python 3, setuptools.dist.handle_display_options does some
+ # weird sys.stdout.detach-ing if the stdout encoding is
+ # different from utf-8. This causes issues when running
+ # subprocess.call() because that access the original stdout
+ # object stored in sys.__stdout__ which was detached, and
+ # results in an exception being thrown.
+ # The Coin macOS locale by default is US-ASCII, and that
+ # triggers the above issue. Set the encoding to UTF-8 which
+ # makes sure to skip over the detach-ing code.
+ # Relevant links to the issue:
+ # https://bugs.python.org/issue15216
+ # https://bitbucket.org/tarek/distribute/issues/334/fix-for-311-breaks-packages-that-use
+ # https://github.com/pypa/virtualenv/issues/359
+ env['LC_CTYPE'] = 'UTF-8'
+ run_instruction(cmd, "Failed to run setup.py", initial_env=env)
def run_build_instructions():
if not acceptCITestConfiguration(CI_HOST_OS, CI_HOST_OS_VER, CI_TARGET_ARCH, CI_COMPILER):
diff --git a/coin_test_instructions.py b/coin_test_instructions.py
index bd65b5b7..4121bb55 100644
--- a/coin_test_instructions.py
+++ b/coin_test_instructions.py
@@ -36,13 +36,15 @@
## $QT_END_LICENSE$
##
#############################################################################
-from build_scripts.utils import has_option
-from build_scripts.utils import option_value
+from build_scripts.options import has_option
+from build_scripts.options import option_value
from build_scripts.utils import install_pip_dependencies
+from build_scripts.utils import install_pip_wheel_package
from build_scripts.utils import get_qtci_virtualEnv
from build_scripts.utils import run_instruction
from build_scripts.utils import rmtree
from build_scripts.utils import acceptCITestConfiguration
+from build_scripts.utils import get_ci_qmake_path
import os
# Values must match COIN thrift
@@ -66,12 +68,21 @@ 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)
run_instruction(["virtualenv", "-p", _pExe, _env], "Failed to create virtualenv")
- install_pip_dependencies(env_pip, ["six", "wheel"])
+ install_pip_dependencies(env_pip, ["six", "setuptools"])
+ install_pip_wheel_package(env_pip)
cmd = [env_python, "testrunner.py", "test",
"--blacklist", "build_history/blacklist.txt",
"--buildno=" + buildnro]
run_instruction(cmd, "Failed to run testrunner.py")
+ qmake_path = get_ci_qmake_path(CI_ENV_INSTALL_DIR, CI_HOST_OS)
+
+ # Try to install built wheels, and build some buildable examples.
+ if CI_RELEASE_CONF:
+ wheel_tester_path = os.path.join("testing", "wheel_tester.py")
+ cmd = [env_python, wheel_tester_path, qmake_path]
+ run_instruction(cmd, "Error while running wheel_tester.py")
+
def run_test_instructions():
if not acceptCITestConfiguration(CI_HOST_OS, CI_HOST_OS_VER, CI_TARGET_ARCH, CI_COMPILER):
exit()
diff --git a/docs/building/options.rst b/docs/building/options.rst
index 71e7f6a5..63489f80 100644
--- a/docs/building/options.rst
+++ b/docs/building/options.rst
@@ -89,7 +89,7 @@ Options
``--no-examples``
Don't include PySide examples in PySide distribution
-``--jobs``
+``--parallel``
Specify the number of parallel build jobs
``--jom``
diff --git a/examples/opengl/hellogl2.py b/examples/opengl/hellogl2.py
index e1af6f2a..b8d1c0e7 100755
--- a/examples/opengl/hellogl2.py
+++ b/examples/opengl/hellogl2.py
@@ -52,7 +52,7 @@ from PySide2.QtGui import (QVector3D, QOpenGLFunctions, QOpenGLVertexArrayObject
QOpenGLShaderProgram, QMatrix4x4, QOpenGLShader, QOpenGLContext, QSurfaceFormat)
from PySide2.QtWidgets import (QApplication, QWidget, QMessageBox, QHBoxLayout, QSlider,
QOpenGLWidget)
-from PySide2.shiboken2 import VoidPtr
+from shiboken2 import VoidPtr
try:
from OpenGL import GL
diff --git a/examples/samplebinding/CMakeLists.txt b/examples/samplebinding/CMakeLists.txt
index 03ab8575..3852ed36 100644
--- a/examples/samplebinding/CMakeLists.txt
+++ b/examples/samplebinding/CMakeLists.txt
@@ -40,7 +40,11 @@ set(generated_sources
# ================================== 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.
@@ -52,7 +56,8 @@ macro(pyside2_config option output_var)
endif()
execute_process(
- COMMAND python "${CMAKE_SOURCE_DIR}/../utils/pyside2_config.py" ${option}
+ COMMAND ${python_interpreter} "${CMAKE_SOURCE_DIR}/../utils/pyside2_config.py"
+ ${option}
OUTPUT_VARIABLE ${output_var}
OUTPUT_STRIP_TRAILING_WHITESPACE)
@@ -64,14 +69,15 @@ macro(pyside2_config option output_var)
endif()
endmacro()
-# Query for the shiboken path, Python path, include paths and linker flags.
-pyside2_config(--pyside2 pyside2_path)
-pyside2_config(--python-include python_include_dir)
-pyside2_config(--shiboken-include shiboken_include_dir 1)
-pyside2_config(--shiboken-shared-libraries-cmake shiboken_shared_libraries 0)
-pyside2_config(--python-link-cmake python_linking_data 0)
+# 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(--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)
-set(shiboken_path "${pyside2_path}/shiboken2${CMAKE_EXECUTABLE_SUFFIX}")
+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()
@@ -87,7 +93,7 @@ endif()
# 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 ${pyside2_path} ${CMAKE_CURRENT_SOURCE_DIR})
+set(CMAKE_INSTALL_RPATH ${shiboken2_module_path} ${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# =============================================================================================
# !!! End of dubious section.
diff --git a/examples/scriptableapplication/CMakeLists.txt b/examples/scriptableapplication/CMakeLists.txt
index 4119b675..99920642 100644
--- a/examples/scriptableapplication/CMakeLists.txt
+++ b/examples/scriptableapplication/CMakeLists.txt
@@ -12,7 +12,13 @@ project(scriptableapplication)
set(CMAKE_CXX_STANDARD 11)
# Find required Qt packages.
-find_package(Qt5 5.9 REQUIRED COMPONENTS Core Gui Widgets)
+find_package(Qt5 5.12 REQUIRED COMPONENTS Core Gui Widgets)
+
+# 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.
macro(pyside2_config option output_var)
@@ -23,7 +29,8 @@ macro(pyside2_config option output_var)
endif()
execute_process(
- COMMAND python "${CMAKE_SOURCE_DIR}/../utils/pyside2_config.py" ${option}
+ COMMAND ${python_interpreter} "${CMAKE_SOURCE_DIR}/../utils/pyside2_config.py"
+ ${option}
OUTPUT_VARIABLE ${output_var}
OUTPUT_STRIP_TRAILING_WHITESPACE)
@@ -35,14 +42,20 @@ macro(pyside2_config option output_var)
endif()
endmacro()
-# Query for the PySide2 path, Python path, include paths and linker flags.
-pyside2_config(--pyside2 PYSIDE2_PATH)
-pyside2_config(--python-include PYTHON_INCLUDE_DIR)
-pyside2_config(--pyside2-include PYSIDE2_INCLUDE_DIR 1)
+# Query for the shiboken2-generator path, PySide2 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(--python-include-path PYTHON_INCLUDE_DIR)
+pyside2_config(--shiboken2-generator-include-path SHIBOKEN2_GENERATOR_INCLUDE_DIR 1)
+pyside2_config(--pyside2-include-path PYSIDE2_INCLUDE_DIR 1)
+
+pyside2_config(--python-link-flags-cmake PYTHON_LINKING_DATA 0)
+pyside2_config(--shiboken2-module-shared-libraries-cmake SHIBOKEN2_MODULE_SHARED_LIBRARIES 0)
pyside2_config(--pyside2-shared-libraries-cmake PYSIDE2_SHARED_LIBRARIES 0)
-pyside2_config(--python-link-cmake PYTHON_LINKING_DATA 0)
-set(SHIBOKEN_PATH "${PYSIDE2_PATH}/shiboken2${CMAKE_EXECUTABLE_SUFFIX}")
+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}")
@@ -122,7 +135,7 @@ endforeach()
# Enable rpaths so that the example can be executed from the build dir.
set(CMAKE_SKIP_BUILD_RPATH FALSE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
-set(CMAKE_INSTALL_RPATH ${PYSIDE2_PATH})
+set(CMAKE_INSTALL_RPATH ${PYSIDE2_PATH} ${SHIBOKEN2_MODULE_PATH})
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# =============================================================================================
# !!! End of dubious section.
@@ -139,11 +152,13 @@ target_sources(${PROJECT_NAME} PUBLIC ${SOURCES})
# Apply relevant include and link flags.
target_include_directories(${PROJECT_NAME} PRIVATE ${PYTHON_INCLUDE_DIR})
+target_include_directories(${PROJECT_NAME} PRIVATE ${SHIBOKEN2_GENERATOR_INCLUDE_DIR})
target_include_directories(${PROJECT_NAME} PRIVATE ${PYSIDE2_INCLUDE_DIR})
target_include_directories(${PROJECT_NAME} PRIVATE ${PYSIDE2_ADDITIONAL_INCLUDES})
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR})
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Widgets)
+target_link_libraries(${PROJECT_NAME} PRIVATE ${SHIBOKEN2_MODULE_SHARED_LIBRARIES})
target_link_libraries(${PROJECT_NAME} PRIVATE ${PYSIDE2_SHARED_LIBRARIES})
# Find and link to the python library.
@@ -176,7 +191,8 @@ if(WIN32)
# Add custom target to hard link PySide2 shared libraries (just like in qmake example), so you
# don't have to set PATH manually to point to the PySide2 package.
- foreach(LIBRARY_PATH ${PYSIDE2_SHARED_LIBRARIES})
+ set(shared_libraries ${SHIBOKEN2_MODULE_SHARED_LIBRARIES} ${PYSIDE2_SHARED_LIBRARIES})
+ foreach(LIBRARY_PATH ${shared_libraries})
string(REGEX REPLACE ".lib$" ".dll" LIBRARY_PATH ${LIBRARY_PATH})
get_filename_component(BASE_NAME ${LIBRARY_PATH} NAME)
file(TO_NATIVE_PATH ${LIBRARY_PATH} SOURCE_PATH)
diff --git a/examples/scriptableapplication/pyside2.pri b/examples/scriptableapplication/pyside2.pri
index 17be4392..2da3bc88 100644
--- a/examples/scriptableapplication/pyside2.pri
+++ b/examples/scriptableapplication/pyside2.pri
@@ -1,30 +1,52 @@
PYSIDE_CONFIG = $$PWD/../utils/pyside2_config.py
-PYSIDE2 = $$system(python $$PYSIDE_CONFIG --pyside2)
+# Use provided python interpreter if given.
+isEmpty(python_interpreter) {
+ python_interpreter = python
+}
+message(Using python interpreter: $$python_interpreter)
+
+SHIBOKEN2_GENERATOR = $$system($$python_interpreter $$PYSIDE_CONFIG --shiboken2-generator-path)
+isEmpty(SHIBOKEN2_GENERATOR): error(Unable to locate the shiboken2-generator package location)
+
+SHIBOKEN2_MODULE = $$system($$python_interpreter $$PYSIDE_CONFIG --shiboken2-module-path)
+isEmpty(SHIBOKEN2_MODULE): error(Unable to locate the shiboken2 package location)
+
+PYSIDE2 = $$system($$python_interpreter $$PYSIDE_CONFIG --pyside2-path)
isEmpty(PYSIDE2): error(Unable to locate the PySide2 package location)
-PYTHON_INCLUDE = $$system(python $$PYSIDE_CONFIG --python-include)
+PYTHON_INCLUDE = $$system($$python_interpreter $$PYSIDE_CONFIG --python-include-path)
isEmpty(PYTHON_INCLUDE): error(Unable to locate the Python include headers directory)
-PYTHON_LFLAGS = $$system(python $$PYSIDE_CONFIG --python-link)
+PYTHON_LFLAGS = $$system($$python_interpreter $$PYSIDE_CONFIG --python-link-flags-qmake)
isEmpty(PYTHON_LFLAGS): error(Unable to locate the Python library for linking)
-PYSIDE2_INCLUDE = $$system(python $$PYSIDE_CONFIG --pyside2-include)
+SHIBOKEN2_INCLUDE = $$system($$python_interpreter $$PYSIDE_CONFIG --shiboken2-generator-include-path)
+isEmpty(SHIBOKEN2_INCLUDE): error(Unable to locate the shiboken include headers directory)
+
+PYSIDE2_INCLUDE = $$system($$python_interpreter $$PYSIDE_CONFIG --pyside2-include-path)
isEmpty(PYSIDE2_INCLUDE): error(Unable to locate the PySide2 include headers directory)
-PYSIDE2_LFLAGS = $$system(python $$PYSIDE_CONFIG --pyside2-link)
+SHIBOKEN2_LFLAGS = $$system($$python_interpreter $$PYSIDE_CONFIG --shiboken2-module-qmake-lflags)
+isEmpty(SHIBOKEN2_LFLAGS): error(Unable to locate the shiboken libraries for linking)
+
+PYSIDE2_LFLAGS = $$system($$python_interpreter $$PYSIDE_CONFIG --pyside2-qmake-lflags)
isEmpty(PYSIDE2_LFLAGS): error(Unable to locate the PySide2 libraries for linking)
-PYSIDE2_SHARED_LIBRARIES = $$system(python $$PYSIDE_CONFIG --pyside2-shared-libraries)
+SHIBOKEN2_SHARED_LIBRARIES = $$system($$python_interpreter $$PYSIDE_CONFIG --shiboken2-module-shared-libraries-qmake)
+isEmpty(SHIBOKEN2_SHARED_LIBRARIES): error(Unable to locate the used shiboken2 module shared libraries)
+
+PYSIDE2_SHARED_LIBRARIES = $$system($$python_interpreter $$PYSIDE_CONFIG --pyside2-shared-libraries-qmake)
isEmpty(PYSIDE2_SHARED_LIBRARIES): error(Unable to locate the used PySide2 shared libraries)
-INCLUDEPATH += "$$PYTHON_INCLUDE" $$PYSIDE2_INCLUDE
-LIBS += $$PYTHON_LFLAGS $$PYSIDE2_LFLAGS
+INCLUDEPATH += "$$PYTHON_INCLUDE" $$PYSIDE2_INCLUDE $$SHIBOKEN2_INCLUDE
+LIBS += $$PYTHON_LFLAGS $$PYSIDE2_LFLAGS $$SHIBOKEN2_LFLAGS
!build_pass:message(INCLUDEPATH is $$INCLUDEPATH)
!build_pass:message(LIBS are $$LIBS)
!build_pass:message(Using $$PYSIDE2)
!win32 {
- QMAKE_RPATHDIR += $$PYSIDE2
+ !build_pass:message(RPATH will include $$PYSIDE2 and $$SHIBOKEN2_MODULE)
+ QMAKE_RPATHDIR += $$PYSIDE2 $$SHIBOKEN2_MODULE
}
diff --git a/examples/scriptableapplication/scriptableapplication.pro b/examples/scriptableapplication/scriptableapplication.pro
index 8a09b0ab..8ebab947 100644
--- a/examples/scriptableapplication/scriptableapplication.pro
+++ b/examples/scriptableapplication/scriptableapplication.pro
@@ -23,7 +23,7 @@ SHIBOKEN_OPTIONS = --generator-set=shiboken --enable-parent-ctor-heuristic \
win32:SHIBOKEN_OPTIONS += --avoid-protected-hack
# Prepare the shiboken tool
-QT_TOOL.shiboken.binary = $$system_path($$PYSIDE2/shiboken2)
+QT_TOOL.shiboken.binary = $$system_path($$SHIBOKEN2_GENERATOR/shiboken2)
qtPrepareTool(SHIBOKEN, shiboken)
# Shiboken run that adds the module wrapper to GENERATED_SOURCES
@@ -61,7 +61,7 @@ win32 {
hard_link_libraries.CONFIG = no_link target_predeps explicit_dependencies
hard_link_libraries.output = $$out_dir/${QMAKE_FILE_BASE}${QMAKE_FILE_EXT}
hard_link_libraries.commands = mklink /H $$shell_path($$out_dir/${QMAKE_FILE_BASE}${QMAKE_FILE_EXT}) $$shell_path(${QMAKE_FILE_IN})
- hard_link_libraries.input = PYSIDE2_SHARED_LIBRARIES
+ hard_link_libraries.input = PYSIDE2_SHARED_LIBRARIES SHIBOKEN2_SHARED_LIBRARIES
}
QMAKE_EXTRA_COMPILERS += shiboken module_wrapper_dummy_command
diff --git a/examples/utils/pyside2_config.py b/examples/utils/pyside2_config.py
index 298d40d5..c62b38ca 100644
--- a/examples/utils/pyside2_config.py
+++ b/examples/utils/pyside2_config.py
@@ -38,28 +38,106 @@
##
#############################################################################
-import os, glob, re, sys, imp
+import os, glob, re, sys
from distutils import sysconfig
+generic_error = (' Did you forget to activate your virtualenv? Or perhaps'
+ ' you forgot to build / install PySide2 into your currently active Python'
+ ' environment?')
+pyside2_error = 'Unable to locate PySide2.' + generic_error
+shiboken2_module_error = 'Unable to locate shiboken2-module.' + generic_error
+shiboken2_generator_error = 'Unable to locate shiboken2-generator.' + generic_error
+pyside2_libs_error = 'Unable to locate the PySide2 shared libraries.' + generic_error
+python_link_error = 'Unable to locate the Python library for linking.'
+python_include_error = 'Unable to locate the Python include headers directory.'
+
+options = []
+
+# option, function, error, description
+options.append(("--shiboken2-module-path",
+ lambda: find_shiboken2_module(),
+ shiboken2_module_error,
+ "Print shiboken2 module location"))
+options.append(("--shiboken2-generator-path",
+ lambda: find_shiboken2_generator(),
+ shiboken2_generator_error,
+ "Print shiboken2 generator location"))
+options.append(("--pyside2-path", lambda: find_pyside2(), pyside2_error,
+ "Print PySide2 location"))
+
+options.append(("--python-include-path",
+ lambda: get_python_include_path(),
+ python_include_error,
+ "Print Python include path"))
+options.append(("--shiboken2-generator-include-path",
+ lambda: get_package_include_path(Package.shiboken2_generator),
+ pyside2_error,
+ "Print shiboken2 generator include paths"))
+options.append(("--pyside2-include-path",
+ lambda: get_package_include_path(Package.pyside2),
+ pyside2_error,
+ "Print PySide2 include paths"))
+
+options.append(("--python-link-flags-qmake", lambda: python_link_flags_qmake(), python_link_error,
+ "Print python link flags for qmake"))
+options.append(("--python-link-flags-cmake", lambda: python_link_flags_cmake(), python_link_error,
+ "Print python link flags for cmake"))
+
+options.append(("--shiboken2-module-qmake-lflags",
+ lambda: get_package_qmake_lflags(Package.shiboken2_module), pyside2_error,
+ "Print shiboken2 shared library link flags for qmake"))
+options.append(("--pyside2-qmake-lflags",
+ lambda: get_package_qmake_lflags(Package.pyside2), pyside2_error,
+ "Print PySide2 shared library link flags for qmake"))
+
+options.append(("--shiboken2-module-shared-libraries-qmake",
+ lambda: get_shared_libraries_qmake(Package.shiboken2_module), pyside2_libs_error,
+ "Print paths of shiboken2 shared libraries (.so's, .dylib's, .dll's) for qmake"))
+options.append(("--shiboken2-module-shared-libraries-cmake",
+ lambda: get_shared_libraries_cmake(Package.shiboken2_module), pyside2_libs_error,
+ "Print paths of shiboken2 shared libraries (.so's, .dylib's, .dll's) for cmake"))
+
+options.append(("--pyside2-shared-libraries-qmake",
+ lambda: get_shared_libraries_qmake(Package.pyside2), pyside2_libs_error,
+ "Print paths of PySide2 shared libraries (.so's, .dylib's, .dll's) for qmake"))
+options.append(("--pyside2-shared-libraries-cmake",
+ lambda: get_shared_libraries_cmake(Package.pyside2), pyside2_libs_error,
+ "Print paths of PySide2 shared libraries (.so's, .dylib's, .dll's) for cmake"))
+
+options_usage = ''
+for i, (flag, _, _, description) in enumerate(options):
+ options_usage += ' {:<45} {}'.format(flag, description)
+ if i < len(options) - 1:
+ options_usage += '\n'
+
usage = """
-Utility to determine include/link options of PySide2 and Python for qmake
+Utility to determine include/link options of shiboken2/PySide2 and Python for qmake/CMake projects
+that would like to embed or build custom shiboken2/PySide2 bindings.
Usage: pyside2_config.py [option]
Options:
- --python-include Print Python include path
- --python-link Print Python link flags
- --pyside2 Print PySide2 location
- --pyside2-include Print PySide2 include paths
- --pyside2-link Print PySide2 link flags
- --pyside2-shared-libraries Print paths of PySide2 shared libraries (.so's, .dylib's, .dll's)
- -a Print all
- --help/-h Print this help
-"""
-
-def cleanPath(path):
+{}
+ -a Print all options and their values
+ --help/-h Print this help
+""".format(options_usage)
+
+option = sys.argv[1] if len(sys.argv) == 2 else '-a'
+if option == '-h' or option == '--help':
+ print(usage)
+ sys.exit(0)
+
+
+class Package(object):
+ shiboken2_module = 1
+ shiboken2_generator = 2
+ pyside2 = 3
+
+
+def clean_path(path):
return path if sys.platform != 'win32' else path.replace('\\', '/')
-def sharedLibrarySuffix():
+
+def shared_library_suffix():
if sys.platform == 'win32':
return 'lib'
elif sys.platform == 'darwin':
@@ -68,21 +146,41 @@ def sharedLibrarySuffix():
else:
return 'so.*'
-def sharedLibraryGlobPattern():
- glob = '*.' + sharedLibrarySuffix()
+
+def import_suffixes():
+ if (sys.version_info >= (3, 4)):
+ import importlib
+ return importlib.machinery.EXTENSION_SUFFIXES
+ else:
+ import imp
+ result = []
+ for t in imp.get_suffixes():
+ result.append(t[0])
+ return result
+
+
+def is_debug():
+ debug_suffix = '_d.pyd' if sys.platform == 'win32' else '_d.so'
+ return any([s.endswith(debug_suffix) for s in import_suffixes()])
+
+
+def shared_library_glob_pattern():
+ glob = '*.' + shared_library_suffix()
return glob if sys.platform == 'win32' else 'lib' + glob
-def filterPySide2SharedLibraries(list, only_shiboken=False):
- def predicate(item):
- basename = os.path.basename(item)
- if 'shiboken' in basename or ('pyside2' in basename and not only_shiboken):
+
+def filter_shared_libraries(libs_list):
+ def predicate(lib_name):
+ basename = os.path.basename(lib_name)
+ if 'shiboken' in basename or 'pyside2' in basename:
return True
return False
- result = [item for item in list if predicate(item)]
+ result = [lib for lib in libs_list if predicate(lib)]
return result
+
# Return qmake link option for a library file name
-def linkOption(lib):
+def link_option(lib):
# On Linux:
# Since we cannot include symlinks with wheel packages
# we are using an absolute path for the libpyside and libshiboken
@@ -97,24 +195,50 @@ def linkOption(lib):
link += os.path.splitext(baseName)[0]
return link
-# Locate PySide2 via package path
-def findPySide2():
+
+# Locate PySide2 via sys.path package path.
+def find_pyside2():
+ return find_package_path("PySide2")
+
+
+def find_shiboken2_module():
+ return find_package_path("shiboken2")
+
+
+def find_shiboken2_generator():
+ return find_package_path("shiboken2_generator")
+
+
+def find_package(which_package):
+ if which_package == Package.shiboken2_module:
+ return find_shiboken2_module()
+ if which_package == Package.shiboken2_generator:
+ return find_shiboken2_generator()
+ if which_package == Package.pyside2:
+ return find_pyside2()
+ return None
+
+
+def find_package_path(dir_name):
for p in sys.path:
if 'site-' in p:
- pyside2 = os.path.join(p, 'PySide2')
- if os.path.exists(pyside2):
- return cleanPath(os.path.realpath(pyside2))
+ package = os.path.join(p, dir_name)
+ if os.path.exists(package):
+ return clean_path(os.path.realpath(package))
return None
+
# Return version as "3.5"
-def pythonVersion():
+def python_version():
return str(sys.version_info[0]) + '.' + str(sys.version_info[1])
-def pythonInclude():
+
+def get_python_include_path():
return sysconfig.get_python_inc()
-def pythonLinkQmake():
- flags = pythonLinkData()
+
+def python_link_flags_qmake():
+ flags = python_link_data()
if sys.platform == 'win32':
libdir = flags['libdir']
# This will add the "~1" shortcut for directories that
@@ -131,25 +255,27 @@ def pythonLinkQmake():
# Linux and anything else
return '-L{} -l{}'.format(flags['libdir'], flags['lib'])
-def pythonLinkCmake():
- flags = pythonLinkData()
+
+def python_link_flags_cmake():
+ flags = python_link_data()
libdir = flags['libdir']
lib = re.sub(r'.dll$', '.lib', flags['lib'])
return '{};{}'.format(libdir, lib)
-def pythonLinkData():
+
+def python_link_data():
# @TODO Fix to work with static builds of Python
libdir = sysconfig.get_config_var('LIBDIR')
if libdir is None:
libdir = os.path.abspath(os.path.join(
sysconfig.get_config_var('LIBDEST'), "..", "libs"))
- version = pythonVersion()
+ version = python_version()
version_no_dots = version.replace('.', '')
flags = {}
flags['libdir'] = libdir
if sys.platform == 'win32':
- suffix = '_d' if any([tup[0].endswith('_d.pyd') for tup in imp.get_suffixes()]) else ''
+ suffix = '_d' if is_debug() else ''
flags['lib'] = 'python{}{}'.format(version_no_dots, suffix)
elif sys.platform == 'darwin':
@@ -158,42 +284,44 @@ def pythonLinkData():
# Linux and anything else
else:
if sys.version_info[0] < 3:
- suffix = '_d' if any([tup[0].endswith('_d.so') for tup in imp.get_suffixes()]) else ''
+ suffix = '_d' if is_debug() else ''
flags['lib'] = 'python{}{}'.format(version, suffix)
else:
flags['lib'] = 'python{}{}'.format(version, sys.abiflags)
return flags
-def pyside2Include(only_shiboken=False):
- pySide2 = findPySide2()
- if pySide2 is None:
+
+def get_package_include_path(which_package):
+ package_path = find_package(which_package)
+ if package_path is None:
return None
- includes = "{0}/include/shiboken2".format(pySide2)
- if not only_shiboken:
- includes = includes + " {0}/include/PySide2".format(pySide2)
+ includes = "{0}/include".format(package_path)
return includes
-def pyside2Link():
- pySide2 = findPySide2()
- if pySide2 is None:
+
+def get_package_qmake_lflags(which_package):
+ package_path = find_package(which_package)
+ if package_path is None:
return None
- link = "-L{}".format(pySide2)
- glob_result = glob.glob(os.path.join(pySide2, sharedLibraryGlobPattern()))
- for lib in filterPySide2SharedLibraries(glob_result):
+
+ link = "-L{}".format(package_path)
+ glob_result = glob.glob(os.path.join(package_path, shared_library_glob_pattern()))
+ for lib in filter_shared_libraries(glob_result):
link += ' '
- link += linkOption(lib)
+ link += link_option(lib)
return link
-def pyside2SharedLibrariesData(only_shiboken=False):
- pySide2 = findPySide2()
- if pySide2 is None:
+
+def get_shared_libraries_data(which_package):
+ package_path = find_package(which_package)
+ if package_path is None:
return None
- glob_result = glob.glob(os.path.join(pySide2, sharedLibraryGlobPattern()))
- filtered_libs = filterPySide2SharedLibraries(glob_result, only_shiboken)
+ glob_result = glob.glob(os.path.join(package_path, shared_library_glob_pattern()))
+ filtered_libs = filter_shared_libraries(glob_result)
libs = []
if sys.platform == 'win32':
for lib in filtered_libs:
@@ -203,8 +331,9 @@ def pyside2SharedLibrariesData(only_shiboken=False):
libs.append(lib)
return libs
-def pyside2SharedLibraries():
- libs = pyside2SharedLibrariesData()
+
+def get_shared_libraries_qmake(which_package):
+ libs = get_shared_libraries_data(which_package)
if libs is None:
return None
@@ -223,80 +352,21 @@ def pyside2SharedLibraries():
libs_string += lib + ' '
return libs_string
-def pyside2SharedLibrariesCmake(only_shiboken=False):
- libs = pyside2SharedLibrariesData(only_shiboken)
+
+def get_shared_libraries_cmake(which_package):
+ libs = get_shared_libraries_data(which_package)
result = ';'.join(libs)
return result
-option = sys.argv[1] if len(sys.argv) == 2 else '-a'
-if option == '-h' or option == '--help':
- print(usage)
- sys.exit(0)
-generic_error = (' Did you forget to activate your virtualenv? Or perhaps'
- ' you forgot to build / install PySide2 into your currently active Python'
- ' environment?')
-pyside2_error = 'Unable to locate PySide2.' + generic_error
-pyside2_libs_error = 'Unable to locate the PySide2 shared libraries.' + generic_error
-python_link_error = 'Unable to locate the Python library for linking.'
+print_all = option == "-a"
+for argument, handler, error, _ in options:
+ if option == argument or print_all:
+ handler_result = handler()
+ if handler_result is None:
+ sys.exit(error)
-if option == '--pyside2' or option == '-a':
- pySide2 = findPySide2()
- if pySide2 is None:
- sys.exit(pyside2_error)
- print(pySide2)
-
-if option == '--pyside2-link' or option == '-a':
- l = pyside2Link()
- if l is None:
- sys.exit(pyside2_error)
-
- print(l)
-
-if option == '--shiboken-include' or option == '-a':
- i = pyside2Include(only_shiboken=True)
- if i is None:
- sys.exit(pyside2_error)
- print(i)
-
-if option == '--pyside2-include' or option == '-a':
- i = pyside2Include()
- if i is None:
- sys.exit(pyside2_error)
- print(i)
-
-if option == '--python-include' or option == '-a':
- i = pythonInclude()
- if i is None:
- sys.exit('Unable to locate the Python include headers directory.')
- print(i)
-
-if option == '--python-link' or option == '-a':
- l = pythonLinkQmake()
- if l is None:
- sys.exit(python_link_error)
- print(l)
-
-if option == '--python-link-cmake' or option == '-a':
- l = pythonLinkCmake()
- if l is None:
- sys.exit(python_link_error)
- print(l)
-
-if option == '--pyside2-shared-libraries' or option == '-a':
- l = pyside2SharedLibraries()
- if l is None:
- sys.exit(pyside2_libs_error)
- print(l)
-
-if option == '--pyside2-shared-libraries-cmake' or option == '-a':
- l = pyside2SharedLibrariesCmake()
- if l is None:
- sys.exit(pyside2_libs_error)
- print(l)
-
-if option == '--shiboken-shared-libraries-cmake' or option == '-a':
- l = pyside2SharedLibrariesCmake(only_shiboken=True)
- if l is None:
- sys.exit(pyside2_libs_error)
- print(l)
+ line = handler_result
+ if print_all:
+ line = "{:<40}: ".format(argument) + line
+ print(line)
diff --git a/keyword-errors.lst b/keyword-errors.lst
new file mode 100644
index 00000000..af8c581a
--- /dev/null
+++ b/keyword-errors.lst
@@ -0,0 +1,43 @@
+KEYWORD {'multi': None, 'funcname': 'PySide2.QtCore.QAbstractItemModel.changePersistentIndex', 'arglist': 'from:PySide2.QtCore.QModelIndex,to:PySide2.QtCore.QModelIndex', 'returntype': None}
+KEYWORD {'multi': None, 'funcname': 'PySide2.QtCore.QAbstractItemModel.changePersistentIndexList', 'arglist': 'from:QModelIndexList,to:QModelIndexList', 'returntype': None}
+KEYWORD {'multi': None, 'funcname': 'PySide2.QtCore.QByteArray.indexOf', 'arglist': 'a:PySide2.QtCore.QByteArray,from:int=0', 'returntype': 'int'}
+KEYWORD {'multi': None, 'funcname': 'PySide2.QtCore.QByteArray.lastIndexOf', 'arglist': 'a:PySide2.QtCore.QByteArray,from:int=-1', 'returntype': 'int'}
+KEYWORD {'multi': '1', 'funcname': 'PySide2.QtCore.QByteArrayMatcher.indexIn', 'arglist': 'ba:PySide2.QtCore.QByteArray,from:int=0', 'returntype': 'int'}
+KEYWORD {'multi': '0', 'funcname': 'PySide2.QtCore.QByteArrayMatcher.indexIn', 'arglist': 'str:str,len:int,from:int=0', 'returntype': 'int'}
+KEYWORD {'multi': None, 'funcname': 'PySide2.QtCore.QItemSelection.indexOf', 'arglist': 't:PySide2.QtCore.QItemSelectionRange,from:int=0', 'returntype': 'int'}
+KEYWORD {'multi': None, 'funcname': 'PySide2.QtCore.QItemSelection.lastIndexOf', 'arglist': 't:PySide2.QtCore.QItemSelectionRange,from:int=-1', 'returntype': 'int'}
+KEYWORD {'multi': None, 'funcname': 'PySide2.QtCore.QItemSelection.move', 'arglist': 'from:int,to:int', 'returntype': None}
+KEYWORD {'multi': None, 'funcname': 'PySide2.QtCore.QTextCodec.convertToUnicode', 'arglist': 'in:str,length:int,state:PySide2.QtCore.QTextCodec.ConverterState', 'returntype': 'QString'}
+KEYWORD {'multi': '0', 'funcname': 'PySide2.QtCore.QTextCodec.toUnicode', 'arglist': 'in:str,length:int,state:PySide2.QtCore.QTextCodec.ConverterState=nullptr', 'returntype': 'QString'}
+KEYWORD {'multi': None, 'funcname': 'PySide2.QtCore.QVariantAnimation.interpolated', 'arglist': 'from:QVariant,to:QVariant,progress:double', 'returntype': 'QVariant'}
+KEYWORD {'multi': None, 'funcname': 'PySide2.QtCore.QXmlStreamAttributes.indexOf', 'arglist': 't:PySide2.QtCore.QXmlStreamAttribute,from:int=0', 'returntype': 'int'}
+KEYWORD {'multi': None, 'funcname': 'PySide2.QtCore.QXmlStreamAttributes.lastIndexOf', 'arglist': 't:PySide2.QtCore.QXmlStreamAttribute,from:int=-1', 'returntype': 'int'}
+KEYWORD {'multi': None, 'funcname': 'PySide2.QtCore.QXmlStreamAttributes.move', 'arglist': 'from:int,to:int', 'returntype': None}
+KEYWORD {'multi': None, 'funcname': 'PySide2.QtGui.QAbstractTextDocumentLayout.documentChanged', 'arglist': 'from:int,charsRemoved:int,charsAdded:int', 'returntype': None}
+KEYWORD {'multi': None, 'funcname': 'PySide2.QtGui.QIconEngine.read', 'arglist': 'in:PySide2.QtCore.QDataStream', 'returntype': 'bool'}
+KEYWORD {'multi': None, 'funcname': 'PySide2.QtGui.QKeySequence.__lshift__', 'arglist': 'in:PySide2.QtCore.QDataStream', 'returntype': 'PySide2.QtCore.QDataStream'}
+KEYWORD {'multi': None, 'funcname': 'PySide2.QtGui.QPolygon.indexOf', 'arglist': 't:PySide2.QtCore.QPoint,from:int=0', 'returntype': 'int'}
+KEYWORD {'multi': None, 'funcname': 'PySide2.QtGui.QPolygon.lastIndexOf', 'arglist': 't:PySide2.QtCore.QPoint,from:int=-1', 'returntype': 'int'}
+KEYWORD {'multi': None, 'funcname': 'PySide2.QtGui.QPolygon.move', 'arglist': 'from:int,to:int', 'returntype': None}
+KEYWORD {'multi': None, 'funcname': 'PySide2.QtGui.QPolygonF.indexOf', 'arglist': 't:PySide2.QtCore.QPointF,from:int=0', 'returntype': 'int'}
+KEYWORD {'multi': None, 'funcname': 'PySide2.QtGui.QPolygonF.lastIndexOf', 'arglist': 't:PySide2.QtCore.QPointF,from:int=-1', 'returntype': 'int'}
+KEYWORD {'multi': None, 'funcname': 'PySide2.QtGui.QPolygonF.move', 'arglist': 'from:int,to:int', 'returntype': None}
+KEYWORD {'multi': None, 'funcname': 'PySide2.QtGui.QQuaternion.rotationTo', 'arglist': 'from:PySide2.QtGui.QVector3D,to:PySide2.QtGui.QVector3D', 'returntype': 'PySide2.QtGui.QQuaternion'}
+KEYWORD {'multi': None, 'funcname': 'PySide2.QtGui.QStandardItem.read', 'arglist': 'in:PySide2.QtCore.QDataStream', 'returntype': None}
+KEYWORD {'multi': None, 'funcname': 'PySide2.QtGui.QStandardItem.__rshift__', 'arglist': 'in:PySide2.QtCore.QDataStream', 'returntype': 'PySide2.QtCore.QDataStream'}
+KEYWORD {'multi': '4', 'funcname': 'PySide2.QtGui.QTextDocument.find', 'arglist': 'expr:PySide2.QtCore.QRegExp,from:int=0,options:PySide2.QtGui.QTextDocument.FindFlags=QTextDocument.FindFlags()', 'returntype': 'PySide2.QtGui.QTextCursor'}
+KEYWORD {'multi': '2', 'funcname': 'PySide2.QtGui.QTextDocument.find', 'arglist': 'expr:PySide2.QtCore.QRegularExpression,from:int=0,options:PySide2.QtGui.QTextDocument.FindFlags=QTextDocument.FindFlags()', 'returntype': 'PySide2.QtGui.QTextCursor'}
+KEYWORD {'multi': '0', 'funcname': 'PySide2.QtGui.QTextDocument.find', 'arglist': 'subString:QString,from:int=0,options:PySide2.QtGui.QTextDocument.FindFlags=QTextDocument.FindFlags()', 'returntype': 'PySide2.QtGui.QTextCursor'}
+KEYWORD {'multi': None, 'funcname': 'PySide2.QtGui.QTextDocument.markContentsDirty', 'arglist': 'from:int,length:int', 'returntype': None}
+KEYWORD {'multi': None, 'funcname': 'PySide2.QtWidgets.QHeaderView.moveSection', 'arglist': 'from:int,to:int', 'returntype': None}
+KEYWORD {'multi': None, 'funcname': 'PySide2.QtWidgets.QLayout.replaceWidget', 'arglist': 'from:PySide2.QtWidgets.QWidget,to:PySide2.QtWidgets.QWidget,options:PySide2.QtCore.Qt.FindChildOptions=Qt.FindChildrenRecursively', 'returntype': 'PySide2.QtWidgets.QLayoutItem'}
+KEYWORD {'multi': None, 'funcname': 'PySide2.QtWidgets.QListWidgetItem.read', 'arglist': 'in:PySide2.QtCore.QDataStream', 'returntype': None}
+KEYWORD {'multi': None, 'funcname': 'PySide2.QtWidgets.QListWidgetItem.__rshift__', 'arglist': 'in:PySide2.QtCore.QDataStream', 'returntype': 'PySide2.QtCore.QDataStream'}
+KEYWORD {'multi': None, 'funcname': 'PySide2.QtWidgets.QPlainTextDocumentLayout.documentChanged', 'arglist': 'from:int,arg__2:int,charsAdded:int', 'returntype': None}
+KEYWORD {'multi': None, 'funcname': 'PySide2.QtWidgets.QTabBar.moveTab', 'arglist': 'from:int,to:int', 'returntype': None}
+KEYWORD {'multi': None, 'funcname': 'PySide2.QtWidgets.QTableWidgetItem.read', 'arglist': 'in:PySide2.QtCore.QDataStream', 'returntype': None}
+KEYWORD {'multi': None, 'funcname': 'PySide2.QtWidgets.QTableWidgetItem.__rshift__', 'arglist': 'in:PySide2.QtCore.QDataStream', 'returntype': 'PySide2.QtCore.QDataStream'}
+KEYWORD {'multi': None, 'funcname': 'PySide2.QtWidgets.QTreeWidgetItem.read', 'arglist': 'in:PySide2.QtCore.QDataStream', 'returntype': None}
+KEYWORD {'multi': None, 'funcname': 'PySide2.QtWidgets.QTreeWidgetItem.__rshift__', 'arglist': 'in:PySide2.QtCore.QDataStream', 'returntype': 'PySide2.QtCore.QDataStream'}
+KEYWORD {'multi': None, 'funcname': 'PySide2.QtMultimedia.QAudio.convertVolume', 'arglist': 'volume:double,from:PySide2.QtMultimedia.QAudio.VolumeScale,to:PySide2.QtMultimedia.QAudio.VolumeScale', 'returntype': 'double'}
+KEYWORD {'multi': None, 'funcname': 'PySide2.QtMultimedia.QMediaPlaylist.moveMedia', 'arglist': 'from:int,to:int', 'returntype': 'bool'}
diff --git a/popenasync.py b/popenasync.py
deleted file mode 100644
index 77faf9e0..00000000
--- a/popenasync.py
+++ /dev/null
@@ -1,360 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2017 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$
-##
-#############################################################################
-
-################################################################################
-"""
-
-Modification of http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/440554
-
-"""
-
-#################################### IMPORTS ###################################
-
-import os
-import subprocess
-import errno
-import time
-import sys
-import unittest
-import tempfile
-
-def geterror ():
- return sys.exc_info()[1]
-
-if sys.version_info >= (3,):
- null_byte = '\x00'.encode('ascii')
-else:
- null_byte = '\x00'
-
-mswindows = (sys.platform == "win32")
-
-if mswindows:
- if sys.version_info >= (3,):
- # Test date should be in ascii.
- def encode(s):
- return s.encode('ascii', 'ignore')
-
- def decode(b):
- return b.decode('ascii', 'ignore')
- else:
- # Strings only; do nothing
- def encode(s):
- return s
-
- def decode(b):
- return b
-
- try:
- import ctypes
- from ctypes.wintypes import DWORD
- kernel32 = ctypes.windll.kernel32
- TerminateProcess = ctypes.windll.kernel32.TerminateProcess
- def WriteFile(handle, data, ol = None):
- c_written = DWORD()
- success = ctypes.windll.kernel32.WriteFile(handle,
- ctypes.create_string_buffer(encode(data)), len(data),
- ctypes.byref(c_written), ol)
- return ctypes.windll.kernel32.GetLastError(), c_written.value
- def ReadFile(handle, desired_bytes, ol = None):
- c_read = DWORD()
- buffer = ctypes.create_string_buffer(desired_bytes+1)
- success = ctypes.windll.kernel32.ReadFile(handle, buffer,
- desired_bytes, ctypes.byref(c_read), ol)
- buffer[c_read.value] = null_byte
- return ctypes.windll.kernel32.GetLastError(), decode(buffer.value)
- def PeekNamedPipe(handle, desired_bytes):
- c_avail = DWORD()
- c_message = DWORD()
- if desired_bytes > 0:
- c_read = DWORD()
- buffer = ctypes.create_string_buffer(desired_bytes+1)
- success = ctypes.windll.kernel32.PeekNamedPipe(handle, buffer,
- desired_bytes, ctypes.byref(c_read), ctypes.byref(c_avail),
- ctypes.byref(c_message))
- buffer[c_read.value] = null_byte
- return decode(buffer.value), c_avail.value, c_message.value
- else:
- success = ctypes.windll.kernel32.PeekNamedPipe(handle, None,
- desired_bytes, None, ctypes.byref(c_avail),
- ctypes.byref(c_message))
- return "", c_avail.value, c_message.value
-
- except ImportError:
- from win32file import ReadFile, WriteFile
- from win32pipe import PeekNamedPipe
- from win32api import TerminateProcess
- import msvcrt
-
-else:
- from signal import SIGINT, SIGTERM, SIGKILL
- import select
- import fcntl
-
-################################### CONSTANTS ##################################
-
-PIPE = subprocess.PIPE
-
-################################################################################
-
-class Popen(subprocess.Popen):
- def __init__(self, *args, **kwargs):
- subprocess.Popen.__init__(self, *args, **kwargs)
-
- def recv(self, maxsize=None):
- return self._recv('stdout', maxsize)
-
- def recv_err(self, maxsize=None):
- return self._recv('stderr', maxsize)
-
- def send_recv(self, input='', maxsize=None):
- return self.send(input), self.recv(maxsize), self.recv_err(maxsize)
-
- def read_async(self, wait=.1, e=1, tr=5, stderr=0):
- if tr < 1:
- tr = 1
- x = time.time()+ wait
- y = []
- r = ''
- pr = self.recv
- if stderr:
- pr = self.recv_err
- while time.time() < x or r:
- r = pr()
- if r is None:
- if e:
- raise Exception("Other end disconnected!")
- else:
- break
- elif r:
- y.append(r)
- else:
- time.sleep(max((x-time.time())/tr, 0))
- return ''.join(y)
-
- def send_all(self, data):
- while len(data):
- sent = self.send(data)
- if sent is None:
- raise Exception("Other end disconnected!")
- data = buffer(data, sent)
-
- def get_conn_maxsize(self, which, maxsize):
- if maxsize is None:
- maxsize = 1024
- elif maxsize < 1:
- maxsize = 1
- return getattr(self, which), maxsize
-
- def _close(self, which):
- conn = getattr(self, which)
- flags = fcntl.fcntl(conn, fcntl.F_GETFL)
- if not conn.closed:
- fcntl.fcntl(conn, fcntl.F_SETFL, flags & ~os.O_NONBLOCK)
- assert conn.read() == ''
- getattr(self, which).close()
- setattr(self, which, None)
-
- if mswindows:
- def kill(self):
- # Recipes
- #http://me.in-berlin.de/doc/python/faq/windows.html#how-do-i-emulate-os-kill-in-windows
- #http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/347462
-
- """kill function for Win32"""
- TerminateProcess(int(self._handle), 0) # returns None
-
- def send(self, input):
- if not self.stdin:
- return None
-
- try:
- x = msvcrt.get_osfhandle(self.stdin.fileno())
- (errCode, written) = WriteFile(x, input)
- except ValueError:
- return self._close('stdin')
- except (subprocess.pywintypes.error, Exception):
- if geterror()[0] in (109, errno.ESHUTDOWN):
- return self._close('stdin')
- raise
-
- return written
-
- def _recv(self, which, maxsize):
- conn, maxsize = self.get_conn_maxsize(which, maxsize)
- if conn is None:
- return None
-
- try:
- x = msvcrt.get_osfhandle(conn.fileno())
- (read, nAvail, nMessage) = PeekNamedPipe(x, 0)
- if maxsize < nAvail:
- nAvail = maxsize
- if nAvail > 0:
- (errCode, read) = ReadFile(x, nAvail, None)
- except ValueError:
- return self._close(which)
- except (subprocess.pywintypes.error, Exception):
- if geterror()[0] in (109, errno.ESHUTDOWN):
- return self._close(which)
- raise
-
- if self.universal_newlines:
- # Translate newlines. For Python 3.x assume read is text.
- # If bytes then another solution is needed.
- read = read.replace("\r\n", "\n").replace("\r", "\n")
- return read
-
- else:
- def kill(self):
- for i, sig in enumerate([SIGTERM, SIGKILL] * 2):
- if i % 2 == 0: os.kill(self.pid, sig)
- time.sleep((i * (i % 2) / 5.0) + 0.01)
-
- killed_pid, stat = os.waitpid(self.pid, os.WNOHANG)
- if killed_pid != 0: return
-
- def send(self, input):
- if not self.stdin:
- return None
-
- if not select.select([], [self.stdin], [], 0)[1]:
- return 0
-
- try:
- written = os.write(self.stdin.fileno(), input)
- except OSError:
- if geterror()[0] == errno.EPIPE: #broken pipe
- return self._close('stdin')
- raise
-
- return written
-
- def _recv(self, which, maxsize):
- conn, maxsize = self.get_conn_maxsize(which, maxsize)
- if conn is None:
- return None
-
- flags = fcntl.fcntl(conn, fcntl.F_GETFL)
- if not conn.closed:
- fcntl.fcntl(conn, fcntl.F_SETFL, flags| os.O_NONBLOCK)
-
- try:
- if not select.select([conn], [], [], 0)[0]:
- return ''
-
- try:
- r = conn.read(maxsize)
- except IOError as e:
- if e.errno == errno.EAGAIN:
- return ''
- raise
- if not r:
- return self._close(which)
-
- if self.universal_newlines:
- r = r.replace("\r\n", "\n").replace("\r", "\n")
- return r
- finally:
- if not conn.closed:
- fcntl.fcntl(conn, fcntl.F_SETFL, flags)
-
-################################################################################
-
-def proc_in_time_or_kill(cmd, time_out, wd = None, env = None):
- proc = Popen (
- cmd, cwd = wd, env = env,
- stdin = subprocess.PIPE, stdout = subprocess.PIPE,
- stderr = subprocess.STDOUT, universal_newlines = 1
- )
-
- ret_code = None
- response = []
-
- t = time.time()
- while ret_code is None and ((time.time() -t) < time_out):
- ret_code = proc.poll()
- response += [proc.read_async(wait=0.1, e=0)]
-
- if ret_code is None:
- ret_code = '"Process timed out (time_out = {} secs) '.format(time_out)
- try:
- proc.kill()
- ret_code += 'and was successfully terminated"'
- except Exception:
- ret_code += ("and termination failed "
- "(exception: {})".format(geterror(),))
-
- return ret_code, ''.join(response)
-
-################################################################################
-
-class AsyncTest(unittest.TestCase):
- def test_proc_in_time_or_kill(self):
- ret_code, response = proc_in_time_or_kill(
- [sys.executable, '-c', 'while 1: pass'], time_out = 1
- )
-
- self.assert_( 'rocess timed out' in ret_code )
- self.assert_( 'successfully terminated' in ret_code )
-
-################################################################################
-
-def _example():
- if sys.platform == 'win32':
- shell, commands, tail = ('cmd', ('echo "hello"', 'echo "HELLO WORLD"'),
- '\r\n')
- else:
- shell, commands, tail = ('sh', ('ls', 'echo HELLO WORLD'), '\n')
-
- a = Popen(shell, stdin=PIPE, stdout=PIPE)
- sys.stdout.write(a.read_async())
- sys.stdout.write(" ")
- for cmd in commands:
- a.send_all(cmd + tail)
- sys.stdout.write(a.read_async())
- sys.stdout.write(" ")
- a.send_all('exit' + tail)
- print (a.read_async(e=0))
- a.wait()
-
-################################################################################
-
-if __name__ == '__main__':
- if 1: unittest.main()
- else: _example()
diff --git a/setup.py b/setup.py
index b218397c..58bb84b3 100644
--- a/setup.py
+++ b/setup.py
@@ -42,24 +42,61 @@ from __future__ import print_function
"""
This is a distutils setup-script for the Qt for Python project
-To build PySide2 simply execute:
- python setup.py build
+To build both shiboken2 and PySide2 simply execute:
+
+ python setup.py build
+
or
- python setup.py install
+
+ python setup.py install
+
to build and install into your current Python installation.
+The same setup.py script is used to build all the components of the
+project:
+ - shiboken2 (the supporting Python module)
+ - shiboken2-generator (the bindings generation executable)
+ - PySide2
+ - pyside2-tools
+
+Preferably, a Qt (build) environment should be used to automatically
+pick up the associated `qmake`, but optionally one can specify the
+location of `qmake` and `cmake` if it is not in the current PATH with:
-Optionally, one can specify the location of qmake and cmake if it is
-not on the current PATH with:
--qmake=/path/to/qt/bin/qmake
+
and
+
--cmake=/path/to/bin/cmake
+
respectively.
+By default, all of the above is built when no special options are
+passed to the script. You can use the --build-type parameter to specify
+which things should be built:
+
+ --build-type=shiboken2 - build / package only the python module
+ --build-type=shiboken2-generator - build / package the generator
+ executable
+ --build-type=pyside2 - build / package the PySide2 bindings and
+ and pyside2-tools
+ --build-type=all - the implicit default to build all of the above
+
+
+When building PySide2, optionally, one can specify the location of the
+shiboken2 cmake config path if it is not on the current PATH with:
+
+ --shiboken-config-dir=/path/to/shiboken/cmake/config/dir
+
+This is useful if you did a cmake installation of shiboken2 into
+a custom location.
+
For Windows, if OpenSSL support is required, it's necessary to specify
the directory path that contains the OpenSSL shared libraries
"libeay32.dll" and "ssleay32.dll", for example:
- --openssl=C:\OpenSSL-Win64\bin
+
+ --openssl=C:\\OpenSSL-Win64\\bin
+
This will make sure that the libraries are copied into the PySide2
package and are found by the QtNetwork module.
@@ -79,23 +116,23 @@ not specified.
You can use the option `--only-package` if you want to create more
binary packages (bdist_wheel, bdist_egg, ...) without rebuilding the
-entire PySide2 every time:
+entire project every time:
e.g.:
* First, we create a bdist_wheel from a full PySide2 build:
- python setup.py bdist_wheel --qmake=c:\Qt\5.9\bin\qmake.exe
- --cmake=c:\tools\cmake\bin\cmake.exe
- --openssl=c:\libs\OpenSSL32bit\bin
+ python setup.py bdist_wheel --qmake=c:\\Qt\\5.12\\bin\\qmake.exe
+ --cmake=c:\\tools\\cmake\\bin\\cmake.exe
+ --openssl=c:\\libs\\OpenSSL32bit\\bin
-* Then, we create a bdist_egg reusing PySide2 build with option
+* Then, we create a bdist_egg reusing the PySide2 build with option
`--only-package`:
python setup.py bdist_egg --only-package
- --qmake=c:\Qt\5.9\bin\qmake.exe
- --cmake=c:\tools\cmake\bin\cmake.exe
- --openssl=c:\libs\OpenSSL32bit\bin
+ --qmake=c:\\Qt\\5.12\\bin\\qmake.exe
+ --cmake=c:\\tools\\cmake\\bin\\cmake.exe
+ --openssl=c:\\libs\\OpenSSL32bit\\bin
You can use the option `--qt-conf-prefix` to pass a path relative to
the PySide2 installed package, which will be embedded into an
@@ -110,47 +147,47 @@ new environment variable called PYSIDE_DISABLE_INTERNAL_QT_CONF is
introduced.
You should assign the integer "1" to disable the internal `qt.conf`,
-or "0" (or leave empty) to keep usining the internal `qt.conf` file.
+or "0" (or leave empty) to keep using the internal `qt.conf` file.
DEVELOPMENT OPTIONS:
For development purposes the following options might be of use, when
using `setup.py build`:
+ --ignore-git will skip the fetching and checkout steps for
+ supermodule and all submodules.
+ --limited-api=yes|no default yes if applicable
+ Set or clear the limited API flag. Ignored for Python 2.
--module-subset allows for specifying the Qt modules to be built.
A minimal set is: --module-subset=Core,Gui,Test,Widgets
- --skip-modules allows for specifying the Qt modules that will be
- skipped during the build process.
- For example: --skip-modules=WebEngineCore,WebEngineWidgets
+ --package-timestamp allows specifying the timestamp that will be
+ used as part of the version number for a snapshot package.
+ For example given --package-timestamp=1529646276
+ the package version will be 5.x.y.dev1529646276.
--reuse-build option allows recompiling only the modified sources and
- not the whole world, shortening development iteration time,
+ not the whole world, shortening development iteration time.
+ --sanitize-address will build the project with address sanitizer.
--skip-cmake will reuse the already generated Makefiles (or
equivalents), instead of invoking, CMake to update the
Makefiles (note, CMake should be ran at least once to generate
- the files),
+ the files).
+ --skip-docs skip the documentation generation.
--skip-make-install will not run make install (or equivalent) for
- each module built,
+ each module built.
+ --skip-modules allows for specifying the Qt modules that will be
+ skipped during the build process.
+ For example: --skip-modules=WebEngineCore,WebEngineWidgets
--skip-packaging will skip creation of the python package,
- --ignore-git will skip the fetching and checkout steps for
- supermodule and all submodules.
+ enabled (Linux or macOS only).
--verbose-build will output the compiler invocation with command line
arguments, etc.
- --sanitize-address will build the project with address sanitizer
- enabled (Linux or macOS only).
- --skip-docs skip the documentation generation.
- --limited-api=yes|no default yes if applicable
- Set or clear the limited API flag. Ignored for Python 2.
- --package-timestamp allows specifying the timestamp that will be
- used as part of the version number for a snapshot package.
- For example given --package-timestamp=1529646276
- the package version will be 5.x.y.dev1529646276.
REQUIREMENTS:
-* Python: 2.7 and 3.3+ are supported
+* Python: 2.7 and 3.5+ are supported
* CMake: Specify the path to cmake with `--cmake` option or add cmake
to the system path.
-* Qt: 5.9 and 5.11 are supported. Specify the path to qmake with
+* Qt: 5.11+ is supported. Specify the path to qmake with
`--qmake` option or add qmake to the system path.
OPTIONAL:
@@ -166,9 +203,11 @@ OPTIONAL:
You can specify the location of the OpenSSL DLLs with the
following option:
+
--openssl=</path/to/openssl/bin-directory>.
You can download OpenSSL for Windows here:
+
http://slproweb.com/products/Win32OpenSSL.html (*)
Official Qt packages do not link to the SSL library directly, but
@@ -188,11 +227,12 @@ OPTIONAL:
shared libraries, are not currently compatible with
standalone PySide2 packages.
- (*) Revised on 21.06.2018
+ (*) Revised on 2018.10.24
* macOS SDK:
You can specify which macOS SDK should be used for compilation with
the option:
+
--macos-sysroot=</path/to/sdk>.
e.g.: "--macos-sysroot=/Applications/Xcode.app/.../Developer/SDKs/MacOSX10.12.sdk/"
@@ -200,6 +240,7 @@ OPTIONAL:
* macOS minimum deployment target:
You can specify a custom macOS minimum deployment target with the
option:
+
--macos-deployment-target=<value>
e.g.: "--macos-deployment-target=10.10"
@@ -219,7 +260,8 @@ OPTIONAL:
an older OS version.
"""
-import os, sys
+import os
+import sys
# Change the current directory to setup.py's dir.
try:
@@ -230,75 +272,18 @@ this_file = os.path.abspath(this_file)
if os.path.dirname(this_file):
os.chdir(os.path.dirname(this_file))
-from build_scripts.main import get_package_version, get_setuptools_extension_modules
-from build_scripts.main import pyside_package_dir_name
-from build_scripts.main import cmd_class_dict
-from build_scripts.main import README, CHANGES
-from setuptools import setup, Extension
+# Save the original command line arguments to pass them on to the setup
+# mechanism.
+original_argv = list(sys.argv)
+
+from build_scripts.main import get_package_version, check_allowed_python_version
+from build_scripts.setup_runner import SetupRunner
-# The __version__ variable is just for PEP compliancy, and shouldn't be
-# used as a value source.
+# The __version__ variable is just for PEP compliance, and shouldn't be
+# used as a value source. Use get_package_version() instead.
__version__ = get_package_version()
-extension_modules = get_setuptools_extension_modules()
-
-setup(
- name = "PySide2",
- version = get_package_version(),
- description = ("Python bindings for the Qt cross-platform application and "
- "UI framework"),
- long_description = README + "\n\n" + CHANGES,
- long_description_content_type = 'text/markdown',
- classifiers = [
- 'Development Status :: 5 - Production/Stable',
- 'Environment :: Console',
- 'Environment :: MacOS X',
- 'Environment :: X11 Applications :: Qt',
- 'Environment :: Win32 (MS Windows)',
- 'Intended Audience :: Developers',
- 'License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)',
- 'Operating System :: MacOS :: MacOS X',
- 'Operating System :: POSIX',
- 'Operating System :: POSIX :: Linux',
- 'Operating System :: Microsoft',
- 'Operating System :: Microsoft :: Windows',
- 'Programming Language :: C++',
- 'Programming Language :: Python',
- 'Programming Language :: Python :: 2',
- 'Programming Language :: Python :: 2.7',
- 'Programming Language :: Python :: 3',
- 'Programming Language :: Python :: 3.5',
- 'Programming Language :: Python :: 3.6',
- 'Programming Language :: Python :: 3.7',
- 'Topic :: Database',
- 'Topic :: Software Development',
- 'Topic :: Software Development :: Code Generators',
- 'Topic :: Software Development :: Libraries :: Application Frameworks',
- 'Topic :: Software Development :: User Interfaces',
- 'Topic :: Software Development :: Widget Sets',
- ],
- keywords = 'Qt',
- author = 'Qt for Python Team',
- author_email = 'pyside@qt-project.org',
- url = 'https://www.pyside.org',
- download_url = 'https://download.qt.io/official_releases/QtForPython/',
- license = 'LGPL',
- packages = ['PySide2', 'pyside2uic',
- 'pyside2uic.Compiler',
- 'pyside2uic.port_v{}'.format(sys.version_info[0]) ],
- package_dir = {'': pyside_package_dir_name},
- include_package_data = True,
- zip_safe = False,
- entry_points = {
- 'console_scripts': [
- 'pyside2-uic = PySide2.scripts.uic:main',
- ]
- },
- cmdclass = cmd_class_dict,
- # Add a bogus extension module (will never be built here since we
- # are overriding the build command to do it using cmake) so things
- # like bdist_egg will know that there are extension modules and
- # will name the dist with the full platform info.
- ext_modules = extension_modules,
- ext_package = 'PySide2',
-)
+check_allowed_python_version()
+
+setup_runner = SetupRunner(original_argv)
+setup_runner.run_setup()
diff --git a/sources/cmake_helpers/helpers.cmake b/sources/cmake_helpers/helpers.cmake
new file mode 100644
index 00000000..e64b8d9d
--- /dev/null
+++ b/sources/cmake_helpers/helpers.cmake
@@ -0,0 +1,78 @@
+macro(compute_config_py_values
+ full_version_var_name
+ )
+ string(TIMESTAMP PACKAGE_BUILD_DATE "%Y-%m-%dT%H:%M:%S+00:00" UTC)
+ if (PACKAGE_BUILD_DATE)
+ set(PACKAGE_BUILD_DATE "__build_date__ = '${PACKAGE_BUILD_DATE}'")
+ endif()
+
+ if (PACKAGE_SETUP_PY_PACKAGE_VERSION)
+ set(PACKAGE_SETUP_PY_PACKAGE_VERSION_ASSIGNMENT "__setup_py_package_version__ = '${PACKAGE_SETUP_PY_PACKAGE_VERSION}'")
+ set(FINAL_PACKAGE_VERSION ${PACKAGE_SETUP_PY_PACKAGE_VERSION})
+ else()
+ set(FINAL_PACKAGE_VERSION ${${full_version_var_name}})
+ endif()
+
+ if (PACKAGE_SETUP_PY_PACKAGE_TIMESTAMP)
+ set(PACKAGE_SETUP_PY_PACKAGE_TIMESTAMP_ASSIGNMENT "__setup_py_package_timestamp__ = '${PACKAGE_SETUP_PY_PACKAGE_TIMESTAMP}'")
+ else()
+ set(PACKAGE_SETUP_PY_PACKAGE_TIMESTAMP_ASSIGNMENT "")
+ endif()
+
+ find_package(Git)
+ if(GIT_FOUND)
+ # Check if current source folder is inside a git repo, so that commit information can be
+ # queried.
+ execute_process(
+ COMMAND ${GIT_EXECUTABLE} rev-parse --git-dir
+ OUTPUT_VARIABLE PACKAGE_SOURCE_IS_INSIDE_REPO
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ if(PACKAGE_SOURCE_IS_INSIDE_REPO)
+ # Force git dates to be UTC-based.
+ set(ENV{TZ} UTC)
+ execute_process(
+ COMMAND ${GIT_EXECUTABLE} --no-pager show --date=format-local:%Y-%m-%dT%H:%M:%S+00:00 -s --format=%cd HEAD
+ OUTPUT_VARIABLE PACKAGE_BUILD_COMMIT_DATE
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if(PACKAGE_BUILD_COMMIT_DATE)
+ set(PACKAGE_BUILD_COMMIT_DATE "__build_commit_date__ = '${PACKAGE_BUILD_COMMIT_DATE}'")
+ endif()
+ unset(ENV{TZ})
+
+ execute_process(
+ COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
+ OUTPUT_VARIABLE PACKAGE_BUILD_COMMIT_HASH
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if(PACKAGE_BUILD_COMMIT_HASH)
+ set(PACKAGE_BUILD_COMMIT_HASH "__build_commit_hash__ = '${PACKAGE_BUILD_COMMIT_HASH}'")
+ endif()
+
+ execute_process(
+ COMMAND ${GIT_EXECUTABLE} describe HEAD
+ OUTPUT_VARIABLE PACKAGE_BUILD_COMMIT_HASH_DESCRIBED
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ if(PACKAGE_BUILD_COMMIT_HASH_DESCRIBED)
+ set(PACKAGE_BUILD_COMMIT_HASH_DESCRIBED "__build_commit_hash_described__ = '${PACKAGE_BUILD_COMMIT_HASH_DESCRIBED}'")
+ endif()
+
+ endif()
+ endif()
+
+endmacro()
+
+# Creates a new target called "${library_name}_generator" which
+# depends on the mjb_rejected_classes.log file generated by shiboken.
+# This target is added as a dependency to ${library_name} target.
+# This file's timestamp informs cmake when the last generation was
+# done, without force-updating the timestamps of the generated class
+# cpp files.
+# In practical terms this means that changing some injection code in
+# an xml file that modifies only one specific class cpp file, will
+# not force rebuilding all the cpp files, and thus allow for better
+# incremental builds.
+macro(create_generator_target library_name)
+ add_custom_target(${library_name}_generator DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/mjb_rejected_classes.log")
+ add_dependencies(${library_name} ${library_name}_generator)
+endmacro()
diff --git a/sources/pyside2-tools b/sources/pyside2-tools
-Subproject f1b775537e7fbd718516749583b2abf1cb6adbc
+Subproject 9d23904f5d5f13f8e6f72deebefff1d336163ff
diff --git a/sources/pyside2/CMakeLists.txt b/sources/pyside2/CMakeLists.txt
index 358c119a..1d563fb4 100644
--- a/sources/pyside2/CMakeLists.txt
+++ b/sources/pyside2/CMakeLists.txt
@@ -8,11 +8,32 @@ cmake_policy(SET CMP0046 NEW)
project(pysidebindings)
-set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Macros/
+set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/../cmake_helpers/
+ ${CMAKE_SOURCE_DIR}/cmake/Macros/
${CMAKE_MODULE_PATH})
+include(helpers)
option(USE_PYTHON_VERSION "Use specific python version to build pyside2." "")
+# Don't display "up-to-date / install" messages when installing, to reduce visual clutter.
+if (QUIET_BUILD)
+ set(CMAKE_INSTALL_MESSAGE NEVER)
+endif()
+
+# Override message not to display info messages when doing a quiet build.
+if (QUIET_BUILD)
+ function(message)
+ list(GET ARGV 0 MessageType)
+ if (MessageType STREQUAL FATAL_ERROR OR
+ MessageType STREQUAL SEND_ERROR OR
+ MessageType STREQUAL WARNING OR
+ MessageType STREQUAL AUTHOR_WARNING)
+ list(REMOVE_AT ARGV 0)
+ _message(${MessageType} "${ARGV}")
+ endif()
+ endfunction()
+endif()
+
if (USE_PYTHON_VERSION)
find_package(PythonInterp ${USE_PYTHON_VERSION} REQUIRED)
find_package(PythonLibs ${USE_PYTHON_VERSION} REQUIRED)
@@ -244,70 +265,32 @@ else()
CACHE STRING "PySide2 version [full]" FORCE)
endif()
-string(TIMESTAMP PYSIDE_BUILD_DATE "%Y-%m-%dT%H:%M:%S+00:00" UTC)
-if (PYSIDE_BUILD_DATE)
- set(PYSIDE_BUILD_DATE "__build_date__ = '${PYSIDE_BUILD_DATE}'")
-endif()
+compute_config_py_values(BINDING_API_VERSION)
-if (PYSIDE_SETUP_PY_PACKAGE_VERSION)
- set(PYSIDE_SETUP_PY_PACKAGE_VERSION_ASSIGNMENT "__setup_py_package_version__ = '${PYSIDE_SETUP_PY_PACKAGE_VERSION}'")
- set(FINAL_PACKAGE_VERSION ${PYSIDE_SETUP_PY_PACKAGE_VERSION})
-else()
- set(FINAL_PACKAGE_VERSION ${BINDING_API_VERSION_FULL})
-endif()
-
-if (PYSIDE_SETUP_PY_PACKAGE_TIMESTAMP)
- set(PYSIDE_SETUP_PY_PACKAGE_TIMESTAMP_ASSIGNMENT "__setup_py_package_timestamp__ = '${PYSIDE_SETUP_PY_PACKAGE_TIMESTAMP}'")
-else()
- set(PYSIDE_SETUP_PY_PACKAGE_TIMESTAMP_ASSIGNMENT "__setup_py_package_timestamp__ = ''")
-endif()
+include(PySideModules)
-find_package(Git)
-if(GIT_FOUND)
- # Check if current source folder is inside a git repo, so that commit information can be
- # queried.
- execute_process(
- COMMAND ${GIT_EXECUTABLE} rev-parse --git-dir
- OUTPUT_VARIABLE PYSIDE_SOURCE_IS_INSIDE_REPO
- ERROR_QUIET
- OUTPUT_STRIP_TRAILING_WHITESPACE)
-
- if(PYSIDE_SOURCE_IS_INSIDE_REPO)
- # Force git dates to be UTC-based.
- set(ENV{TZ} UTC)
- execute_process(
- COMMAND ${GIT_EXECUTABLE} --no-pager show --date=format-local:%Y-%m-%dT%H:%M:%S+00:00 -s --format=%cd HEAD
- OUTPUT_VARIABLE PYSIDE_BUILD_COMMIT_DATE
- OUTPUT_STRIP_TRAILING_WHITESPACE)
- if(PYSIDE_BUILD_COMMIT_DATE)
- set(PYSIDE_BUILD_COMMIT_DATE "__build_commit_date__ = '${PYSIDE_BUILD_COMMIT_DATE}'")
- endif()
- unset(ENV{TZ})
-
- execute_process(
- COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
- OUTPUT_VARIABLE PYSIDE_BUILD_COMMIT_HASH
- OUTPUT_STRIP_TRAILING_WHITESPACE)
- if(PYSIDE_BUILD_COMMIT_HASH)
- set(PYSIDE_BUILD_COMMIT_HASH "__build_commit_hash__ = '${PYSIDE_BUILD_COMMIT_HASH}'")
- endif()
+macro(COLLECT_MODULE_IF_FOUND shortname)
+ set(name "Qt5${shortname}")
- execute_process(
- COMMAND ${GIT_EXECUTABLE} describe HEAD
- OUTPUT_VARIABLE PYSIDE_BUILD_COMMIT_HASH_DESCRIBED
- OUTPUT_STRIP_TRAILING_WHITESPACE)
- if(PYSIDE_BUILD_COMMIT_HASH_DESCRIBED)
- set(PYSIDE_BUILD_COMMIT_HASH_DESCRIBED "__build_commit_hash_described__ = '${PYSIDE_BUILD_COMMIT_HASH_DESCRIBED}'")
+ # Determine essential/optional/missing
+ set(module_state "missing")
+ list(FIND ALL_ESSENTIAL_MODULES "${shortname}" essentialIndex)
+ if(${essentialIndex} EQUAL -1)
+ list(FIND ALL_OPTIONAL_MODULES "${shortname}" optionalIndex)
+ if(NOT ${optionalIndex} EQUAL -1)
+ set(module_state "optional")
endif()
-
+ else()
+ set(module_state "essential")
endif()
-endif()
-include(PySideModules)
+ # Silence warnings when optional packages are not found when doing a quiet build.
+ set(quiet_argument "")
+ if (QUIET_BUILD AND "${module_state}" STREQUAL "optional")
+ set(quiet_argument "QUIET")
+ endif()
-macro(COLLECT_MODULE_IF_FOUND shortname)
- set(name "Qt5${shortname}")
- find_package(${name})
+ find_package(${name} ${quiet_argument})
# If package is found, _name_found will be equal to 1
set(_name_found "${name}_FOUND")
# _name_dir will keep the path to the directory where the CMake rules were found
@@ -331,18 +314,6 @@ macro(COLLECT_MODULE_IF_FOUND shortname)
get_filename_component(_module_dir "${${_name_dir}}" ABSOLUTE)
string(FIND "${_module_dir}" "${_core_abs_dir}" found_basepath)
- # Determine essential/optional/missing
- set(module_state "missing")
- list(FIND ALL_ESSENTIAL_MODULES "${shortname}" essentialIndex)
- if(${essentialIndex} EQUAL -1)
- list(FIND ALL_OPTIONAL_MODULES "${shortname}" optionalIndex)
- if(NOT ${optionalIndex} EQUAL -1)
- set(module_state "optional")
- endif()
- else()
- set(module_state "essential")
- endif()
-
# If the module was found, and also the module path is the same as the
# Qt5Core base path, we will generate the list with the modules to be installed
set(looked_in_message ". Looked in: ${${_name_dir}}")
diff --git a/sources/pyside2/PySide2/CMakeLists.txt b/sources/pyside2/PySide2/CMakeLists.txt
index 0263f744..ea1a7de1 100644
--- a/sources/pyside2/PySide2/CMakeLists.txt
+++ b/sources/pyside2/PySide2/CMakeLists.txt
@@ -6,9 +6,24 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/global.h.in"
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/__init__.py.in"
"${CMAKE_CURRENT_BINARY_DIR}/__init__.py" @ONLY)
-
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/support/__init__.py"
+ "${CMAKE_CURRENT_BINARY_DIR}/support/__init__.py" COPYONLY)
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/support/generate_pyi.py"
+ "${CMAKE_CURRENT_BINARY_DIR}/support/generate_pyi.py" COPYONLY)
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/support/signature/__init__.py"
+ "${CMAKE_CURRENT_BINARY_DIR}/support/signature/__init__.py" COPYONLY)
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/support/signature/layout.py"
+ "${CMAKE_CURRENT_BINARY_DIR}/support/signature/layout.py" COPYONLY)
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/support/signature/mapping.py"
+ "${CMAKE_CURRENT_BINARY_DIR}/support/signature/mapping.py" COPYONLY)
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/support/signature/typing.py"
+ "${CMAKE_CURRENT_BINARY_DIR}/support/signature/typing.py" COPYONLY)
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/support/signature/lib/__init__.py"
+ "${CMAKE_CURRENT_BINARY_DIR}/support/signature/lib/__init__.py" COPYONLY)
+configure_file("${CMAKE_CURRENT_SOURCE_DIR}/support/signature/lib/enum_sig.py"
+ "${CMAKE_CURRENT_BINARY_DIR}/support/signature/lib/enum_sig.py" COPYONLY)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/_config.py.in"
- "${CMAKE_CURRENT_BINARY_DIR}/_config.py" @ONLY)
+ "${CMAKE_CURRENT_BINARY_DIR}/_config.py" @ONLY)
# Use absolute path instead of relative path, to avoid ninja build errors due to
# duplicate file dependency inconsistency.
@@ -38,21 +53,6 @@ endif()
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/support/__init__.py"
"${CMAKE_CURRENT_BINARY_DIR}/support/__init__.py" COPYONLY)
-configure_file("${CMAKE_CURRENT_SOURCE_DIR}/support/signature/__init__.py"
- "${CMAKE_CURRENT_BINARY_DIR}/support/signature/__init__.py" COPYONLY)
-configure_file("${CMAKE_CURRENT_SOURCE_DIR}/support/signature/loader.py"
- "${CMAKE_CURRENT_BINARY_DIR}/support/signature/loader.py" COPYONLY)
-configure_file("${CMAKE_CURRENT_SOURCE_DIR}/support/signature/mapping.py"
- "${CMAKE_CURRENT_BINARY_DIR}/support/signature/mapping.py" COPYONLY)
-configure_file("${CMAKE_CURRENT_SOURCE_DIR}/support/signature/parser.py"
- "${CMAKE_CURRENT_BINARY_DIR}/support/signature/parser.py" COPYONLY)
-if (PYTHON_VERSION_MAJOR EQUAL 3)
-else()
- configure_file("${CMAKE_CURRENT_SOURCE_DIR}/support/signature/backport_inspect.py"
- "${CMAKE_CURRENT_BINARY_DIR}/support/signature/backport_inspect.py" COPYONLY)
- configure_file("${CMAKE_CURRENT_SOURCE_DIR}/support/signature/typing27.py"
- "${CMAKE_CURRENT_BINARY_DIR}/support/signature/typing.py" COPYONLY)
-endif()
# now compile all modules.
file(READ "${CMAKE_CURRENT_BINARY_DIR}/pyside2_global.h" pyside2_global_contents)
@@ -93,8 +93,19 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/_config.py"
DESTINATION "${PYTHON_SITE_PACKAGES}/${BINDING_NAME}${pyside2_SUFFIX}")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/_git_pyside_version.py"
DESTINATION "${PYTHON_SITE_PACKAGES}/${BINDING_NAME}${pyside2_SUFFIX}")
-install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/typesystem_templates.xml
+install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/templates/core_common.xml
+ DESTINATION share/PySide2${pyside_SUFFIX}/typesystems)
+install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/templates/gui_common.xml
+ DESTINATION share/PySide2${pyside_SUFFIX}/typesystems)
+install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/templates/widgets_common.xml
+ DESTINATION share/PySide2${pyside_SUFFIX}/typesystems)
+install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/templates/datavisualization_common.xml
+ DESTINATION share/PySide2${pyside_SUFFIX}/typesystems)
+install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/templates/opengl_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
DESTINATION include/${BINDING_NAME}${pyside2_SUFFIX})
-
diff --git a/sources/pyside2/PySide2/Qt3DAnimation/CMakeLists.txt b/sources/pyside2/PySide2/Qt3DAnimation/CMakeLists.txt
index 9bdf36ad..258a011b 100644
--- a/sources/pyside2/PySide2/Qt3DAnimation/CMakeLists.txt
+++ b/sources/pyside2/PySide2/Qt3DAnimation/CMakeLists.txt
@@ -45,11 +45,10 @@ set(Qt3DAnimation_libraries pyside2
set(Qt3DAnimation_deps Qt3DRender)
-create_pyside_module(Qt3DAnimation
- Qt3DAnimation_include_dirs
- Qt3DAnimation_libraries
- Qt3DAnimation_deps
- Qt3DAnimation_SOURCE_DIR
- Qt3DAnimation_SRC
- ""
- ${Qt3DAnimation_BINARY_DIR}/typesystem_3danimation.xml)
+create_pyside_module(NAME Qt3DAnimation
+ INCLUDE_DIRS Qt3DAnimation_include_dirs
+ LIBRARIES Qt3DAnimation_libraries
+ DEPS Qt3DAnimation_deps
+ TYPESYSTEM_PATH Qt3DAnimation_SOURCE_DIR
+ SOURCES Qt3DAnimation_SRC
+ TYPESYSTEM_NAME ${Qt3DAnimation_BINARY_DIR}/typesystem_3danimation.xml)
diff --git a/sources/pyside2/PySide2/Qt3DCore/CMakeLists.txt b/sources/pyside2/PySide2/Qt3DCore/CMakeLists.txt
index 53d3cc63..d046f8fc 100644
--- a/sources/pyside2/PySide2/Qt3DCore/CMakeLists.txt
+++ b/sources/pyside2/PySide2/Qt3DCore/CMakeLists.txt
@@ -64,11 +64,10 @@ set(Qt3DCore_libraries pyside2
set(Qt3DCore_deps QtGui QtNetwork)
-create_pyside_module(Qt3DCore
- Qt3DCore_include_dirs
- Qt3DCore_libraries
- Qt3DCore_deps
- Qt3DCore_SOURCE_DIR
- Qt3DCore_SRC
- ""
- ${Qt3DCore_BINARY_DIR}/typesystem_3dcore.xml)
+create_pyside_module(NAME Qt3DCore
+ INCLUDE_DIRS Qt3DCore_include_dirs
+ LIBRARIES Qt3DCore_libraries
+ DEPS Qt3DCore_deps
+ TYPESYSTEM_PATH Qt3DCore_SOURCE_DIR
+ SOURCES Qt3DCore_SRC
+ TYPESYSTEM_NAME ${Qt3DCore_BINARY_DIR}/typesystem_3dcore.xml)
diff --git a/sources/pyside2/PySide2/Qt3DCore/typesystem_3dcore.xml b/sources/pyside2/PySide2/Qt3DCore/typesystem_3dcore.xml
index fb7a83ba..013a4916 100644
--- a/sources/pyside2/PySide2/Qt3DCore/typesystem_3dcore.xml
+++ b/sources/pyside2/PySide2/Qt3DCore/typesystem_3dcore.xml
@@ -45,19 +45,41 @@
<namespace-type name="Qt3DCore">
<enum-type name="ChangeFlag" flags="ChangeFlags"/>
<object-type name="QAbstractAspect"/>
+ <object-type name="QAbstractEngine"/>
<object-type name="QAbstractSkeleton" since="5.10"/>
<object-type name="QArmature" since="5.10"/>
- <object-type name="QAspectEngine"/>
+ <object-type name="QAspectEngine">
+ <modify-function signature="registerAspect(Qt3DCore::QAbstractAspect*)">
+ <modify-argument index="this">
+ <parent index="1" action="add"/>
+ </modify-argument>
+ </modify-function>
+ </object-type>
<object-type name="QAspectJob"/>
<object-type name="QBackendNode">
<enum-type name="Mode"/>
</object-type>
+ <!-- TODO: Solve issues related to windows and a unresolved
+ external symbol
+ <object-type name="QBackendNodeMapper"/>-->
<object-type name="QComponent"/>
<object-type name="QComponentAddedChange"/>
<object-type name="QComponentRemovedChange"/>
<object-type name="QDynamicPropertyUpdatedChange"/>
- <object-type name="QEntity"/>
- <object-type name="QJoint" since="5.10"/>
+ <object-type name="QEntity">
+ <modify-function signature="addComponent(Qt3DCore::QComponent*)">
+ <modify-argument index="this">
+ <parent index="1" action="add"/>
+ </modify-argument>
+ </modify-function>
+ </object-type>
+ <object-type name="QJoint" since="5.10">
+ <modify-function signature="addChildJoint(Qt3DCore::QJoint*)">
+ <modify-argument index="this">
+ <parent index="1" action="add"/>
+ </modify-argument>
+ </modify-function>
+ </object-type>
<object-type name="QNode">
<enum-type name="PropertyTrackingMode"/>
</object-type>
@@ -88,5 +110,10 @@
<!-- Disambiguate from QtGui/qtransform.h -->
<include file-name="Qt3DCore/qtransform.h" location="global"/>
</object-type>
+ <namespace-type name="Quick">
+ <object-type name="QQmlAspectEngine">
+ <enum-type name="Status"/>
+ </object-type>
+ </namespace-type>
</namespace-type>
</typesystem>
diff --git a/sources/pyside2/PySide2/Qt3DExtras/CMakeLists.txt b/sources/pyside2/PySide2/Qt3DExtras/CMakeLists.txt
index 4bc25d52..bd750949 100644
--- a/sources/pyside2/PySide2/Qt3DExtras/CMakeLists.txt
+++ b/sources/pyside2/PySide2/Qt3DExtras/CMakeLists.txt
@@ -71,11 +71,10 @@ set(Qt3DExtras_libraries pyside2
set(Qt3DExtras_deps Qt3DRender)
-create_pyside_module(Qt3DExtras
- Qt3DExtras_include_dirs
- Qt3DExtras_libraries
- Qt3DExtras_deps
- Qt3DExtras_SOURCE_DIR
- Qt3DExtras_SRC
- ""
- ${Qt3DExtras_BINARY_DIR}/typesystem_3dextras.xml)
+create_pyside_module(NAME Qt3DExtras
+ INCLUDE_DIRS Qt3DExtras_include_dirs
+ LIBRARIES Qt3DExtras_libraries
+ DEPS Qt3DExtras_deps
+ TYPESYSTEM_PATH Qt3DExtras_SOURCE_DIR
+ SOURCES Qt3DExtras_SRC
+ TYPESYSTEM_NAME ${Qt3DExtras_BINARY_DIR}/typesystem_3dextras.xml)
diff --git a/sources/pyside2/PySide2/Qt3DInput/CMakeLists.txt b/sources/pyside2/PySide2/Qt3DInput/CMakeLists.txt
index 694f373f..a3366c9b 100644
--- a/sources/pyside2/PySide2/Qt3DInput/CMakeLists.txt
+++ b/sources/pyside2/PySide2/Qt3DInput/CMakeLists.txt
@@ -46,11 +46,10 @@ set(Qt3DInput_libraries pyside2
set(Qt3DInput_deps Qt3DCore)
-create_pyside_module(Qt3DInput
- Qt3DInput_include_dirs
- Qt3DInput_libraries
- Qt3DInput_deps
- Qt3DInput_SOURCE_DIR
- Qt3DInput_SRC
- ""
- ${Qt3DInput_BINARY_DIR}/typesystem_3dinput.xml)
+create_pyside_module(NAME Qt3DInput
+ INCLUDE_DIRS Qt3DInput_include_dirs
+ LIBRARIES Qt3DInput_libraries
+ DEPS Qt3DInput_deps
+ TYPESYSTEM_PATH Qt3DInput_SOURCE_DIR
+ SOURCES Qt3DInput_SRC
+ TYPESYSTEM_NAME ${Qt3DInput_BINARY_DIR}/typesystem_3dinput.xml)
diff --git a/sources/pyside2/PySide2/Qt3DInput/typesystem_3dinput.xml b/sources/pyside2/PySide2/Qt3DInput/typesystem_3dinput.xml
index dd72c5c0..ebac94f0 100644
--- a/sources/pyside2/PySide2/Qt3DInput/typesystem_3dinput.xml
+++ b/sources/pyside2/PySide2/Qt3DInput/typesystem_3dinput.xml
@@ -45,7 +45,9 @@
<namespace-type name="Qt3DInput">
<object-type name="QAbstractActionInput"/>
<object-type name="QAbstractAxisInput"/>
- <object-type name="QAbstractPhysicalDevice"/>
+ <object-type name="QAbstractPhysicalDevice">
+ <enum-type name="DeviceStatus"/>
+ </object-type>
<object-type name="QAction"/>
<object-type name="QActionInput"/>
<object-type name="QAnalogAxisInput"/>
@@ -57,29 +59,34 @@
<object-type name="QButtonAxisInput"/>
<object-type name="QInputAspect"/>
<object-type name="QInputChord"/>
+ <!-- On windows this raises the following error:
+ type 'Qt3DInput::QInputDeviceIntegration' is specified in typesystem, but not defined.
+ This could potentially lead to compilation errors.
+ <object-type name="QInputDeviceIntegration"/>
+ -->
<object-type name="QInputSequence"/>
<object-type name="QInputSettings"/>
+ <object-type name="QKeyboardDevice"/>
<object-type name="QKeyboardHandler"/>
- <object-type name="QKeyEvent">
- <modify-function signature="QKeyEvent(const Qt3DInput::QKeyEvent&amp;)" remove="all"/>
- </object-type>
+ <object-type name="QKeyEvent"/>
<object-type name="QLogicalDevice"/>
- <object-type name="QKeyboardDevice"/>
<object-type name="QMouseDevice">
<enum-type name="Axis"/>
</object-type>
- <!-- Fixme: shiboken2 mistakenly thinks that Qt3DInput::QMouseEvent(::QMouseEvent)
- is a copy constructor of Qt3DInput::QMouseEvent. Work around by suppressing them -->
<object-type name="QMouseEvent">
<enum-type name="Buttons"/>
<enum-type name="Modifiers"/>
- <modify-function signature="QMouseEvent(const Qt3DInput::QMouseEvent&amp;)" remove="all"/>
</object-type>
<object-type name="QWheelEvent">
<enum-type name="Buttons"/>
<enum-type name="Modifiers"/>
- <modify-function signature="QWheelEvent(const Qt3DInput::QWheelEvent&amp;)" remove="all"/>
</object-type>
<object-type name="QMouseHandler"/>
+ <!-- On windows this raise the following error:
+ qt3dinput_module_wrapper.cpp.obj : error LNK2019:
+ unresolved external symbol "void __cdecl init_Qt3DInput_QPhysicalDeviceCreatedChangeBase(struct _object *)"
+ (?init_Qt3DInput_QPhysicalDeviceCreatedChangeBase@@YAXPAU_object@@@Z) referenced in function _PyInit_Qt3DInput
+ <object-type name="QPhysicalDeviceCreatedChangeBase"/>
+ -->
</namespace-type>
</typesystem>
diff --git a/sources/pyside2/PySide2/Qt3DLogic/CMakeLists.txt b/sources/pyside2/PySide2/Qt3DLogic/CMakeLists.txt
index 23cde880..8cf4de37 100644
--- a/sources/pyside2/PySide2/Qt3DLogic/CMakeLists.txt
+++ b/sources/pyside2/PySide2/Qt3DLogic/CMakeLists.txt
@@ -27,11 +27,10 @@ set(Qt3DLogic_libraries pyside2
set(Qt3DLogic_deps Qt3DCore)
-create_pyside_module(Qt3DLogic
- Qt3DLogic_include_dirs
- Qt3DLogic_libraries
- Qt3DLogic_deps
- Qt3DLogic_SOURCE_DIR
- Qt3DLogic_SRC
- ""
- ${Qt3DLogic_BINARY_DIR}/typesystem_3dlogic.xml)
+create_pyside_module(NAME Qt3DLogic
+ INCLUDE_DIRS Qt3DLogic_include_dirs
+ LIBRARIES Qt3DLogic_libraries
+ DEPS Qt3DLogic_deps
+ TYPESYSTEM_PATH Qt3DLogic_SOURCE_DIR
+ SOURCES Qt3DLogic_SRC
+ TYPESYSTEM_NAME ${Qt3DLogic_BINARY_DIR}/typesystem_3dlogic.xml)
diff --git a/sources/pyside2/PySide2/Qt3DRender/CMakeLists.txt b/sources/pyside2/PySide2/Qt3DRender/CMakeLists.txt
index 1b859ca1..011536ce 100644
--- a/sources/pyside2/PySide2/Qt3DRender/CMakeLists.txt
+++ b/sources/pyside2/PySide2/Qt3DRender/CMakeLists.txt
@@ -145,11 +145,10 @@ set(Qt3DRender_libraries pyside2
set(Qt3DRender_deps Qt3DCore)
-create_pyside_module(Qt3DRender
- Qt3DRender_include_dirs
- Qt3DRender_libraries
- Qt3DRender_deps
- Qt3DRender_SOURCE_DIR
- Qt3DRender_SRC
- ""
- ${Qt3DRender_BINARY_DIR}/typesystem_3drender.xml)
+create_pyside_module(NAME Qt3DRender
+ INCLUDE_DIRS Qt3DRender_include_dirs
+ LIBRARIES Qt3DRender_libraries
+ DEPS Qt3DRender_deps
+ TYPESYSTEM_PATH Qt3DRender_SOURCE_DIR
+ SOURCES Qt3DRender_SRC
+ TYPESYSTEM_NAME ${Qt3DRender_BINARY_DIR}/typesystem_3drender.xml)
diff --git a/sources/pyside2/PySide2/QtAxContainer/CMakeLists.txt b/sources/pyside2/PySide2/QtAxContainer/CMakeLists.txt
index a3971786..6e9492d4 100644
--- a/sources/pyside2/PySide2/QtAxContainer/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtAxContainer/CMakeLists.txt
@@ -36,11 +36,10 @@ set(QtAxContainer_libraries pyside2
set(QtAxContainer_deps QtWidgets)
-create_pyside_module(QtAxContainer
- QtAxContainer_include_dirs
- QtAxContainer_libraries
- QtAxContainer_deps
- QtAxContainer_SOURCE_DIR
- QtAxContainer_SRC
- ""
- ${QtAxContainer_BINARY_DIR}/typesystem_axcontainer.xml)
+create_pyside_module(NAME QtAxContainer
+ INCLUDE_DIRS QtAxContainer_include_dirs
+ LIBRARIES QtAxContainer_libraries
+ DEPS QtAxContainer_deps
+ TYPESYSTEM_PATH QtAxContainer_SOURCE_DIR
+ SOURCES QtAxContainer_SRC
+ TYPESYSTEM_NAME ${QtAxContainer_BINARY_DIR}/typesystem_axcontainer.xml)
diff --git a/sources/pyside2/PySide2/QtCharts/CMakeLists.txt b/sources/pyside2/PySide2/QtCharts/CMakeLists.txt
index fa177300..c7611edb 100644
--- a/sources/pyside2/PySide2/QtCharts/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtCharts/CMakeLists.txt
@@ -81,10 +81,9 @@ set(QtCharts_libraries pyside2
set(QtCharts_deps QtCore QtGui QtWidgets)
-create_pyside_module(QtCharts
- QtCharts_include_dirs
- QtCharts_libraries
- QtCharts_deps
- QtCharts_SOURCE_DIR
- QtCharts_SRC
- "")
+create_pyside_module(NAME QtCharts
+ INCLUDE_DIRS QtCharts_include_dirs
+ LIBRARIES QtCharts_libraries
+ DEPS QtCharts_deps
+ TYPESYSTEM_PATH QtCharts_SOURCE_DIR
+ SOURCES QtCharts_SRC)
diff --git a/sources/pyside2/PySide2/QtCharts/typesystem_charts.xml b/sources/pyside2/PySide2/QtCharts/typesystem_charts.xml
index ebcd09b1..14224751 100644
--- a/sources/pyside2/PySide2/QtCharts/typesystem_charts.xml
+++ b/sources/pyside2/PySide2/QtCharts/typesystem_charts.xml
@@ -40,7 +40,7 @@
****************************************************************************/
-->
<typesystem package="PySide2.QtCharts">
- <load-typesystem name="QtWidgets/typesystem_widgets.xml" generate="no" />
+ <load-typesystem name="QtWidgets/typesystem_widgets.xml" generate="no"/>
<namespace-type name="QtCharts">
<object-type name="QAbstractAxis" since="5.7">
<enum-type name="AxisType"/>
@@ -164,14 +164,10 @@
</modify-argument>
</modify-function>
<modify-function signature="removeAxis(QtCharts::QAbstractAxis*)">
- <inject-code>
- Shiboken::Object::releaseOwnership(%PYARG_1);
- </inject-code>
+ <inject-code file="../glue/qtcharts.cpp" snippet="qchart-releaseownership"/>
</modify-function>
<modify-function signature="removeSeries(QtCharts::QAbstractSeries*)">
- <inject-code>
- Shiboken::Object::releaseOwnership(%PYARG_1);
- </inject-code>
+ <inject-code file="../glue/qtcharts.cpp" snippet="qchart-releaseownership"/>
</modify-function>
</object-type>
<object-type name="QChartView" since="5.7">
diff --git a/sources/pyside2/PySide2/QtConcurrent/CMakeLists.txt b/sources/pyside2/PySide2/QtConcurrent/CMakeLists.txt
index 4fb62ee9..9bd5c054 100644
--- a/sources/pyside2/PySide2/QtConcurrent/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtConcurrent/CMakeLists.txt
@@ -22,10 +22,9 @@ set(QtConcurrent_libraries pyside2
)
set(QtConcurrent_deps QtCore)
-create_pyside_module(QtConcurrent
- QtConcurrent_include_dirs
- QtConcurrent_libraries
- QtConcurrent_deps
- QtConcurrent_SOURCE_DIR
- QtConcurrent_SRC
- "")
+create_pyside_module(NAME QtConcurrent
+ INCLUDE_DIRS QtConcurrent_include_dirs
+ LIBRARIES QtConcurrent_libraries
+ DEPS QtConcurrent_deps
+ TYPESYSTEM_PATH QtConcurrent_SOURCE_DIR
+ SOURCES QtConcurrent_SRC)
diff --git a/sources/pyside2/PySide2/QtConcurrent/typesystem_concurrent.xml b/sources/pyside2/PySide2/QtConcurrent/typesystem_concurrent.xml
index bed94777..bdf4e6fa 100644
--- a/sources/pyside2/PySide2/QtConcurrent/typesystem_concurrent.xml
+++ b/sources/pyside2/PySide2/QtConcurrent/typesystem_concurrent.xml
@@ -47,7 +47,7 @@
<namespace-type name="QtConcurrent" target-type="class">
<rejection class="QtConcurrent" enum-name="enum_1"/>
<enum-type name="ReduceOption" flags="ReduceOptions"/>
- <enum-type name="ThreadFunctionResult" />
+ <enum-type name="ThreadFunctionResult"/>
<extra-includes>
<include file-name="qtconcurrentreducekernel.h" location="global"/>
<include file-name="qtconcurrentthreadengine.h" location="global"/>
diff --git a/sources/pyside2/PySide2/QtCore/CMakeLists.txt b/sources/pyside2/PySide2/QtCore/CMakeLists.txt
index 1d0b7d41..25d30e8b 100644
--- a/sources/pyside2/PySide2/QtCore/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtCore/CMakeLists.txt
@@ -16,6 +16,7 @@ ${QtCore_GEN_DIR}/qabstracteventdispatcher_timerinfo_wrapper.cpp
${QtCore_GEN_DIR}/qabstracteventdispatcher_wrapper.cpp
${QtCore_GEN_DIR}/qabstractitemmodel_wrapper.cpp
${QtCore_GEN_DIR}/qabstractlistmodel_wrapper.cpp
+${QtCore_GEN_DIR}/qabstractnativeeventfilter_wrapper.cpp
${QtCore_GEN_DIR}/qabstractproxymodel_wrapper.cpp
${QtCore_GEN_DIR}/qabstractstate_wrapper.cpp
${QtCore_GEN_DIR}/qabstracttablemodel_wrapper.cpp
@@ -28,6 +29,15 @@ ${QtCore_GEN_DIR}/qbuffer_wrapper.cpp
${QtCore_GEN_DIR}/qbytearray_wrapper.cpp
${QtCore_GEN_DIR}/qbytearraymatcher_wrapper.cpp
${QtCore_GEN_DIR}/qchildevent_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}/qcborvalue_wrapper.cpp
${QtCore_GEN_DIR}/qcollator_wrapper.cpp
${QtCore_GEN_DIR}/qcollatorsortkey_wrapper.cpp
${QtCore_GEN_DIR}/qcommandlineoption_wrapper.cpp
@@ -170,6 +180,11 @@ ${SPECIFIC_OS_FILES}
${QtCore_GEN_DIR}/qtcore_module_wrapper.cpp
)
+set(QtCore_glue_sources
+ "${QtCore_SOURCE_DIR}/glue/qeasingcurve_glue.cpp"
+ "${QtCore_SOURCE_DIR}/glue/qeasingcurve_glue.h"
+)
+
configure_file("${QtCore_SOURCE_DIR}/typesystem_core.xml.in"
"${QtCore_BINARY_DIR}/typesystem_core.xml" @ONLY)
@@ -185,12 +200,14 @@ set(QtCore_libraries pyside2
${SHIBOKEN_LIBRARY}
${Qt5Core_LIBRARIES}
)
-create_pyside_module(QtCore
- QtCore_include_dirs
- QtCore_libraries
- ""
- QtCore_SOURCE_DIR
- QtCore_SRC
- QtCore_gluecode
- ${QtCore_BINARY_DIR}/typesystem_core.xml)
+
+create_pyside_module(NAME QtCore
+ INCLUDE_DIRS QtCore_include_dirs
+ LIBRARIES QtCore_libraries
+ TYPESYSTEM_PATH QtCore_SOURCE_DIR
+ SOURCES QtCore_SRC
+ STATIC_SOURCES QtCore_gluecode
+ TYPESYSTEM_NAME ${QtCore_BINARY_DIR}/typesystem_core.xml
+ GLUE_SOURCES QtCore_glue_sources
+ )
diff --git a/sources/pyside2/PySide2/QtCore/glue/qbytearray_msetitem.cpp b/sources/pyside2/PySide2/QtCore/glue/qbytearray_msetitem.cpp
deleted file mode 100644
index 1349f40f..00000000
--- a/sources/pyside2/PySide2/QtCore/glue/qbytearray_msetitem.cpp
+++ /dev/null
@@ -1,158 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 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$
-**
-****************************************************************************/
-
-if (PyIndex_Check(_key)) {
- Py_ssize_t _i = PyNumber_AsSsize_t(_key, PyExc_IndexError);
- if (_i == -1 && PyErr_Occurred())
- return -1;
-
- if (_i < 0)
- _i += %CPPSELF.count();
-
- if (_i < 0 || _i >= %CPPSELF.size()) {
- PyErr_SetString(PyExc_IndexError, "QByteArray index out of range");
- return -1;
- }
-
- // Provide more specific error message for bytes/str, bytearray, QByteArray respectively
-#ifdef IS_PY3K
- if (PyBytes_Check(_value)) {
- if (Py_SIZE(_value) != 1) {
- PyErr_SetString(PyExc_ValueError, "bytes must be of size 1");
-#else
- if (PyString_CheckExact(_value)) {
- if (Py_SIZE(_value) != 1) {
- PyErr_SetString(PyExc_ValueError, "str must be of size 1");
-#endif
- return -1;
- }
- } else if (PyByteArray_Check(_value)) {
- if (Py_SIZE(_value) != 1) {
- PyErr_SetString(PyExc_ValueError, "bytearray must be of size 1");
- return -1;
- }
- } else if (reinterpret_cast<PyTypeObject *>(Py_TYPE(_value)) == reinterpret_cast<PyTypeObject *>(SbkPySide2_QtCoreTypes[SBK_QBYTEARRAY_IDX])) {
- if (PyObject_Length(_value) != 1) {
- PyErr_SetString(PyExc_ValueError, "QByteArray must be of size 1");
- return -1;
- }
- } else {
-#ifdef IS_PY3K
- PyErr_SetString(PyExc_ValueError, "a bytes, bytearray, QByteArray of size 1 is required");
-#else
- PyErr_SetString(PyExc_ValueError, "a str, bytearray, QByteArray of size 1 is required");
-#endif
- return -1;
- }
-
- // Not support int or long.
- %CPPSELF.remove(_i, 1);
- PyObject *args = Py_BuildValue("(nO)", _i, _value);
- PyObject *result = Sbk_QByteArrayFunc_insert(self, args);
- Py_DECREF(args);
- Py_XDECREF(result);
- return !result ? -1 : 0;
-} else if (PySlice_Check(_key)) {
- Py_ssize_t start, stop, step, slicelength, value_length;
-
-#ifdef IS_PY3K
- PyObject *key = _key;
-#else
- PySliceObject *key = reinterpret_cast<PySliceObject *>(_key);
-#endif
- if (PySlice_GetIndicesEx(key, %CPPSELF.count(), &start, &stop, &step, &slicelength) < 0) {
- return -1;
- }
- // The parameter candidates are: bytes/str, bytearray, QByteArray itself.
- // Not support iterable which contains ints between 0~255
-
- // case 1: value is NULL, means delete the items within the range
- // case 2: step is 1, means shrink or expanse
- // case 3: step is not 1, then the number of slots have to equal the number of items in _value
- QByteArray ba;
- if (_value == NULL || _value == Py_None) {
- ba = QByteArray();
- value_length = 0;
- } else if (!(PyBytes_Check(_value) || PyByteArray_Check(_value) || reinterpret_cast<PyTypeObject *>(Py_TYPE(_value)) == reinterpret_cast<PyTypeObject *>(SbkPySide2_QtCoreTypes[SBK_QBYTEARRAY_IDX]))) {
- PyErr_Format(PyExc_TypeError, "bytes, bytearray or QByteArray is required, not %.200s", Py_TYPE(_value)->tp_name);
- return -1;
- } else {
- value_length = PyObject_Length(_value);
- }
-
- if (step != 1 && value_length != slicelength) {
- PyErr_Format(PyExc_ValueError, "attempt to assign %s of size %d to extended slice of size %d",Py_TYPE(_value)->tp_name, value_length, slicelength);
- return -1;
- }
-
- if (step != 1) {
- int i = start;
- for (int j = 0; j < slicelength; j++) {
- PyObject *item = PyObject_GetItem(_value, PyLong_FromLong(j));
- QByteArray temp;
-#ifdef IS_PY3K
- if (PyLong_Check(item)) {
-#else
- if (PyLong_Check(item) || PyInt_Check(item)) {
-#endif
- int overflow;
- long ival = PyLong_AsLongAndOverflow(item, &overflow);
- // Not suppose to bigger than 255 because only bytes, bytearray, QByteArray were accept
- const char *el = reinterpret_cast<const char*>(&ival);
- temp = QByteArray(el);
- } else {
- temp = %CONVERTTOCPP[QByteArray](item);
- }
-
- %CPPSELF.replace(i, 1, temp);
- i += step;
- }
- return 0;
- } else {
- ba = %CONVERTTOCPP[QByteArray](_value);
- %CPPSELF.replace(start, slicelength, ba);
- return 0;
- }
-} else {
- PyErr_Format(PyExc_TypeError, "QBytearray indices must be integers or slices, not %.200s",
- Py_TYPE(_key)->tp_name);
- return -1;
-}
-
-
diff --git a/sources/pyside2/PySide2/QtCore/glue/qobject_connect.cpp b/sources/pyside2/PySide2/QtCore/glue/qobject_connect.cpp
deleted file mode 100644
index 20f3720b..00000000
--- a/sources/pyside2/PySide2/QtCore/glue/qobject_connect.cpp
+++ /dev/null
@@ -1,227 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-static bool isDecorator(PyObject* method, PyObject* self)
-{
- Shiboken::AutoDecRef methodName(PyObject_GetAttrString(method, "__name__"));
- if (!PyObject_HasAttr(self, methodName))
- return true;
- Shiboken::AutoDecRef otherMethod(PyObject_GetAttr(self, methodName));
- return PyMethod_GET_FUNCTION(otherMethod.object()) != PyMethod_GET_FUNCTION(method);
-}
-
-static bool getReceiver(QObject *source, const char* signal, PyObject* callback, QObject** receiver, PyObject** self, QByteArray* callbackSig)
-{
- bool forceGlobalReceiver = false;
- if (PyMethod_Check(callback)) {
- *self = PyMethod_GET_SELF(callback);
- if (%CHECKTYPE[QObject*](*self))
- *receiver = %CONVERTTOCPP[QObject*](*self);
- forceGlobalReceiver = isDecorator(callback, *self);
- } else if (PyCFunction_Check(callback)) {
- *self = PyCFunction_GET_SELF(callback);
- if (*self && %CHECKTYPE[QObject*](*self))
- *receiver = %CONVERTTOCPP[QObject*](*self);
- } else if (PyCallable_Check(callback)) {
- // Ok, just a callable object
- *receiver = 0;
- *self = 0;
- }
-
- bool usingGlobalReceiver = !*receiver || forceGlobalReceiver;
-
- // Check if this callback is a overwrite of a non-virtual Qt slot.
- if (!usingGlobalReceiver && receiver && self) {
- *callbackSig = PySide::Signal::getCallbackSignature(signal, *receiver, callback, usingGlobalReceiver).toLatin1();
- const QMetaObject* metaObject = (*receiver)->metaObject();
- int slotIndex = metaObject->indexOfSlot(callbackSig->constData());
- if (slotIndex != -1 && slotIndex < metaObject->methodOffset() && PyMethod_Check(callback))
- usingGlobalReceiver = true;
- }
-
- if (usingGlobalReceiver) {
- PySide::SignalManager& signalManager = PySide::SignalManager::instance();
- *receiver = signalManager.globalReceiver(source, callback);
- *callbackSig = PySide::Signal::getCallbackSignature(signal, *receiver, callback, usingGlobalReceiver).toLatin1();
- }
-
- return usingGlobalReceiver;
-}
-
-static bool qobjectConnect(QObject* source, const char* signal, QObject* receiver, const char* slot, Qt::ConnectionType type)
-{
- if (!signal || !slot)
- return false;
-
- if (!PySide::Signal::checkQtSignal(signal))
- return false;
- signal++;
-
- if (!PySide::SignalManager::registerMetaMethod(source, signal, QMetaMethod::Signal))
- return false;
-
- bool isSignal = PySide::Signal::isQtSignal(slot);
- slot++;
- PySide::SignalManager::registerMetaMethod(receiver, slot, isSignal ? QMetaMethod::Signal : QMetaMethod::Slot);
- bool connection;
- Py_BEGIN_ALLOW_THREADS
- connection = QObject::connect(source, signal - 1, receiver, slot - 1, type);
- Py_END_ALLOW_THREADS
- return connection;
-}
-
-static bool qobjectConnect(QObject* source, QMetaMethod signal, QObject* receiver, QMetaMethod slot, Qt::ConnectionType type)
-{
- return qobjectConnect(source, signal.methodSignature(), receiver, slot.methodSignature(), type);
-}
-
-static bool qobjectConnectCallback(QObject* source, const char* signal, PyObject* callback, Qt::ConnectionType type)
-{
- if (!signal || !PySide::Signal::checkQtSignal(signal))
- return false;
- signal++;
-
- int signalIndex = PySide::SignalManager::registerMetaMethodGetIndex(source, signal, QMetaMethod::Signal);
- if (signalIndex == -1)
- return false;
-
- PySide::SignalManager& signalManager = PySide::SignalManager::instance();
-
- // Extract receiver from callback
- QObject* receiver = 0;
- PyObject* self = 0;
- QByteArray callbackSig;
- bool usingGlobalReceiver = getReceiver(source, signal, callback, &receiver, &self, &callbackSig);
- if (receiver == 0 && self == 0)
- return false;
-
- const QMetaObject* metaObject = receiver->metaObject();
- const char* slot = callbackSig.constData();
- int slotIndex = metaObject->indexOfSlot(slot);
- QMetaMethod signalMethod = metaObject->method(signalIndex);
-
- if (slotIndex == -1) {
- if (!usingGlobalReceiver && self && !Shiboken::Object::hasCppWrapper((SbkObject*)self)) {
- qWarning() << "You can't add dynamic slots on an object originated from C++.";
- if (usingGlobalReceiver)
- signalManager.releaseGlobalReceiver(source, receiver);
-
- return false;
- }
-
- if (usingGlobalReceiver)
- slotIndex = signalManager.globalReceiverSlotIndex(receiver, slot);
- else
- slotIndex = PySide::SignalManager::registerMetaMethodGetIndex(receiver, slot, QMetaMethod::Slot);
-
- if (slotIndex == -1) {
- if (usingGlobalReceiver)
- signalManager.releaseGlobalReceiver(source, receiver);
-
- return false;
- }
- }
- bool connection;
- Py_BEGIN_ALLOW_THREADS
- connection = QMetaObject::connect(source, signalIndex, receiver, slotIndex, type);
- Py_END_ALLOW_THREADS
- if (connection) {
- if (usingGlobalReceiver)
- signalManager.notifyGlobalReceiver(receiver);
- #ifndef AVOID_PROTECTED_HACK
- source->connectNotify(signalMethod); //Qt5: QMetaMethod instead of char*
- #else
- // Need to cast to QObjectWrapper* and call the public version of
- // connectNotify when avoiding the protected hack.
- reinterpret_cast<QObjectWrapper*>(source)->connectNotify(signalMethod); //Qt5: QMetaMethod instead of char*
- #endif
-
- return connection;
- }
-
- if (usingGlobalReceiver)
- signalManager.releaseGlobalReceiver(source, receiver);
-
- return false;
-}
-
-
-static bool qobjectDisconnectCallback(QObject* source, const char* signal, PyObject* callback)
-{
- if (!PySide::Signal::checkQtSignal(signal))
- return false;
-
- PySide::SignalManager& signalManager = PySide::SignalManager::instance();
-
- // Extract receiver from callback
- QObject* receiver = 0;
- PyObject* self = 0;
- QByteArray callbackSig;
- QMetaMethod slotMethod;
- bool usingGlobalReceiver = getReceiver(NULL, signal, callback, &receiver, &self, &callbackSig);
- if (receiver == 0 && self == 0)
- return false;
-
- const QMetaObject* metaObject = receiver->metaObject();
- int signalIndex = source->metaObject()->indexOfSignal(++signal);
- int slotIndex = -1;
-
- slotIndex = metaObject->indexOfSlot(callbackSig);
- slotMethod = metaObject->method(slotIndex);
-
- bool disconnected;
- Py_BEGIN_ALLOW_THREADS
- disconnected = QMetaObject::disconnectOne(source, signalIndex, receiver, slotIndex);
- Py_END_ALLOW_THREADS
-
- if (disconnected) {
- if (usingGlobalReceiver)
- signalManager.releaseGlobalReceiver(source, receiver);
-
- #ifndef AVOID_PROTECTED_HACK
- source->disconnectNotify(slotMethod); //Qt5: QMetaMethod instead of char*
- #else
- // Need to cast to QObjectWrapper* and call the public version of
- // connectNotify when avoiding the protected hack.
- reinterpret_cast<QObjectWrapper*>(source)->disconnectNotify(slotMethod); //Qt5: QMetaMethod instead of char*
- #endif
- return true;
- }
- return false;
-}
diff --git a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
index 48f234f2..c70049d8 100644
--- a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
+++ b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
@@ -40,78 +40,59 @@
****************************************************************************/
-->
<typesystem package="PySide2.QtCore">
- <load-typesystem name="typesystem_templates.xml" generate="no"/>
-
- <custom-type name="str" />
- <custom-type name="PyBytes" />
- <custom-type name="PyByteArray" />
- <custom-type name="PyCallable" />
- <custom-type name="PyObject" />
- <custom-type name="PySequence" />
- <custom-type name="PyTypeObject" />
- <custom-type name="PyUnicode" />
- <custom-type name="list of QAbstractAnimation" />
- <custom-type name="list of QAbstractState" />
-
- <function signature="qAcos(qreal)" />
- <function signature="qAsin(qreal)" since="4.6" />
- <function signature="qAtan(qreal)" since="4.6" />
- <function signature="qAtan2(qreal,qreal)" since="4.6" />
- <function signature="qChecksum(const char*,uint)" />
- <function signature="qExp(qreal)" since="4.6" />
- <function signature="qFabs(qreal)" since="4.6" />
+ <load-typesystem name="templates/core_common.xml" generate="no"/>
+
+ <custom-type name="str"/>
+ <custom-type name="PyBytes"/>
+ <custom-type name="PyByteArray"/>
+ <custom-type name="PyCallable"/>
+ <custom-type name="PyObject"/>
+ <custom-type name="PySequence"/>
+ <custom-type name="PyTypeObject"/>
+ <custom-type name="PyUnicode"/>
+ <custom-type name="list of QAbstractAnimation"/>
+ <custom-type name="list of QAbstractState"/>
+
+ <function signature="qAcos(qreal)"/>
+ <function signature="qAsin(qreal)" since="4.6"/>
+ <function signature="qAtan(qreal)" since="4.6"/>
+ <function signature="qAtan2(qreal,qreal)" since="4.6"/>
+ <function signature="qChecksum(const char*,uint)"/>
+ <function signature="qExp(qreal)" since="4.6"/>
+ <function signature="qFabs(qreal)" since="4.6"/>
<function signature="qFastCos(qreal)" since="4.6"/>
- <function signature="qFastSin(qreal)" since="4.6" />
- <function signature="qFuzzyCompare(double,double)" />
- <function signature="qFuzzyIsNull(double)" since="4.6" />
- <function signature="qIsFinite(double)" />
- <function signature="qIsInf(double)" />
- <function signature="qIsNaN(double)" />
- <function signature="qIsNull(double)" />
- <!-- Qt5: gone <function signature="qRound(qreal)" /> -->
- <function signature="qTan(qreal)" since="4.6" />
- <function signature="qtTrId(const char*,int)" since="4.6" />
- <function signature="qVersion()" />
- <function signature="qrand()" />
- <function signature="qsrand(uint)" />
+ <function signature="qFastSin(qreal)" since="4.6"/>
+ <function signature="qFuzzyCompare(double,double)"/>
+ <function signature="qFuzzyIsNull(double)" since="4.6"/>
+ <function signature="qIsFinite(double)"/>
+ <function signature="qIsInf(double)"/>
+ <function signature="qIsNaN(double)"/>
+ <function signature="qIsNull(double)"/>
+ <!-- Qt5: gone <function signature="qRound(qreal)"/> -->
+ <function signature="qTan(qreal)" since="4.6"/>
+ <function signature="qtTrId(const char*,int)" since="4.6"/>
+ <function signature="qVersion()"/>
+ <function signature="qrand()"/>
+ <function signature="qsrand(uint)"/>
<function signature="qCompress(const uchar*,int,int)"/>
<function signature="qCompress(const QByteArray&amp;,int)"/>
<function signature="qUncompress(const uchar*,int)"/>
<function signature="qUncompress(const QByteArray&amp;)"/>
- <inject-code class="native" position="beginning">
- #include &lt;pyside.h&gt;
- </inject-code>
+ <inject-code class="native" position="beginning" file="../glue/qtcore.cpp" snippet="include-pyside"/>
- <template name="use_stream_for_format_security">
- // Uses the stream version for security reasons
- // see gcc man page at -Wformat-security
- %FUNCTION_NAME() &lt;&lt; %1;
- </template>
<add-function signature="qDebug(const char*)">
- <inject-code>
- <insert-template name="use_stream_for_format_security" />
- </inject-code>
+ <inject-code file="../glue/qtcore.cpp" snippet="use-stream-for-format-security"/>
</add-function>
<add-function signature="qCritical(const char*)">
- <inject-code>
- <insert-template name="use_stream_for_format_security" />
- </inject-code>
+ <inject-code file="../glue/qtcore.cpp" snippet="use-stream-for-format-security"/>
</add-function>
<add-function signature="qFatal(const char*)">
- <inject-code>
- // qFatal doesn't have a stream version, so we do a
- // qWarning call followed by a qFatal() call using a
- // literal.
- qWarning() &lt;&lt; %1;
- qFatal("[A qFatal() call was made from Python code]");
- </inject-code>
+ <inject-code file="../glue/qtcore.cpp" snippet="qfatal"/>
</add-function>
<add-function signature="qWarning(const char*)">
- <inject-code>
- <insert-template name="use_stream_for_format_security" />
- </inject-code>
+ <inject-code file="../glue/qtcore.cpp" snippet="use-stream-for-format-security"/>
</add-function>
<!-- TODO: We do not support void* or const void* as arg -->
@@ -127,9 +108,9 @@
<rejection class="QChildEvent" field-name="c"/>
<rejection class="QTimerEvent" field-name="id"/>
<rejection class="QEvent" field-name="t"/>
- <rejection class="*" function-name="tr" />
- <rejection class="*" function-name="trUtf8" />
- <rejection class="*" function-name="qt_metacast" />
+ <rejection class="*" function-name="tr"/>
+ <rejection class="*" function-name="trUtf8"/>
+ <rejection class="*" function-name="qt_metacast"/>
<!-- From Qt4.6 -->
<rejection class="*" field-name="d_ptr"/>
<rejection class="*" field-name="staticQtMetaObject"/>
@@ -144,7 +125,7 @@
<rejection class="*" function-name="qReallocAligned"/>
<rejection class="*" function-name="qMallocAligned"/>
<rejection class="*" function-name="qFreeAligned"/>
- <rejection class="QMetaMethod" enum-name="Attributes" />
+ <rejection class="QMetaMethod" enum-name="Attributes"/>
<rejection class="*" argument-type="QByteArrayDataPtr"/>
<rejection class="*" argument-type="^qfloat16&amp;?$"/>
@@ -180,6 +161,8 @@
<enum-type name="QtMsgType"/>
+ <enum-type name="QCborSimpleType" since="5.12"/>
+ <enum-type name="QCborKnownTags" since="5.12"/>
<primitive-type name="qint8"/>
<primitive-type name="qint16"/>
@@ -195,13 +178,13 @@
<primitive-type name="qint64"/>
<primitive-type name="unsigned long long"/>
<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="qlonglong" target-lang-api-name="PyLong"/>
+ <primitive-type name="qulonglong" target-lang-api-name="PyLong"/>
<primitive-type name="short"/>
<primitive-type name="signed short"/>
<primitive-type name="signed short int"/>
- <primitive-type name="ushort" target-lang-api-name="PyInt" />
- <primitive-type name="unsigned short int" />
+ <primitive-type name="ushort" target-lang-api-name="PyInt"/>
+ <primitive-type name="unsigned short int"/>
<primitive-type name="unsigned short"/>
<primitive-type name="char"/>
<primitive-type name="signed char"/>
@@ -215,7 +198,7 @@
<primitive-type name="signed long"/>
<primitive-type name="signed long int"/>
<primitive-type name="long"/>
- <primitive-type name="unsigned long int" />
+ <primitive-type name="unsigned long int"/>
<primitive-type name="unsigned long">
<!-- FIXME APIExtractor or shiboken do not support multiple includes by primitive type -->
<include file-name="signalmanager.h" location="global"/>
@@ -223,13 +206,9 @@
<primitive-type name="bool" target-lang-api-name="PyBool">
<conversion-rule>
- <native-to-target>
- return PyBool_FromLong((bool)%in);
- </native-to-target>
+ <native-to-target file="../glue/qtcore.cpp" snippet="return-pybool"/>
<target-to-native>
- <add-conversion type="PyBool">
- %out = %OUTTYPE(%in == Py_True);
- </add-conversion>
+ <add-conversion type="PyBool" file="../glue/qtcore.cpp" snippet="conversion-pybool"/>
</target-to-native>
</conversion-rule>
</primitive-type>
@@ -237,453 +216,152 @@
<!-- Qt5: add the new pointer-ish types -->
<primitive-type name="qintptr" target-lang-api-name="PyLong">
<conversion-rule>
- <native-to-target>
- return PyLong_FromLong(%in);
- </native-to-target>
+ <native-to-target file="../glue/qtcore.cpp" snippet="return-pylong"/>
<target-to-native>
- <add-conversion type="PyLong">
- %out = %OUTTYPE(PyLong_AsLong(%in));
- </add-conversion>
+ <add-conversion type="PyLong" file="../glue/qtcore.cpp" snippet="conversion-pylong"/>
</target-to-native>
</conversion-rule>
</primitive-type>
<primitive-type name="quintptr" target-lang-api-name="PyLong">
<conversion-rule>
- <native-to-target>
- return PyLong_FromUnsignedLong(%in);
- </native-to-target>
+ <native-to-target file="../glue/qtcore.cpp" snippet="return-pylong-unsigned"/>
<target-to-native>
- <add-conversion type="PyLong">
- %out = %OUTTYPE(PyLong_AsUnsignedLong(%in));
- </add-conversion>
+ <add-conversion type="PyLong" file="../glue/qtcore.cpp" snippet="conversion-pylong-unsigned"/>
</target-to-native>
</conversion-rule>
</primitive-type>
<primitive-type name="qptrdiff" target-lang-api-name="PyLong">
<conversion-rule>
- <native-to-target>
- return PyLong_FromLong(%in);
- </native-to-target>
+ <native-to-target file="../glue/qtcore.cpp" snippet="return-pylong"/>
<target-to-native>
- <add-conversion type="PyLong">
- %out = %OUTTYPE(PyLong_AsLong(%in));
- </add-conversion>
+ <add-conversion type="PyLong" file="../glue/qtcore.cpp" snippet="conversion-pylong"/>
</target-to-native>
</conversion-rule>
</primitive-type>
- <inject-code class="native" position="beginning">
- bool py2kStrCheck(PyObject *obj)
- {
- #ifdef IS_PY3K
- return false;
- #else
- return PyString_Check(obj);
- #endif
- }
- </inject-code>
+ <inject-code class="native" position="beginning" file="../glue/qtcore.cpp" snippet="pystring-check"/>
<primitive-type name="QString" target-lang-api-name="PyUnicode">
<include file-name="QString" location="global"/>
<conversion-rule>
- <native-to-target>
- QByteArray ba = %in.toUtf8();
- PyObject *%out = PyUnicode_FromStringAndSize(ba.constData(), ba.size());
- return %out;
- </native-to-target>
+ <native-to-target file="../glue/qtcore.cpp" snippet="return-pyunicode"/>
<target-to-native>
- <add-conversion type="PyUnicode">
- #ifndef Py_LIMITED_API
- Py_UNICODE* unicode = PyUnicode_AS_UNICODE(%in);
- # if defined(Py_UNICODE_WIDE)
- // cast as Py_UNICODE can be a different type
- %out = QString::fromUcs4((const uint*)unicode);
- # else
- %out = QString::fromUtf16((const ushort*)unicode, PyUnicode_GET_SIZE(%in));
- # endif
- #else
- wchar_t *temp = PyUnicode_AsWideCharString(%in, NULL);
- %out = QString::fromWCharArray(temp);
- PyMem_Free(temp);
- #endif
- </add-conversion>
- <add-conversion type="PyString" check="py2kStrCheck(%in)">
- #ifndef IS_PY3K
- const char* str = %CONVERTTOCPP[const char*](%in);
- %out = %OUTTYPE(str);
- #endif
- </add-conversion>
- <add-conversion type="Py_None">
- %out = %OUTTYPE();
- </add-conversion>
+ <add-conversion type="PyUnicode" file="../glue/qtcore.cpp" snippet="conversion-pyunicode"/>
+ <add-conversion type="PyString" check="py2kStrCheck(%in)" file="../glue/qtcore.cpp" snippet="conversion-pystring"/>
+ <add-conversion type="Py_None" file="../glue/qtcore.cpp" snippet="conversion-pynone"/>
</target-to-native>
</conversion-rule>
</primitive-type>
<primitive-type name="QStringRef">
<conversion-rule>
- <native-to-target>
- const int N = %in.toString().length();
- wchar_t *str = new wchar_t[N];
- %in.toString().toWCharArray(str);
- PyObject *%out = PyUnicode_FromWideChar(str, N);
- delete[] str;
- return %out;
- </native-to-target>
+ <native-to-target file="../glue/qtcore.cpp" snippet="return-pyunicode-qstringref"/>
</conversion-rule>
</primitive-type>
<primitive-type name="QChar">
<conversion-rule>
- <native-to-target>
- wchar_t c = (wchar_t)%in.unicode();
- return PyUnicode_FromWideChar(&amp;c, 1);
- </native-to-target>
+ <native-to-target file="../glue/qtcore.cpp" snippet="return-pyunicode-qchar"/>
<target-to-native>
- <add-conversion type="PyString" check="Shiboken::String::checkChar(%in)">
- char c = %CONVERTTOCPP[char](%in);
- %out = %OUTTYPE(c);
- </add-conversion>
- <add-conversion type="PyInt">
- int i = %CONVERTTOCPP[int](%in);
- %out = %OUTTYPE(i);
- </add-conversion>
- <add-conversion type="Py_None">
- %out = %OUTTYPE();
- </add-conversion>
+ <add-conversion type="PyString" check="Shiboken::String::checkChar(%in)" file="../glue/qtcore.cpp" snippet="conversion-pystring-char"/>
+ <add-conversion type="PyInt" file="../glue/qtcore.cpp" snippet="conversion-pyint"/>
+ <add-conversion type="Py_None" file="../glue/qtcore.cpp" snippet="conversion-pynone"/>
</target-to-native>
</conversion-rule>
</primitive-type>
<primitive-type name="QVariant" target-lang-api-name="PyObject">
<conversion-rule>
- <native-to-target>
- if (!%in.isValid())
- Py_RETURN_NONE;
-
- if (qstrcmp(%in.typeName(), "QVariantList") == 0) {
- QList&lt;QVariant&gt; var = %in.value&lt;QVariantList&gt;();
- return %CONVERTTOPYTHON[QList&lt;QVariant&gt;](var);
- }
-
- if (qstrcmp(%in.typeName(), "QStringList") == 0) {
- QStringList var = %in.value&lt;QStringList&gt;();
- return %CONVERTTOPYTHON[QList&lt;QString&gt;](var);
- }
-
- if (qstrcmp(%in.typeName(), "QVariantMap") == 0) {
- QMap&lt;QString, QVariant&gt; var = %in.value&lt;QVariantMap&gt;();
- return %CONVERTTOPYTHON[QMap&lt;QString, QVariant&gt;](var);
- }
-
- Shiboken::Conversions::SpecificConverter converter(cppInRef.typeName());
- if (converter) {
- void *ptr = cppInRef.data();
- return converter.toPython(ptr);
- }
- PyErr_Format(PyExc_RuntimeError, "Can't find converter for '%s'.", %in.typeName());
- return 0;
- </native-to-target>
+ <native-to-target file="../glue/qtcore.cpp" snippet="return-qvariant"/>
<target-to-native>
- <add-conversion type="PyBool">
- %out = %OUTTYPE(%in == Py_True);
- </add-conversion>
- <add-conversion type="Py_None">
- %out = %OUTTYPE();
- </add-conversion>
- <add-conversion type="QString" check="Shiboken::String::check(%in)">
- QString in = %CONVERTTOCPP[QString](%in);
- %out = %OUTTYPE(in);
- </add-conversion>
- <add-conversion type="QByteArray">
- QByteArray in = %CONVERTTOCPP[QByteArray](%in);
- %out = %OUTTYPE(in);
- </add-conversion>
- <add-conversion type="PyFloat" check="PyFloat_CheckExact(%in)">
- double in = %CONVERTTOCPP[double](%in);
- %out = %OUTTYPE(in);
- </add-conversion>
+ <add-conversion type="PyBool" file="../glue/qtcore.cpp" snippet="conversion-pybool"/>
+ <add-conversion type="Py_None" file="../glue/qtcore.cpp" snippet="conversion-pynone"/>
+ <add-conversion type="QString" check="Shiboken::String::check(%in)" file="../glue/qtcore.cpp" snippet="conversion-qstring"/>
+ <add-conversion type="QByteArray" file="../glue/qtcore.cpp" snippet="conversion-qbytearray"/>
+ <add-conversion type="PyFloat" check="PyFloat_CheckExact(%in)" file="../glue/qtcore.cpp" snippet="conversion-pyfloat"/>
<!-- Using PyLong instead of PyInt to support Python2 and 3-->
- <add-conversion type="PyInt" check="PyInt_CheckExact(%in)">
- qlonglong in = %CONVERTTOCPP[qlonglong](%in);
- %out = %OUTTYPE(in);
- </add-conversion>
- <add-conversion type="PyLong" check="PyLong_CheckExact(%in)">
- qlonglong in = %CONVERTTOCPP[qlonglong](%in);
- %out = %OUTTYPE(in);
- </add-conversion>
- <add-conversion type="SbkEnumType">
- int in = %CONVERTTOCPP[int](%in);
- %out = %OUTTYPE(in);
- </add-conversion>
- <add-conversion type="SbkObject">
- // a class supported by QVariant?
- int typeCode;
- const char *typeName = QVariant_resolveMetaType(Py_TYPE(%in), &amp;typeCode);
- if (!typeCode || !typeName)
- return;
- QVariant var(typeCode, (void*)0);
- Shiboken::Conversions::SpecificConverter converter(typeName);
- converter.toCpp(pyIn, var.data());
- %out = var;
- </add-conversion>
- <add-conversion type="PyDict" check="PyDict_CheckExact(%in)">
- QVariant ret = QVariant_convertToVariantMap(%in);
- %out = ret.isValid() ? ret : QVariant::fromValue&lt;PySide::PyObjectWrapper&gt;(%in);
- </add-conversion>
- <add-conversion type="PyList" check="PyList_Check(%in)">
- QVariant ret = QVariant_convertToVariantList(%in);
- %out = ret.isValid() ? ret : QVariant::fromValue&lt;PySide::PyObjectWrapper&gt;(%in);
- </add-conversion>
- <add-conversion type="PyObject">
- // Is a shiboken type not known by Qt
- %out = QVariant::fromValue&lt;PySide::PyObjectWrapper&gt;(%in);
- </add-conversion>
+ <add-conversion type="PyInt" check="PyInt_CheckExact(%in)" file="../glue/qtcore.cpp" snippet="conversion-qlonglong"/>
+ <add-conversion type="PyLong" check="PyLong_CheckExact(%in)" file="../glue/qtcore.cpp" snippet="conversion-qlonglong"/>
+ <add-conversion type="SbkEnumType" file="../glue/qtcore.cpp" snippet="conversion-pyint"/>
+ <add-conversion type="SbkObject" file="../glue/qtcore.cpp" snippet="conversion-sbkobject"/>
+ <add-conversion type="PyDict" check="PyDict_CheckExact(%in)" file="../glue/qtcore.cpp" snippet="conversion-pydict"/>
+ <add-conversion type="PyList" check="PyList_Check(%in)" file="../glue/qtcore.cpp" snippet="conversion-pylist"/>
+ <add-conversion type="PyObject" file="../glue/qtcore.cpp" snippet="conversion-pyobject"/>
</target-to-native>
</conversion-rule>
</primitive-type>
- <inject-code class="native" position="beginning">
- static const char *QVariant_resolveMetaType(PyTypeObject *type, int *typeId)
- {
- if (PyObject_TypeCheck(type, SbkObjectType_TypeF())) {
- SbkObjectType* sbkType = (SbkObjectType*)type;
- const char* typeName = Shiboken::ObjectType::getOriginalName(sbkType);
- if (!typeName)
- return 0;
- bool valueType = '*' != typeName[qstrlen(typeName) - 1];
- // Do not convert user type of value
- if (valueType &amp;&amp; Shiboken::ObjectType::isUserType(type))
- return 0;
- int obTypeId = QMetaType::type(typeName);
- if (obTypeId) {
- *typeId = obTypeId;
- return typeName;
- }
- // Do not resolve types to value type
- if (valueType)
- return 0;
- // Find in base types. First check tp_bases, and only after check tp_base, because
- // tp_base does not always point to the first base class, but rather to the first
- // that has added any python fields or slots to its object layout.
- // See https://mail.python.org/pipermail/python-list/2009-January/520733.html
- if (type->tp_bases) {
- for (int i = 0; i &lt; PyTuple_GET_SIZE(type->tp_bases); ++i) {
- const char *derivedName = QVariant_resolveMetaType(reinterpret_cast&lt;PyTypeObject *&gt;(PyTuple_GET_ITEM(
- type->tp_bases, i)), typeId);
- if (derivedName)
- return derivedName;
- }
- }
- else if (type->tp_base) {
- return QVariant_resolveMetaType(type->tp_base, typeId);
- }
- }
- *typeId = 0;
- return 0;
- }
- static QVariant QVariant_convertToValueList(PyObject *list)
- {
- if (PySequence_Size(list) &lt; 0) {
- // clear the error if &lt; 0 which means no length at all
- PyErr_Clear();
- return QVariant();
- }
-
- Shiboken::AutoDecRef element(PySequence_GetItem(list, 0));
- int typeId;
- const char *typeName = QVariant_resolveMetaType(element.cast&lt;PyTypeObject*&gt;(), &amp;typeId);
- if (typeName) {
- QByteArray listTypeName("QList&lt;");
- listTypeName += typeName;
- listTypeName += '>';
- typeId = QMetaType::type(listTypeName);
- if (typeId &gt; 0) {
- Shiboken::Conversions::SpecificConverter converter(listTypeName);
- if (converter) {
- QVariant var(typeId, (void*)0);
- converter.toCpp(list, &amp;var);
- return var;
- }
- qWarning() &lt;&lt; "Type converter for :" &lt;&lt; listTypeName &lt;&lt; "not registered.";
- }
- }
- return QVariant();
- }
- static bool QVariant_isStringList(PyObject *list)
- {
- bool allString = true;
-
- if (PySequence_Check(list)) {
- if (PySequence_Size(list) &lt; 0) {
- // clear the error if &lt; 0 which means no length at all
- PyErr_Clear();
- return false;
- }
- Shiboken::AutoDecRef fast(PySequence_Fast(list, "Failed to convert QVariantList"));
- Py_ssize_t size = PySequence_Fast_GET_SIZE(fast.object());
- for (int i = 0; i &lt; size; ++i) {
- PyObject *item = PySequence_Fast_GET_ITEM(fast.object(), i);
- if (!%CHECKTYPE[QString](item)) {
- allString = false;
- break;
- }
- }
- } else {
- // If it is not a list or a derived list class
- // we assume that will not be a String list neither.
- allString = false;
- }
- return allString;
- }
- static QVariant QVariant_convertToVariantMap(PyObject *map)
- {
- Py_ssize_t pos = 0;
- Shiboken::AutoDecRef keys(PyDict_Keys(map));
- if (!QVariant_isStringList(keys))
- return QVariant();
- PyObject *key;
- PyObject *value;
- QMap&lt;QString,QVariant&gt; ret;
- while (PyDict_Next(map, &amp;pos, &amp;key, &amp;value)) {
- QString cppKey = %CONVERTTOCPP[QString](key);
- QVariant cppValue = %CONVERTTOCPP[QVariant](value);
- ret.insert(cppKey, cppValue);
- }
- return QVariant(ret);
- }
- static QVariant QVariant_convertToVariantList(PyObject *list)
- {
- if (QVariant_isStringList(list)) {
- QList&lt;QString &gt; lst = %CONVERTTOCPP[QList&lt;QString&gt;](list);
- return QVariant(QStringList(lst));
- }
- QVariant valueList = QVariant_convertToValueList(list);
- if (valueList.isValid())
- return valueList;
-
- if (PySequence_Size(list) &lt; 0) {
- // clear the error if &lt; 0 which means no length at all
- PyErr_Clear();
- return QVariant();
- }
-
- QList&lt;QVariant&gt; lst;
- Shiboken::AutoDecRef fast(PySequence_Fast(list, "Failed to convert QVariantList"));
- Py_ssize_t size = PySequence_Fast_GET_SIZE(fast.object());
- for (int i = 0; i &lt; size; ++i) {
- PyObject *pyItem = PySequence_Fast_GET_ITEM(fast.object(), i);
- QVariant item = %CONVERTTOCPP[QVariant](pyItem);
- lst.append(item);
- }
- return QVariant(lst);
- }
- </inject-code>
-
+ <inject-code class="native" position="beginning" file="../glue/qtcore.cpp" snippet="qvariant-conversion"/>
<primitive-type name="QVariant::Type" default-constructor="QVariant::Invalid">
<conversion-rule>
- <native-to-target>
- const char *typeName = QVariant::typeToName(%in);
- PyObject *%out;
- PyTypeObject *pyType = nullptr;
- if (typeName)
- pyType = Shiboken::Conversions::getPythonTypeObject(typeName);
- %out = pyType ? (reinterpret_cast&lt;PyObject*&gt;(pyType)) : Py_None;
- Py_INCREF(%out);
- return %out;
- </native-to-target>
+ <native-to-target file="../glue/qtcore.cpp" snippet="return-qvariant-type"/>
<target-to-native>
- <add-conversion type="Py_None">
- %out = QVariant::Invalid;
- </add-conversion>
- <add-conversion type="PyTypeObject">
- const char *typeName;
- if (Shiboken::String::checkType(reinterpret_cast&lt;PyTypeObject *&gt;(%in)))
- typeName = "QString";
- else if (%in == reinterpret_cast&lt;PyObject*&gt;(&amp;PyFloat_Type))
- typeName = "double"; // float is a UserType in QVariant.
- else if (%in == reinterpret_cast&lt;PyObject*&gt;(&amp;PyLong_Type))
- typeName = "int"; // long is a UserType in QVariant.
- else if (Py_TYPE(%in) == SbkObjectType_TypeF())
- typeName = Shiboken::ObjectType::getOriginalName((SbkObjectType*)%in);
- else
- typeName = reinterpret_cast&lt;PyTypeObject *&gt;(%in)->tp_name;
- %out = QVariant::nameToType(typeName);
- </add-conversion>
- <add-conversion type="PyString" check="Shiboken::String::check(%in)">
- %out = QVariant::nameToType(Shiboken::String::toCString(%in));
- </add-conversion>
- <add-conversion type="PyDict" check="PyDict_Check(%in) &amp;&amp; QVariantType_checkAllStringKeys(%in)">
- %out = QVariant::nameToType("QVariantMap");
- </add-conversion>
- <add-conversion type="PySequence">
- %out = QVariantType_isStringList(%in) ? QVariant::StringList : QVariant::List;
- </add-conversion>
+ <add-conversion type="Py_None" file="../glue/qtcore.cpp" snippet="conversion-qvariant-invalid"/>
+ <add-conversion type="PyTypeObject" file="../glue/qtcore.cpp" snippet="conversion-qvariant-pytypeobject"/>
+ <add-conversion type="PyString" check="Shiboken::String::check(%in)" file="../glue/qtcore.cpp" snippet="conversion-qvariant-pystring"/>
+ <add-conversion type="PyDict" check="PyDict_Check(%in) &amp;&amp; QVariantType_checkAllStringKeys(%in)" file="../glue/qtcore.cpp" snippet="conversion-qvariant-pydict"/>
+ <add-conversion type="PySequence" file="../glue/qtcore.cpp" snippet="conversion-qvariant-pysequence"/>
</target-to-native>
</conversion-rule>
</primitive-type>
<primitive-type name="QVariantMap" target-lang-api-name="PyDict"/>
- <inject-code class="target" position="end">
- Shiboken::Conversions::registerConverterName(SbkPySide2_QtCoreTypeConverters[SBK_QTCORE_QMAP_QSTRING_QVARIANT_IDX], "QVariantMap");
- </inject-code>
-
- <inject-code class="native" position="beginning">
- static bool QVariantType_isStringList(PyObject *list)
- {
- bool allString = true;
- Shiboken::AutoDecRef fast(PySequence_Fast(list, "Failed to convert QVariantList"));
- Py_ssize_t size = PySequence_Fast_GET_SIZE(fast.object());
- for (int i=0; i &lt; size; i++) {
- PyObject *item = PySequence_Fast_GET_ITEM(fast.object(), i);
- if (!%CHECKTYPE[QString](item)) {
- allString = false;
- break;
- }
- }
- return allString;
- }
- static bool QVariantType_checkAllStringKeys(PyObject *dict)
- {
- Shiboken::AutoDecRef keys(PyDict_Keys(dict));
- return QVariantType_isStringList(keys);
- }
- </inject-code>
-
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="qvariantmap-register"/>
+ <inject-code class="native" position="beginning" file="../glue/qtcore.cpp" snippet="qvariantmap-check"/>
<primitive-type name="QStringList">
<include file-name="QStringList" location="global"/>
<conversion-rule>
<native-to-target>
<insert-template name="cpplist_to_pylist_conversion">
- <replace from="%INTYPE_0" to="QString" />
+ <replace from="%INTYPE_0" to="QString"/>
</insert-template>
</native-to-target>
<target-to-native>
<add-conversion type="PySequence">
<insert-template name="pyseq_to_cpplist_conversion">
- <replace from="%OUTTYPE_0" to="QString" />
+ <replace from="%OUTTYPE_0" to="QString"/>
</insert-template>
</add-conversion>
</target-to-native>
</conversion-rule>
</primitive-type>
+ <value-type name="QCborError" since="5.12">
+ <enum-type name="Code"/>
+ <include file-name="qcborcommon.h" location="global"/>
+ </value-type>
+
+ <value-type name="QCborParserError" since="5.12">
+ <include file-name="qcborvalue.h" location="global"/>
+ </value-type>
+
+ <value-type name="QCborValue" since="5.12">
+ <enum-type name="EncodingOption" flags="EncodingOptions"/>
+ <enum-type name="DiagnosticNotationOption" flags="DiagnosticNotationOptions"/>
+ <enum-type name="Type"/>
+ </value-type>
+ <value-type name="QCborArray" since="5.12"/>
+ <value-type name="QCborMap" since="5.12"/>
+
+ <object-type name="QCborStreamReader" since="5.12">
+ <enum-type name="StringResultCode"/>
+ <enum-type name="Type"/>
+ <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"/>
+ <!-- 32bit (qsizetype = int) -->
+ <modify-function signature="readStringChunk(char*,int)" remove="all"/>
+ </object-type>
+ <typedef-type name="QCborStringResultString" source="QCborStreamReader::StringResult&lt;QString&gt;" since="5.12"/>
+ <typedef-type name="QCborStringResultByteArray" source="QCborStreamReader::StringResult&lt;QByteArray&gt;" since="5.12"/>
+ <object-type name="QCborStreamWriter" since="5.12">
+ <include file-name="qcborstream.h" location="global"/>
+ </object-type>
+
<primitive-type name="QJsonObject">
<conversion-rule>
- <native-to-target>
- // The QVariantMap returned by QJsonObject seems to cause a segfault, so
- // using QJsonObject.toVariantMap() won't work.
- // Wrapping it in a QJsonValue first allows it to work
- QJsonValue val(%in);
- QVariant ret = val.toVariant();
-
- return %CONVERTTOPYTHON[QVariant](ret);
- </native-to-target>
+ <native-to-target file="../glue/qtcore.cpp" snippet="return-qjsonobject"/>
<target-to-native>
- <add-conversion type="PyDict">
- QVariant dict = QVariant_convertToVariantMap(%in);
- QJsonValue val = QJsonValue::fromVariant(dict);
-
- %out = val.toObject();
- </add-conversion>
+ <add-conversion type="PyDict" file="../glue/qtcore.cpp" snippet="conversion-qjsonobject-pydict"/>
</target-to-native>
</conversion-rule>
</primitive-type>
@@ -693,13 +371,13 @@
<conversion-rule>
<native-to-target>
<insert-template name="cpplist_to_pylist_conversion">
- <replace from="%INTYPE_0" to="QModelIndex" />
+ <replace from="%INTYPE_0" to="QModelIndex"/>
</insert-template>
</native-to-target>
<target-to-native>
<add-conversion type="PySequence">
<insert-template name="pyseq_to_cpplist_conversion">
- <replace from="%OUTTYPE_0" to="QModelIndex" />
+ <replace from="%OUTTYPE_0" to="QModelIndex"/>
</insert-template>
</add-conversion>
</target-to-native>
@@ -791,30 +469,6 @@
</conversion-rule>
</container-type>
- <template name="cppmap_to_pymap_conversion">
- PyObject *%out = PyDict_New();
- for (%INTYPE::const_iterator it = %in.begin(), end = %in.end(); it != end; ++it) {
- %INTYPE_0 key = it.key();
- %INTYPE_1 value = it.value();
- PyObject *pyKey = %CONVERTTOPYTHON[%INTYPE_0](key);
- PyObject *pyValue = %CONVERTTOPYTHON[%INTYPE_1](value);
- PyDict_SetItem(%out, pyKey, pyValue);
- Py_DECREF(pyKey);
- Py_DECREF(pyValue);
- }
- return %out;
- </template>
- <template name="pydict_to_cppmap_conversion">
- PyObject *key;
- PyObject *value;
- Py_ssize_t pos = 0;
- while (PyDict_Next(%in, &amp;pos, &amp;key, &amp;value)) {
- %OUTTYPE_0 cppKey = %CONVERTTOCPP[%OUTTYPE_0](key);
- %OUTTYPE_1 cppValue = %CONVERTTOCPP[%OUTTYPE_1](value);
- %out.insert(cppKey, cppValue);
- }
- </template>
-
<container-type name="QHash" type="hash">
<include file-name="QHash" location="global"/>
<!-- Include to make enum flags work. -->
@@ -860,17 +514,9 @@
<container-type name="QPair" type="pair">
<include file-name="QPair" location="global"/>
<conversion-rule>
- <native-to-target>
- PyObject *%out = PyTuple_New(2);
- PyTuple_SET_ITEM(%out, 0, %CONVERTTOPYTHON[%INTYPE_0](%in.first));
- PyTuple_SET_ITEM(%out, 1, %CONVERTTOPYTHON[%INTYPE_1](%in.second));
- return %out;
- </native-to-target>
+ <native-to-target file="../glue/qtcore.cpp" snippet="return-qpair"/>
<target-to-native>
- <add-conversion type="PySequence">
- %out.first = %CONVERTTOCPP[%OUTTYPE_0](PySequence_Fast_GET_ITEM(%in, 0));
- %out.second = %CONVERTTOCPP[%OUTTYPE_1](PySequence_Fast_GET_ITEM(%in, 1));
- </add-conversion>
+ <add-conversion type="PySequence" file="../glue/qtcore.cpp" snippet="conversion-qpair-pysequence"/>
</target-to-native>
</conversion-rule>
</container-type>
@@ -907,9 +553,6 @@
<rejection class="" enum-name="QtValidLicenseForGuiModule"/>
<rejection class="" enum-name="QtValidLicenseForScriptModule"/>
<rejection class="" enum-name="QtValidLicenseForHelpModule"/>
- <rejection class="QAbstractEventDispatcher" function-name="filterEvent"/>
- <rejection class="QAbstractEventDispatcher" function-name="filterNativeEvent"/>
- <rejection class="QAbstractEventDispatcher" function-name="setEventFilter"/>
<!-- Internal -->
<rejection class="QAbstractFileEngine"/> <!--
<rejection class="QAbstractFileEngine" function-name="endEntryList"/>
@@ -926,8 +569,8 @@
<rejection class="Qt" function-name="qt_getEnumName"/>
<namespace-type name="Qt">
- <enum-type name="AlignmentFlag" flags="Alignment" />
- <enum-type name="AnchorPoint" since="4.6" />
+ <enum-type name="AlignmentFlag" flags="Alignment"/>
+ <enum-type name="AnchorPoint" since="4.6"/>
<enum-type name="ApplicationAttribute"/>
<enum-type name="ApplicationState" flags="ApplicationStates" since="5.1"/>
<enum-type name="ArrowType"/>
@@ -943,10 +586,10 @@
<enum-type name="ContextMenuPolicy"/>
<enum-type name="CoordinateSystem" since="4.6"/>
<enum-type name="Corner"/>
- <enum-type name="CursorShape" />
- <enum-type name="DateFormat" />
+ <enum-type name="CursorShape"/>
+ <enum-type name="DateFormat"/>
<enum-type name="DayOfWeek"/>
- <enum-type name="DockWidgetArea" flags="DockWidgetAreas" />
+ <enum-type name="DockWidgetArea" flags="DockWidgetAreas"/>
<enum-type name="DockWidgetAreaSizes"/>
<enum-type name="DropAction" flags="DropActions"/>
<enum-type name="Edge" flags="Edges" since="5.1"/>
@@ -960,15 +603,15 @@
<enum-type name="GestureType" since="4.6"/>
<enum-type name="GlobalColor"/>
<enum-type name="HitTestAccuracy"/>
- <enum-type name="ImageConversionFlag" flags="ImageConversionFlags" />
+ <enum-type name="ImageConversionFlag" flags="ImageConversionFlags"/>
<enum-type name="InputMethodHint" flags="InputMethodHints" since="4.6"/>
- <enum-type name="InputMethodQuery" flags="InputMethodQueries" />
- <enum-type name="EnterKeyType" since="5.6" />
- <enum-type name="ItemDataRole" force-integer="yes" />
+ <enum-type name="InputMethodQuery" flags="InputMethodQueries"/>
+ <enum-type name="EnterKeyType" since="5.6"/>
+ <enum-type name="ItemDataRole"/>
<enum-type name="ItemFlag" flags="ItemFlags"/>
<enum-type name="ItemSelectionMode"/>
- <enum-type name="ItemSelectionOperation" since="5.5" />
- <enum-type name="Key" />
+ <enum-type name="ItemSelectionOperation" since="5.5"/>
+ <enum-type name="Key"/>
<enum-type name="KeyboardModifier" flags="KeyboardModifiers"/>
<enum-type name="LayoutDirection"/>
<enum-type name="MaskMode"/>
@@ -990,7 +633,7 @@
<enum-type name="SizeHint"/>
<enum-type name="SizeMode"/>
<enum-type name="SortOrder"/>
- <enum-type name="TabFocusBehavior" since="5.5" />
+ <enum-type name="TabFocusBehavior" since="5.5"/>
<enum-type name="TextElideMode"/>
<enum-type name="TextFlag"/>
<enum-type name="TextFormat"/>
@@ -998,155 +641,46 @@
<enum-type name="TileRule" since="4.6"/>
<enum-type name="TimerType" since="5.0"/>
<enum-type name="TimeSpec"/>
- <enum-type name="ToolBarArea" flags="ToolBarAreas" />
+ <enum-type name="ToolBarArea" flags="ToolBarAreas"/>
<enum-type name="ToolBarAreaSizes"/>
<enum-type name="ToolButtonStyle"/>
<enum-type name="TouchPointState" flags="TouchPointStates" since="4.6"/>
<enum-type name="TransformationMode"/>
<enum-type name="UIEffect"/>
- <enum-type name="WhiteSpaceMode" />
- <enum-type name="WidgetAttribute" />
+ <enum-type name="WhiteSpaceMode"/>
+ <enum-type name="WidgetAttribute"/>
<enum-type name="WindowFrameSection"/>
<enum-type name="WindowModality"/>
<enum-type name="WindowState" flags="WindowStates"/>
<enum-type name="WindowType" flags="WindowFlags"/>
<enum-type name="CursorMoveStyle" since="4.8" revision="4800"/>
- <!--### These functions are part of QtGui, not QtCore -->
- <modify-function signature="codecForHtml(const QByteArray&amp;)" remove="all"/>
- <modify-function signature="mightBeRichText(const QString&amp;)" remove="all"/>
- <modify-function signature="convertFromPlainText(const QString&amp;,Qt::WhiteSpaceMode)" remove="all"/>
- <!--### -->
</namespace-type>
<add-function signature="qAbs(double)" return-type="double">
- <inject-code class="target" position="beginning">
- double _abs = qAbs(%1);
- %PYARG_0 = %CONVERTTOPYTHON[double](_abs);
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qt-qabs"/>
</add-function>
- <inject-code class="native" position="beginning">
- namespace PySide {
- static QStack&lt;PyObject*&gt; globalPostRoutineFunctions;
- void globalPostRoutineCallback()
- {
- Shiboken::GilState state;
- foreach(PyObject *callback, globalPostRoutineFunctions) {
- Shiboken::AutoDecRef result(PyObject_CallObject(callback, NULL));
- Py_DECREF(callback);
- }
- globalPostRoutineFunctions.clear();
- }
- void addPostRoutine(PyObject *callback)
- {
- if (PyCallable_Check(callback)) {
- globalPostRoutineFunctions &lt;&lt; callback;
- Py_INCREF(callback);
- } else {
- PyErr_SetString(PyExc_TypeError, "qAddPostRoutine: The argument must be a callable object.");
- }
- }
- } // namespace
- </inject-code>
+ <inject-code class="native" position="beginning" file="../glue/qtcore.cpp" snippet="qt-postroutine"/>
<add-function signature="qAddPostRoutine(PyObject*)">
- <inject-code class="target" position="beginning">
- PySide::addPostRoutine(%1);
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qt-addpostroutine"/>
</add-function>
- <inject-code class="target" position="end">
- qAddPostRoutine(PySide::globalPostRoutineCallback);
- </inject-code>
-
- <inject-code class="target" position="end">
- QList&lt;QByteArray&gt; version = QByteArray(qVersion()).split('.');
- PyObject *pyQtVersion = PyTuple_New(3);
- for (int i = 0; i &lt; 3; ++i)
- PyTuple_SET_ITEM(pyQtVersion, i, PyInt_FromLong(version[i].toInt()));
- PyModule_AddObject(module, "__version_info__", pyQtVersion);
- PyModule_AddStringConstant(module, "__version__", qVersion());
- </inject-code>
-
- <inject-code class="target" position="end">
- { // Avoid name clash
- Shiboken::AutoDecRef regFunc((PyObject*)NULL);
- Shiboken::AutoDecRef atexit(Shiboken::Module::import("atexit"));
- if (atexit.isNull()) {
- qWarning() &lt;&lt; "Module atexit not found for registering __moduleShutdown";
- PyErr_Clear();
- }else{
- regFunc = PyObject_GetAttrString(atexit, "register");
- if (regFunc.isNull()) {
- qWarning() &lt;&lt; "Function atexit.register not found for registering __moduleShutdown";
- PyErr_Clear();
- }
- }
- if (!atexit.isNull() &amp;&amp; !regFunc.isNull()){
- PyObject *shutDownFunc = PyObject_GetAttrString(module, "__moduleShutdown");
- Shiboken::AutoDecRef args(PyTuple_New(1));
- PyTuple_SET_ITEM(args, 0, shutDownFunc);
- Shiboken::AutoDecRef retval(PyObject_Call(regFunc, args, 0));
- Q_ASSERT(!retval.isNull());
- }
- }
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="qt-qaddpostroutine"/>
+
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="qt-version"/>
+ <!-- WARNING: There is an issue when adding this code to an external file -->
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="qt-module-shutdown"/>
<add-function signature="__moduleShutdown()">
- <inject-code class="target" position="beginning">
- PySide::runCleanupFunctions();
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="moduleshutdown"/>
</add-function>
<!--signal/slot-->
- <inject-code class="target" position="end">
- Shiboken::Conversions::registerConverterName(SbkPySide2_QtCoreTypeConverters[SBK_QSTRING_IDX], "unicode");
- Shiboken::Conversions::registerConverterName(SbkPySide2_QtCoreTypeConverters[SBK_QSTRING_IDX], "str");
- Shiboken::Conversions::registerConverterName(SbkPySide2_QtCoreTypeConverters[SBK_QTCORE_QLIST_QVARIANT_IDX], "QVariantList");
-
- PySide::registerInternalQtConf();
- PySide::init(module);
- Py_AtExit(QtCoreModuleExit);
- </inject-code>
-
- <inject-code class="native" position="beginning">
- // Define a global variable to handle qInstallMessageHandler callback
- static PyObject *qtmsghandler = nullptr;
-
- static void msgHandlerCallback(QtMsgType type, const QMessageLogContext &amp;ctx, const QString &amp;msg)
- {
- Shiboken::GilState state;
- Shiboken::AutoDecRef arglist(PyTuple_New(3));
- PyTuple_SET_ITEM(arglist, 0, %CONVERTTOPYTHON[QtMsgType](type));
- PyTuple_SET_ITEM(arglist, 1, %CONVERTTOPYTHON[QMessageLogContext &amp;](ctx));
- QByteArray array = msg.toLatin1().data();
- char *data = array.data();
- PyTuple_SET_ITEM(arglist, 2, %CONVERTTOPYTHON[char *](data));
- Shiboken::AutoDecRef ret(PyObject_CallObject(qtmsghandler, arglist));
- }
- static void QtCoreModuleExit()
- {
- PySide::SignalManager::instance().clear();
- }
- </inject-code>
- <add-function signature="qInstallMessageHandler(PyObject)" return-type="PyObject">
- <inject-code class="target" position="beginning">
- if (%PYARG_1 == Py_None) {
- qInstallMessageHandler(0);
- %PYARG_0 = qtmsghandler ? qtmsghandler : Py_None;
- qtmsghandler = 0;
- } else if (!PyCallable_Check(%PYARG_1)) {
- PyErr_SetString(PyExc_TypeError, "parameter must be callable");
- } else {
- %PYARG_0 = qtmsghandler ? qtmsghandler : Py_None;
- Py_INCREF(%PYARG_1);
- qtmsghandler = %PYARG_1;
- qInstallMessageHandler(msgHandlerCallback);
- }
-
- if (%PYARG_0 == Py_None)
- Py_INCREF(%PYARG_0);
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="qt-pysideinit"/>
- </inject-code>
+ <inject-code class="native" position="beginning" file="../glue/qtcore.cpp" snippet="qt-messagehandler"/>
+ <add-function signature="qInstallMessageHandler(PyObject)" return-type="PyObject">
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qt-installmessagehandler"/>
</add-function>
<value-type name="QElapsedTimer" since="4.7">
@@ -1163,8 +697,8 @@
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="repr_code">
- <replace from="%REPR_FORMAT" to="%i, %i, %i, %i" />
- <replace from="%REPR_ARGS" to="%CPPSELF.x1(), %CPPSELF.y1(), %CPPSELF.x2(), %CPPSELF.y2()" />
+ <replace from="%REPR_FORMAT" to="%i, %i, %i, %i"/>
+ <replace from="%REPR_ARGS" to="%CPPSELF.x1(), %CPPSELF.y1(), %CPPSELF.x2(), %CPPSELF.y2()"/>
</insert-template>
</inject-code>
</add-function>
@@ -1172,35 +706,29 @@
<add-function signature="__reduce__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="reduce_code">
- <replace from="%REDUCE_FORMAT" to="iiii" />
- <replace from="%REDUCE_ARGS" to="%CPPSELF.x1(), %CPPSELF.y1(), %CPPSELF.x2(), %CPPSELF.y2()" />
+ <replace from="%REDUCE_FORMAT" to="iiii"/>
+ <replace from="%REDUCE_ARGS" to="%CPPSELF.x1(), %CPPSELF.y1(), %CPPSELF.x2(), %CPPSELF.y2()"/>
</insert-template>
</inject-code>
</add-function>
- <inject-code class="native" position="beginning">
- namespace PySide {
- template&lt;&gt; inline uint hash(const QLine &amp;v) {
- return qHash(qMakePair(qMakePair(v.x1(), v.y1()), qMakePair(v.x2(), v.y2())));
- }
- };
- </inject-code>
+ <inject-code class="native" position="beginning" file="../glue/qtcore.cpp" snippet="qline-hash"/>
<add-function signature="toTuple" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="to_tuple">
- <replace from="%TT_FORMAT" to="iiii" />
- <replace from="%TT_ARGS" to="%CPPSELF.x1(), %CPPSELF.y1(), %CPPSELF.x2(), %CPPSELF.y2()" />
+ <replace from="%TT_FORMAT" to="iiii"/>
+ <replace from="%TT_ARGS" to="%CPPSELF.x1(), %CPPSELF.y1(), %CPPSELF.x2(), %CPPSELF.y2()"/>
</insert-template>
</inject-code>
</add-function>
</value-type>
<value-type name="QLineF">
- <enum-type name="IntersectType" />
+ <enum-type name="IntersectType"/>
<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" />
- <replace from="%REPR_ARGS" to="%CPPSELF.x1(), %CPPSELF.y1(), %CPPSELF.x2(), %CPPSELF.y2()" />
+ <replace from="%REPR_FORMAT" to="%f, %f, %f, %f"/>
+ <replace from="%REPR_ARGS" to="%CPPSELF.x1(), %CPPSELF.y1(), %CPPSELF.x2(), %CPPSELF.y2()"/>
</insert-template>
</inject-code>
</add-function>
@@ -1208,8 +736,8 @@
<add-function signature="__reduce__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="reduce_code">
- <replace from="%REDUCE_FORMAT" to="dddd" />
- <replace from="%REDUCE_ARGS" to="%CPPSELF.x1(), %CPPSELF.y1(), %CPPSELF.x2(), %CPPSELF.y2()" />
+ <replace from="%REDUCE_FORMAT" to="dddd"/>
+ <replace from="%REDUCE_ARGS" to="%CPPSELF.x1(), %CPPSELF.y1(), %CPPSELF.x2(), %CPPSELF.y2()"/>
</insert-template>
</inject-code>
</add-function>
@@ -1217,8 +745,8 @@
<add-function signature="toTuple" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="to_tuple">
- <replace from="%TT_FORMAT" to="dddd" />
- <replace from="%TT_ARGS" to="%CPPSELF.x1(), %CPPSELF.y1(), %CPPSELF.x2(), %CPPSELF.y2()" />
+ <replace from="%TT_FORMAT" to="dddd"/>
+ <replace from="%TT_ARGS" to="%CPPSELF.x1(), %CPPSELF.y1(), %CPPSELF.x2(), %CPPSELF.y2()"/>
</insert-template>
</inject-code>
</add-function>
@@ -1227,15 +755,9 @@
<remove-argument />
</modify-argument>
<modify-argument index="return">
- <replace-type modified-type="(intersectType, intersectionPoint)" />
+ <replace-type modified-type="(intersectType, intersectionPoint)"/>
</modify-argument>
- <inject-code class="target" position="beginning">
- QPointF p;
- %RETURN_TYPE retval = %CPPSELF.%FUNCTION_NAME(%ARGUMENT_NAMES, &amp;p);
- %PYARG_0 = PyTuple_New(2);
- PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](retval));
- PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[QPointF](p));
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qlinef-intersect"/>
</modify-function>
</value-type>
<object-type name="QResource">
@@ -1244,74 +766,37 @@
Returns a read only buffer object pointing to the segment of data that this resource represents. If the resource is compressed the data returns is compressed and qUncompress() must be used to access the data. If the resource is a directory None is returned.
</inject-documentation>
<modify-argument index="return">
- <replace-type modified-type="PyObject" />
+ <replace-type modified-type="PyObject"/>
</modify-argument>
- <inject-code>
- const void *d = %CPPSELF.%FUNCTION_NAME();
- if (d) {
- %PYARG_0 = Shiboken::Buffer::newObject(d, %CPPSELF.size());
- } else {
- Py_INCREF(Py_None);
- %PYARG_0 = Py_None;
- }
- </inject-code>
+ <inject-code file="../glue/qtcore.cpp" snippet="qresource-data"/>
</modify-function>
- <template name="QResource_registerResource">
- uchar *ptr = reinterpret_cast&lt;uchar*&gt;(Shiboken::Buffer::getPointer(%PYARG_1));
- %RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(const_cast&lt;const uchar*&gt;(ptr), %2);
- %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0);
- </template>
<modify-function signature="unregisterResource(const uchar*,const QString&amp;)" rename="unregisterResourceData">
<modify-argument index="1">
<replace-type modified-type="PyBuffer"/>
</modify-argument>
- <inject-code>
- <insert-template name="QResource_registerResource" />
- </inject-code>
+ <inject-code file="../glue/qtcore.cpp" snippet="qresource-registerResource"/>
</modify-function>
<modify-function signature="registerResource(const uchar*,const QString&amp;)" rename="registerResourceData">
<modify-argument index="1">
<replace-type modified-type="PyBuffer"/>
</modify-argument>
- <inject-code>
- <insert-template name="QResource_registerResource" />
- </inject-code>
+ <inject-code file="../glue/qtcore.cpp" snippet="qresource-registerResource"/>
</modify-function>
</object-type>
<value-type name="QBasicTimer"/>
<value-type name="QByteArrayMatcher"/>
<value-type name="QDate" hash-function="PySide::hash" >
- <template name="pydatetime_importandcheck_function">
- #ifdef IS_PY3K
- #define PySideDateTime_IMPORT PyDateTime_IMPORT
- #else
- #define PySideDateTime_IMPORT \
- (PyDateTimeAPI = (PyDateTime_CAPI*) PyCObject_Import((char*)"datetime", \
- (char*)"datetime_CAPI"))
- #endif
- static bool PyDateTime_ImportAndCheck(PyObject *pyIn) {
- if (!PyDateTimeAPI) PySideDateTime_IMPORT;
- return $DATETIMETYPE_Check(pyIn);
- }
- </template>
<inject-code class="native" position="beginning">
<insert-template name="pydatetime_importandcheck_function">
- <replace from="$DATETIMETYPE" to="PyDate" />
+ <replace from="$DATETIMETYPE" to="PyDate"/>
</insert-template>
</inject-code>
<conversion-rule>
<target-to-native>
- <add-conversion type="Py_None">
- %out = %OUTTYPE();
- </add-conversion>
- <add-conversion type="PyDate" check="PyDateTime_ImportAndCheck(%in)">
- int day = PyDateTime_GET_DAY(%in);
- int month = PyDateTime_GET_MONTH(%in);
- int year = PyDateTime_GET_YEAR(%in);
- %out = %OUTTYPE(year, month, day);
- </add-conversion>
+ <add-conversion type="Py_None" file="../glue/qtcore.cpp" snippet="conversion-pynone"/>
+ <add-conversion type="PyDate" check="PyDateTime_ImportAndCheck(%in)" file="../glue/qtcore.cpp" snippet="conversion-qdate-pydate"/>
</target-to-native>
</conversion-rule>
<extra-includes>
@@ -1321,8 +806,8 @@
<add-function signature="__repr__" return-type="PyObject">
<inject-code class="target" position="beginning">
<insert-template name="repr_code">
- <replace from="%REPR_FORMAT" to="%i, %i, %i" />
- <replace from="%REPR_ARGS" to="%CPPSELF.year(), %CPPSELF.month(), %CPPSELF.day()" />
+ <replace from="%REPR_FORMAT" to="%i, %i, %i"/>
+ <replace from="%REPR_ARGS" to="%CPPSELF.year(), %CPPSELF.month(), %CPPSELF.day()"/>
</insert-template>
</inject-code>
</add-function>
@@ -1330,17 +815,13 @@
<add-function signature="__reduce__" return-type="PyObject">
<inject-code class="target" position="beginning">
<insert-template name="reduce_code">
- <replace from="%REDUCE_FORMAT" to="iii" />
- <replace from="%REDUCE_ARGS" to="%CPPSELF.year(), %CPPSELF.month(), %CPPSELF.day()" />
+ <replace from="%REDUCE_FORMAT" to="iii"/>
+ <replace from="%REDUCE_ARGS" to="%CPPSELF.year(), %CPPSELF.month(), %CPPSELF.day()"/>
</insert-template>
</inject-code>
</add-function>
<add-function signature="toPython()" return-type="PyObject">
- <inject-code class="target" position="beginning">
- if (!PyDateTimeAPI)
- PySideDateTime_IMPORT;
- %PYARG_0 = PyDate_FromDate(%CPPSELF.year(), %CPPSELF.month(), %CPPSELF.day());
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qdate-topython"/>
</add-function>
<modify-function signature="getDate(int*,int*,int*)" >
<modify-argument index="1">
@@ -1355,16 +836,7 @@
<modify-argument index="return">
<replace-type modified-type="(year, month, day)"/>
</modify-argument>
- <inject-code class="target" position="beginning">
- int year, month, day;
- %BEGIN_ALLOW_THREADS
- %CPPSELF.%FUNCTION_NAME(&amp;year, &amp;month, &amp;day);
- %END_ALLOW_THREADS
- %PYARG_0 = PyTuple_New(3);
- PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[int](year));
- PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[int](month));
- PyTuple_SET_ITEM(%PYARG_0, 2, %CONVERTTOPYTHON[int](day));
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qdate-getdate"/>
</modify-function>
<modify-function signature="weekNumber(int*)const" >
<modify-argument index="1">
@@ -1373,38 +845,19 @@
<modify-argument index="return">
<replace-type modified-type="(week, yearNumber)"/>
</modify-argument>
- <inject-code class="target" position="beginning">
- int yearNumber;
- %BEGIN_ALLOW_THREADS
- int week = %CPPSELF.%FUNCTION_NAME(&amp;yearNumber);
- %END_ALLOW_THREADS
- %PYARG_0 = PyTuple_New(2);
- PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[int](week));
- PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[int](yearNumber));
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qdate-weeknumber"/>
</modify-function>
</value-type>
<value-type name="QDateTime" hash-function="PySide::hash">
<inject-code class="native" position="beginning">
<insert-template name="pydatetime_importandcheck_function">
- <replace from="$DATETIMETYPE" to="PyDateTime" />
+ <replace from="$DATETIMETYPE" to="PyDateTime"/>
</insert-template>
</inject-code>
<conversion-rule>
<target-to-native>
- <add-conversion type="Py_None">
- %out = %OUTTYPE();
- </add-conversion>
- <add-conversion type="PyDateTime" check="PyDateTime_ImportAndCheck(%in)">
- int day = PyDateTime_GET_DAY(%in);
- int month = PyDateTime_GET_MONTH(%in);
- int year = PyDateTime_GET_YEAR(%in);
- int hour = PyDateTime_DATE_GET_HOUR(%in);
- int min = PyDateTime_DATE_GET_MINUTE(%in);
- int sec = PyDateTime_DATE_GET_SECOND(%in);
- int usec = PyDateTime_DATE_GET_MICROSECOND(%in);
- %out = %OUTTYPE(QDate(year, month, day), QTime(hour, min, sec, usec/1000));
- </add-conversion>
+ <add-conversion type="Py_None" file="../glue/qtcore.cpp" snippet="conversion-pynone"/>
+ <add-conversion type="PyDateTime" check="PyDateTime_ImportAndCheck(%in)" file="../glue/qtcore.cpp" snippet="conversion-qdatetime-pydatetime"/>
</target-to-native>
</conversion-rule>
<extra-includes>
@@ -1415,52 +868,39 @@
<modify-argument index="8">
<replace-default-expression with="Qt::LocalTime"/>
</modify-argument>
- <inject-code class="target" position="beginning">
- QDate date(%1, %2, %3);
- QTime time(%4, %5, %6, %7);
- %0 = new %TYPE(date, time, Qt::TimeSpec(%8));
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qdatetime-1"/>
</add-function>
<add-function signature="QDateTime(int,int,int,int,int,int)">
- <inject-code class="target" position="beginning">
- QDate date(%1, %2, %3);
- QTime time(%4, %5, %6);
- %0 = new %TYPE(date, time);
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qdatetime-2"/>
</add-function>
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="repr_code">
- <replace from="%REPR_FORMAT" to="%i, %i, %i, %i, %i, %i, %i, %i" />
- <replace from="%REPR_ARGS" to="%CPPSELF.date().year(), %CPPSELF.date().month(), %CPPSELF.date().day(), %CPPSELF.time().hour(), %CPPSELF.time().minute(), %CPPSELF.time().second(), %CPPSELF.time().msec(), (int)%CPPSELF.timeSpec()" />
+ <replace from="%REPR_FORMAT" to="%i, %i, %i, %i, %i, %i, %i, %i"/>
+ <replace from="%REPR_ARGS" to="%CPPSELF.date().year(), %CPPSELF.date().month(), %CPPSELF.date().day(), %CPPSELF.time().hour(), %CPPSELF.time().minute(), %CPPSELF.time().second(), %CPPSELF.time().msec(), (int)%CPPSELF.timeSpec()"/>
</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="iiiiiiii" />
- <replace from="%REDUCE_ARGS" to="%CPPSELF.date().year(), %CPPSELF.date().month(), %CPPSELF.date().day(), %CPPSELF.time().hour(), %CPPSELF.time().minute(), %CPPSELF.time().second(), %CPPSELF.time().msec(), (int)%CPPSELF.timeSpec()" />
+ <replace from="%REDUCE_FORMAT" to="iiiiiiii"/>
+ <replace from="%REDUCE_ARGS" to="%CPPSELF.date().year(), %CPPSELF.date().month(), %CPPSELF.date().day(), %CPPSELF.time().hour(), %CPPSELF.time().minute(), %CPPSELF.time().second(), %CPPSELF.time().msec(), (int)%CPPSELF.timeSpec()"/>
</insert-template>
</inject-code>
</add-function>
<add-function signature="toPython()" return-type="PyObject">
- <inject-code class="target" position="beginning">
- QDate date = %CPPSELF.date();
- QTime time = %CPPSELF.time();
- if (!PyDateTimeAPI) PySideDateTime_IMPORT;
- %PYARG_0 = PyDateTime_FromDateAndTime(date.year(), date.month(), date.day(), time.hour(), time.minute(), time.second(), time.msec()*1000);
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qdatetime-topython"/>
</add-function>
</value-type>
<value-type name="QDir">
<enum-type name="Filter" flags="Filters"/>
- <enum-type name="SortFlag" flags="SortFlags" />
+ <enum-type name="SortFlag" flags="SortFlags"/>
<add-function signature="__reduce__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="reduce_code">
- <replace from="%REDUCE_FORMAT" to="s" />
- <replace from="%REDUCE_ARGS" to="qPrintable(%CPPSELF.path())" />
+ <replace from="%REDUCE_FORMAT" to="s"/>
+ <replace from="%REDUCE_ARGS" to="qPrintable(%CPPSELF.path())"/>
</insert-template>
</inject-code>
</add-function>
@@ -1470,8 +910,8 @@
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="repr_code">
- <replace from="%REPR_FORMAT" to="%i, %i" />
- <replace from="%REPR_ARGS" to="%CPPSELF.x(), %CPPSELF.y()" />
+ <replace from="%REPR_FORMAT" to="%i, %i"/>
+ <replace from="%REPR_ARGS" to="%CPPSELF.x(), %CPPSELF.y()"/>
</insert-template>
</inject-code>
</add-function>
@@ -1479,24 +919,18 @@
<add-function signature="__reduce__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="reduce_code">
- <replace from="%REDUCE_FORMAT" to="ii" />
- <replace from="%REDUCE_ARGS" to="%CPPSELF.x(), %CPPSELF.y()" />
+ <replace from="%REDUCE_FORMAT" to="ii"/>
+ <replace from="%REDUCE_ARGS" to="%CPPSELF.x(), %CPPSELF.y()"/>
</insert-template>
</inject-code>
</add-function>
- <inject-code class="native" position="beginning">
- namespace PySide {
- template&lt;&gt; inline uint hash(const QPoint &amp;v) {
- return qHash(qMakePair(v.x(), v.y()));
- }
- };
- </inject-code>
+ <inject-code class="native" position="beginning" file="../glue/qtcore.cpp" snippet="qpoint"/>
<add-function signature="toTuple" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="to_tuple">
- <replace from="%TT_FORMAT" to="ii" />
- <replace from="%TT_ARGS" to="%CPPSELF.x(), %CPPSELF.y()" />
+ <replace from="%TT_FORMAT" to="ii"/>
+ <replace from="%TT_ARGS" to="%CPPSELF.x(), %CPPSELF.y()"/>
</insert-template>
</inject-code>
</add-function>
@@ -1510,8 +944,8 @@
<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" />
- <replace from="%REPR_ARGS" to="%CPPSELF.x(), %CPPSELF.y()" />
+ <replace from="%REPR_FORMAT" to="%f, %f"/>
+ <replace from="%REPR_ARGS" to="%CPPSELF.x(), %CPPSELF.y()"/>
</insert-template>
</inject-code>
</add-function>
@@ -1519,8 +953,8 @@
<add-function signature="__reduce__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="reduce_code">
- <replace from="%REDUCE_FORMAT" to="dd" />
- <replace from="%REDUCE_ARGS" to="%CPPSELF.x(), %CPPSELF.y()" />
+ <replace from="%REDUCE_FORMAT" to="dd"/>
+ <replace from="%REDUCE_ARGS" to="%CPPSELF.x(), %CPPSELF.y()"/>
</insert-template>
</inject-code>
</add-function>
@@ -1528,8 +962,8 @@
<add-function signature="toTuple" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="to_tuple">
- <replace from="%TT_FORMAT" to="dd" />
- <replace from="%TT_ARGS" to="%CPPSELF.x(), %CPPSELF.y()" />
+ <replace from="%TT_FORMAT" to="dd"/>
+ <replace from="%TT_ARGS" to="%CPPSELF.x(), %CPPSELF.y()"/>
</insert-template>
</inject-code>
</add-function>
@@ -1543,30 +977,24 @@
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="repr_code">
- <replace from="%REPR_FORMAT" to="%i, %i, %i, %i" />
- <replace from="%REPR_ARGS" to="%CPPSELF.x(), %CPPSELF.y(), %CPPSELF.width(), %CPPSELF.height()" />
+ <replace from="%REPR_FORMAT" to="%i, %i, %i, %i"/>
+ <replace from="%REPR_ARGS" to="%CPPSELF.x(), %CPPSELF.y(), %CPPSELF.width(), %CPPSELF.height()"/>
</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="iiii" />
- <replace from="%REDUCE_ARGS" to="%CPPSELF.x(), %CPPSELF.y(), %CPPSELF.width(), %CPPSELF.height()" />
+ <replace from="%REDUCE_FORMAT" to="iiii"/>
+ <replace from="%REDUCE_ARGS" to="%CPPSELF.x(), %CPPSELF.y(), %CPPSELF.width(), %CPPSELF.height()"/>
</insert-template>
</inject-code>
</add-function>
- <inject-code class="native" position="beginning">
- namespace PySide {
- template&lt;&gt; inline uint hash(const QRect &amp;v) {
- return qHash(qMakePair(qMakePair(v.x(), v.y()), qMakePair(v.width(), v.height())));
- }
- };
- </inject-code>
+ <inject-code class="native" position="beginning" file="../glue/qtcore.cpp" snippet="qrect"/>
<modify-function signature="getCoords(int*,int*,int*,int*)const">
<modify-argument index="return">
- <replace-type modified-type="PyObject" />
+ <replace-type modified-type="PyObject"/>
</modify-argument>
<modify-argument index="1">
<remove-argument />
@@ -1582,13 +1010,13 @@
</modify-argument>
<inject-code class="target">
<insert-template name="fix_number*,number*,number*,number*">
- <replace from="$TYPE" to="int" />
+ <replace from="$TYPE" to="int"/>
</insert-template>
</inject-code>
</modify-function>
<modify-function signature="getRect(int*,int*,int*,int*)const">
<modify-argument index="return">
- <replace-type modified-type="PyObject" />
+ <replace-type modified-type="PyObject"/>
</modify-argument>
<modify-argument index="1">
<remove-argument />
@@ -1604,7 +1032,7 @@
</modify-argument>
<inject-code class="target">
<insert-template name="fix_number*,number*,number*,number*">
- <replace from="$TYPE" to="int" />
+ <replace from="$TYPE" to="int"/>
</insert-template>
</inject-code>
</modify-function>
@@ -1613,8 +1041,8 @@
<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" />
- <replace from="%REPR_ARGS" to="%CPPSELF.x(), %CPPSELF.y(), %CPPSELF.width(), %CPPSELF.height()" />
+ <replace from="%REPR_FORMAT" to="%f, %f, %f, %f"/>
+ <replace from="%REPR_ARGS" to="%CPPSELF.x(), %CPPSELF.y(), %CPPSELF.width(), %CPPSELF.height()"/>
</insert-template>
</inject-code>
</add-function>
@@ -1626,14 +1054,14 @@
<add-function signature="__reduce__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="reduce_code">
- <replace from="%REDUCE_FORMAT" to="dddd" />
- <replace from="%REDUCE_ARGS" to="%CPPSELF.x(), %CPPSELF.y(), %CPPSELF.width(), %CPPSELF.height()" />
+ <replace from="%REDUCE_FORMAT" to="dddd"/>
+ <replace from="%REDUCE_ARGS" to="%CPPSELF.x(), %CPPSELF.y(), %CPPSELF.width(), %CPPSELF.height()"/>
</insert-template>
</inject-code>
</add-function>
<modify-function signature="getCoords(qreal*,qreal*,qreal*,qreal*)const">
<modify-argument index="return">
- <replace-type modified-type="PyObject" />
+ <replace-type modified-type="PyObject"/>
</modify-argument>
<modify-argument index="1">
<remove-argument />
@@ -1649,13 +1077,13 @@
</modify-argument>
<inject-code class="target">
<insert-template name="fix_number*,number*,number*,number*">
- <replace from="$TYPE" to="qreal" />
+ <replace from="$TYPE" to="qreal"/>
</insert-template>
</inject-code>
</modify-function>
<modify-function signature="getRect(qreal*,qreal*,qreal*,qreal*)const">
<modify-argument index="return">
- <replace-type modified-type="PyObject" />
+ <replace-type modified-type="PyObject"/>
</modify-argument>
<modify-argument index="1">
<remove-argument />
@@ -1671,7 +1099,7 @@
</modify-argument>
<inject-code class="target">
<insert-template name="fix_number*,number*,number*,number*">
- <replace from="$TYPE" to="qreal" />
+ <replace from="$TYPE" to="qreal"/>
</insert-template>
</inject-code>
</modify-function>
@@ -1680,8 +1108,8 @@
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="repr_code">
- <replace from="%REPR_FORMAT" to="%i, %i" />
- <replace from="%REPR_ARGS" to="%CPPSELF.width(), %CPPSELF.height()" />
+ <replace from="%REPR_FORMAT" to="%i, %i"/>
+ <replace from="%REPR_ARGS" to="%CPPSELF.width(), %CPPSELF.height()"/>
</insert-template>
</inject-code>
</add-function>
@@ -1689,24 +1117,18 @@
<add-function signature="__reduce__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="reduce_code">
- <replace from="%REDUCE_FORMAT" to="ii" />
- <replace from="%REDUCE_ARGS" to="%CPPSELF.width(), %CPPSELF.height()" />
+ <replace from="%REDUCE_FORMAT" to="ii"/>
+ <replace from="%REDUCE_ARGS" to="%CPPSELF.width(), %CPPSELF.height()"/>
</insert-template>
</inject-code>
</add-function>
- <inject-code class="native" position="beginning">
- namespace PySide {
- template&lt;&gt; inline uint hash(const QSize &amp;v) {
- return qHash(qMakePair(v.width(), v.height()));
- }
- };
- </inject-code>
+ <inject-code class="native" position="beginning" file="../glue/qtcore.cpp" snippet="qsize"/>
<add-function signature="toTuple" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="to_tuple">
- <replace from="%TT_FORMAT" to="ii" />
- <replace from="%TT_ARGS" to="%CPPSELF.width(), %CPPSELF.height()" />
+ <replace from="%TT_FORMAT" to="ii"/>
+ <replace from="%TT_ARGS" to="%CPPSELF.width(), %CPPSELF.height()"/>
</insert-template>
</inject-code>
</add-function>
@@ -1720,8 +1142,8 @@
<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" />
- <replace from="%REPR_ARGS" to="%CPPSELF.width(), %CPPSELF.height()" />
+ <replace from="%REPR_FORMAT" to="%f, %f"/>
+ <replace from="%REPR_ARGS" to="%CPPSELF.width(), %CPPSELF.height()"/>
</insert-template>
</inject-code>
</add-function>
@@ -1729,8 +1151,8 @@
<add-function signature="__reduce__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="reduce_code">
- <replace from="%REDUCE_FORMAT" to="dd" />
- <replace from="%REDUCE_ARGS" to="%CPPSELF.width(), %CPPSELF.height()" />
+ <replace from="%REDUCE_FORMAT" to="dd"/>
+ <replace from="%REDUCE_ARGS" to="%CPPSELF.width(), %CPPSELF.height()"/>
</insert-template>
</inject-code>
</add-function>
@@ -1738,36 +1160,28 @@
<add-function signature="toTuple" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="to_tuple">
- <replace from="%TT_FORMAT" to="dd" />
- <replace from="%TT_ARGS" to="%CPPSELF.width(), %CPPSELF.height()" />
+ <replace from="%TT_FORMAT" to="dd"/>
+ <replace from="%TT_ARGS" to="%CPPSELF.width(), %CPPSELF.height()"/>
</insert-template>
</inject-code>
</add-function>
<!--### Functions removed because they return references to Python imutable objects -->
- <modify-function signature="rheight()" remove="all" />
- <modify-function signature="rwidth()" remove="all" />
+ <modify-function signature="rheight()" remove="all"/>
+ <modify-function signature="rwidth()" remove="all"/>
<!--### -->
</value-type>
<value-type name="QTime" hash-function="PySide::hash">
<inject-code class="native" position="beginning">
<insert-template name="pydatetime_importandcheck_function">
- <replace from="$DATETIMETYPE" to="PyTime" />
+ <replace from="$DATETIMETYPE" to="PyTime"/>
</insert-template>
</inject-code>
<conversion-rule>
<target-to-native>
- <add-conversion type="Py_None">
- %out = %OUTTYPE();
- </add-conversion>
- <add-conversion type="PyTime" check="PyDateTime_ImportAndCheck(%in)">
- int hour = PyDateTime_TIME_GET_HOUR(%in);
- int min = PyDateTime_TIME_GET_MINUTE(%in);
- int sec = PyDateTime_TIME_GET_SECOND(%in);
- int usec = PyDateTime_TIME_GET_MICROSECOND(%in);
- %out = %OUTTYPE(hour, min, sec, usec/1000);
- </add-conversion>
+ <add-conversion type="Py_None" file="../glue/qtcore.cpp" snippet="conversion-pynone"/>
+ <add-conversion type="PyTime" check="PyDateTime_ImportAndCheck(%in)" file="../glue/qtcore.cpp" snippet="conversion-qtime-pytime"/>
</target-to-native>
</conversion-rule>
@@ -1778,33 +1192,24 @@
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="repr_code">
- <replace from="%REPR_FORMAT" to="%i, %i, %i, %i" />
- <replace from="%REPR_ARGS" to="%CPPSELF.hour(), %CPPSELF.minute(), %CPPSELF.second(), %CPPSELF.msec()" />
+ <replace from="%REPR_FORMAT" to="%i, %i, %i, %i"/>
+ <replace from="%REPR_ARGS" to="%CPPSELF.hour(), %CPPSELF.minute(), %CPPSELF.second(), %CPPSELF.msec()"/>
</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="iiii" />
- <replace from="%REDUCE_ARGS" to="%CPPSELF.hour(), %CPPSELF.minute(), %CPPSELF.second(), %CPPSELF.msec()" />
+ <replace from="%REDUCE_FORMAT" to="iiii"/>
+ <replace from="%REDUCE_ARGS" to="%CPPSELF.hour(), %CPPSELF.minute(), %CPPSELF.second(), %CPPSELF.msec()"/>
</insert-template>
</inject-code>
</add-function>
<add-function signature="toPython()" return-type="PyObject">
- <inject-code class="target" position="beginning">
- if (!PyDateTimeAPI)
- PySideDateTime_IMPORT;
- %PYARG_0 = PyTime_FromTime(%CPPSELF.hour(), %CPPSELF.minute(), %CPPSELF.second(), %CPPSELF.msec()*1000);
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qtime-topython"/>
</add-function>
</value-type>
<value-type name="QPersistentModelIndex" hash-function="qHash">
- <modify-function signature="internalPointer()const">
- <inject-code class="target" position="beginning">
- <insert-template name="return_internal_pointer" />
- </inject-code>
- </modify-function>
<modify-function signature="operator const QModelIndex&amp;()const">
<modify-argument index="return">
<parent index="this" action="add"/>
@@ -1825,32 +1230,32 @@
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="repr_code">
- <replace from="%REPR_FORMAT" to="'%s'" />
- <replace from="%REPR_ARGS" to="qPrintable(%CPPSELF.toString())" />
+ <replace from="%REPR_FORMAT" to="'%s'"/>
+ <replace from="%REPR_ARGS" to="qPrintable(%CPPSELF.toString())"/>
</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="s" />
- <replace from="%REDUCE_ARGS" to="qPrintable(%CPPSELF.toString())" />
+ <replace from="%REDUCE_FORMAT" to="s"/>
+ <replace from="%REDUCE_ARGS" to="qPrintable(%CPPSELF.toString())"/>
</insert-template>
</inject-code>
</add-function>
</value-type>
- <value-type name="QMimeType" since="5.0" />
+ <value-type name="QMimeType" since="5.0"/>
<object-type name="QMimeDatabase" since="5.0">
- <enum-type name="MatchMode" />
+ <enum-type name="MatchMode"/>
</object-type>
<value-type name="QLocale">
- <enum-type name="Country" />
+ <enum-type name="Country"/>
<enum-type name="DataSizeFormat" flags="DataSizeFormats" since="5.10"/>
<enum-type name="FloatingPointPrecisionOption" since="5.7"/>
<enum-type name="FormatType"/>
- <enum-type name="Language" />
+ <enum-type name="Language"/>
<enum-type name="MeasurementSystem"/>
<enum-type name="NumberOption" flags="NumberOptions"/>
<enum-type name="Script" since="4.8" revision="4800"/>
@@ -1866,12 +1271,12 @@
</extra-includes>
<modify-function signature="toTime(QString,QLocale::FormatType)const">
<modify-argument index="2">
- <rename to="format" />
+ <rename to="format"/>
</modify-argument>
</modify-function>
<modify-function signature="toDate(QString,QLocale::FormatType)const">
<modify-argument index="2">
- <rename to="format" />
+ <rename to="format"/>
</modify-argument>
</modify-function>
<!-- Qt5: ignore the new QStringRef versions, int arg is gone -->
@@ -1885,7 +1290,7 @@
<replace-type modified-type="(int, bool ok)"/>
</modify-argument>
<inject-code class="target" position="beginning">
- <insert-template name="fix_args,bool*" />
+ <insert-template name="fix_args,bool*"/>
</inject-code>
</modify-function>
<!-- Qt5: ignore the new QStringRef versions, int arg is gone -->
@@ -1899,7 +1304,7 @@
<replace-type modified-type="(int, bool ok)"/>
</modify-argument>
<inject-code class="target" position="beginning">
- <insert-template name="fix_args,bool*" />
+ <insert-template name="fix_args,bool*"/>
</inject-code>
</modify-function>
<!-- Qt5: ignore the new QStringRef versions -->
@@ -1913,7 +1318,7 @@
<replace-type modified-type="(float, bool ok)"/>
</modify-argument>
<inject-code class="target" position="beginning">
- <insert-template name="fix_args,bool*" />
+ <insert-template name="fix_args,bool*"/>
</inject-code>
</modify-function>
<!-- Qt5: ignore the new QStringRef versions -->
@@ -1927,7 +1332,7 @@
<replace-type modified-type="(float, bool ok)"/>
</modify-argument>
<inject-code class="target" position="beginning">
- <insert-template name="fix_args,bool*" />
+ <insert-template name="fix_args,bool*"/>
</inject-code>
</modify-function>
<!-- Qt5: ignore the new QStringRef versions, int arg is gone -->
@@ -1940,7 +1345,7 @@
<replace-type modified-type="(int, bool ok)"/>
</modify-argument>
<inject-code class="target" position="beginning">
- <insert-template name="fix_args,bool*" />
+ <insert-template name="fix_args,bool*"/>
</inject-code>
</modify-function>
<!-- Qt5: ignore the new QStringRef versions, int arg is gone -->
@@ -1953,7 +1358,7 @@
<replace-type modified-type="(int, bool ok)"/>
</modify-argument>
<inject-code class="target" position="beginning">
- <insert-template name="fix_args,bool*" />
+ <insert-template name="fix_args,bool*"/>
</inject-code>
</modify-function>
<!-- Qt5: ignore the new QStringRef versions, int arg is gone -->
@@ -1966,7 +1371,7 @@
<replace-type modified-type="(int, bool ok)"/>
</modify-argument>
<inject-code class="target" position="beginning">
- <insert-template name="fix_args,bool*" />
+ <insert-template name="fix_args,bool*"/>
</inject-code>
</modify-function>
<!-- Qt5: ignore the new QStringRef versions, int arg is gone -->
@@ -1979,34 +1384,19 @@
<replace-type modified-type="(int, bool ok)"/>
</modify-argument>
<inject-code class="target" position="beginning">
- <insert-template name="fix_args,bool*" />
+ <insert-template name="fix_args,bool*"/>
</inject-code>
</modify-function>
</value-type>
<value-type name="QBitArray" hash-function="qHash" >
<add-function signature="__len__">
- <inject-code class="target" position="beginning">
- return %CPPSELF.size();
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qbitarray-len"/>
</add-function>
<add-function signature="__getitem__">
- <inject-code class="target" position="beginning">
- if (_i &lt; 0 || _i >= %CPPSELF.size()) {
- PyErr_SetString(PyExc_IndexError, "index out of bounds");
- return 0;
- }
- bool ret = %CPPSELF.at(_i);
- return %CONVERTTOPYTHON[bool](ret);
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qbitarray-getitem"/>
</add-function>
<add-function signature="__setitem__">
- <inject-code class="target" position="beginning">
- PyObject *args = Py_BuildValue("(iiO)", _i, 1, _value);
- PyObject *result = Sbk_QBitArrayFunc_setBit(self, args);
- Py_DECREF(args);
- Py_XDECREF(result);
- return !result ? -1 : 0;
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qbitarray-setitem"/>
</add-function>
</value-type>
<object-type name="QLockFile">
@@ -2029,12 +1419,10 @@
<reference-count action="set"/>
</modify-argument>
</modify-function>
- <modify-function signature="relock()" allow-thread="yes" />
- <add-function signature="__enter__()" />
+ <modify-function signature="relock()" allow-thread="yes"/>
+ <add-function signature="__enter__()"/>
<add-function signature="__exit__(PyObject*,PyObject*,PyObject*)">
- <inject-code>
- %CPPSELF.unlock();
- </inject-code>
+ <inject-code file="../glue/qtcore.cpp" snippet="unlock"/>
</add-function>
</object-type>
<object-type name="QWriteLocker">
@@ -2043,12 +1431,10 @@
<reference-count action="set"/>
</modify-argument>
</modify-function>
- <modify-function signature="relock()" allow-thread="yes" />
- <add-function signature="__enter__()" />
+ <modify-function signature="relock()" allow-thread="yes"/>
+ <add-function signature="__enter__()"/>
<add-function signature="__exit__(PyObject*,PyObject*,PyObject*)">
- <inject-code>
- %CPPSELF.unlock();
- </inject-code>
+ <inject-code file="../glue/qtcore.cpp" snippet="unlock"/>
</add-function>
</object-type>
<object-type name="QDirIterator">
@@ -2057,56 +1443,30 @@
<object-type name="QThread">
<enum-type name="Priority"/>
<modify-function signature="currentThreadId()" remove="all"/>
- <modify-function signature="run()" thread="yes" />
- <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(unsigned long)" allow-thread="yes" />
+ <modify-function signature="run()" thread="yes"/>
+ <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(unsigned long)" allow-thread="yes"/>
<modify-function signature="start(QThread::Priority)" allow-thread="yes">
<modify-argument index="1">
<rename to="priority"/>
</modify-argument>
</modify-function>
- <modify-function signature="exit(int)" allow-thread="yes" />
+ <modify-function signature="exit(int)" allow-thread="yes"/>
</object-type>
<object-type name="QAbstractItemModel">
- <enum-type name="CheckIndexOption" flags="CheckIndexOptions" class="yes" since="5.11"/>
- <enum-type name="LayoutChangeHint" />
- <!-- This function was replaced by a added function -->
- <modify-function signature="createIndex(int,int,void*)const" remove="all"/>
+ <enum-type name="CheckIndexOption" flags="CheckIndexOptions" since="5.11"/>
+ <enum-type name="LayoutChangeHint"/>
<!-- This function is the same as createIndex(int, int, int)const -->
<modify-function signature="createIndex(int,int,quintptr)const">
<modify-argument index="3">
- <replace-default-expression with="0" />
+ <replace-default-expression with="0"/>
</modify-argument>
</modify-function>
- <add-function signature="createIndex(int,int,PyObject*)const" return-type="QModelIndex">
- <modify-argument index="1">
- <rename to="row"/>
- </modify-argument>
- <modify-argument index="2">
- <rename to="column"/>
- </modify-argument>
- <modify-argument index="3">
- <rename to="ptr"/>
- </modify-argument>
- <inject-code class="target" position="beginning">
- %RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(%1, %2, %PYARG_3);
- %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0);
- </inject-code>
- <inject-documentation mode="append" format="target">
- Creates a model index for the given row and column with the internal pointer ptr.
- When using a QSortFilterProxyModel, its indexes have their own internal pointer. It is not advisable to access this internal pointer outside of the model. Use the data() function instead.
- This function provides a consistent interface that model subclasses must use to create model indexes.
-
- .. warning:: Because of some Qt/Python itegration rules, the ptr argument do not get the reference incremented during the QModelIndex life time. So it is necessary to keep the object used on ptr argument alive during the whole process. Do not destroy the object if you are not sure about that.
- </inject-documentation>
- </add-function>
- <inject-code class="target" position="end">
- qRegisterMetaType&lt;QVector&lt;int&gt; &gt;("QVector&lt;int&gt;");
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="qabstractitemmodel"/>
<modify-function signature="mimeData(QModelIndexList)const">
<modify-argument index="return">
<define-ownership class="native" owner="c++"/>
@@ -2132,7 +1492,6 @@
<value-type name="QItemSelectionRange" hash-function="qHash">
</value-type>
- <primitive-type name="QModelIndexList"/>
<object-type name="QAbstractProxyModel" polymorphic-id-expression="qobject_cast&lt;QAbstractProxyModel*&gt;(%1)">
<extra-includes>
<include file-name="QItemSelection" location="global"/>
@@ -2141,9 +1500,6 @@
</extra-includes>
</object-type>
<object-type name="QSortFilterProxyModel">
- <!-- ### This reimplementation of "QObject::parent()" is used in C++ only
- when "using QObject::parent;" is not available. It's useless in Python. -->
- <modify-function signature="parent()const" remove="all"/>
<extra-includes>
<include file-name="QItemSelection" location="global"/>
<include file-name="QStringList" location="global"/>
@@ -2165,13 +1521,10 @@
<extra-includes>
<include file-name="QThread" location="global"/>
<include file-name="QCoreApplication" location="global"/>
- <include file-name="signalmanager.h" location="local" />
+ <include file-name="signalmanager.h" location="local"/>
</extra-includes>
<modify-function signature="metaObject()const">
- <inject-code class="target" position="beginning">
- %RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME();
- %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0);
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qobject-metaobject"/>
<modify-argument index="return">
<reference-count action="set"/>
</modify-argument>
@@ -2216,92 +1569,57 @@
<modify-argument index="4">
<rename to="type"/>
</modify-argument>
- <inject-code class="target" position="beginning" file="">
- // %FUNCTION_NAME() - disable generation of function call.
- bool %0 = qobjectConnect(%1, %2, %CPPSELF, %3, %4);
- %PYARG_0 = %CONVERTTOPYTHON[bool](%0);
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qobject-connect-1"/>
</modify-function>
<!-- static version -->
<modify-function signature="connect(const QObject*,QMetaMethod,const QObject*,QMetaMethod,Qt::ConnectionType)">
<modify-argument index="5">
<rename to="type"/>
</modify-argument>
- <inject-code class="target" position="beginning" file="">
- // %FUNCTION_NAME() - disable generation of function call.
- bool %0 = qobjectConnect(%1, %2, %3, %4, %5);
- %PYARG_0 = %CONVERTTOPYTHON[bool](%0);
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qobject-connect-2"/>
</modify-function>
<modify-function signature="connect(const QObject*,const char*,const QObject*,const char*,Qt::ConnectionType)">
<modify-argument index="5">
<rename to="type"/>
</modify-argument>
- <inject-code class="target" position="beginning">
- // %FUNCTION_NAME() - disable generation of function call.
- bool %0 = qobjectConnect(%1, %2, %3, %4, %5);
- %PYARG_0 = %CONVERTTOPYTHON[bool](%0);
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qobject-connect-3"/>
</modify-function>
- <inject-code class="native" position="beginning" file="glue/qobject_connect.cpp" />
+ <inject-code class="native" position="beginning" file="../glue/qtcore.cpp" snippet="qobject-connect"/>
<add-function signature="connect(const QObject*,const char*,PyCallable*,Qt::ConnectionType)" return-type="bool" static="yes">
<modify-argument index="4">
<rename to="type"/>
- <replace-default-expression with="Qt::AutoConnection" />
+ <replace-default-expression with="Qt::AutoConnection"/>
</modify-argument>
- <inject-code class="target" position="beginning">
- // %FUNCTION_NAME() - disable generation of function call.
- %RETURN_TYPE %0 = qobjectConnectCallback(%1, %2, %PYARG_3, %4);
- %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0);
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qobject-connect-4"/>
</add-function>
<!-- static version -->
<add-function signature="connect(const char*,PyCallable*,Qt::ConnectionType)" return-type="bool">
<modify-argument index="3">
<rename to="type"/>
- <replace-default-expression with="Qt::AutoConnection" />
+ <replace-default-expression with="Qt::AutoConnection"/>
</modify-argument>
- <inject-code class="target" position="beginning">
- // %FUNCTION_NAME() - disable generation of function call.
- %RETURN_TYPE %0 = qobjectConnectCallback(%CPPSELF, %1, %PYARG_2, %3);
- %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0);
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qobject-connect-5"/>
</add-function>
<add-function signature="connect(const char*,const QObject*,const char*,Qt::ConnectionType)" return-type="bool">
<modify-argument index="4">
<rename to="type"/>
- <replace-default-expression with="Qt::AutoConnection" />
+ <replace-default-expression with="Qt::AutoConnection"/>
</modify-argument>
- <inject-code class="target" position="beginning">
- // %FUNCTION_NAME() - disable generation of function call.
- %RETURN_TYPE %0 = qobjectConnect(%CPPSELF, %1, %2, %3, %4);
- %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0);
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qobject-connect-6"/>
</add-function>
<add-function signature="emit(const char*,...)" return-type="bool">
- <inject-code class="target" position="beginning">
- %RETURN_TYPE %0 = PySide::SignalManager::instance().emitSignal(%CPPSELF, %1, %PYARG_2);
- %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0);
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qobject-emit"/>
</add-function>
<add-function signature="disconnect(const char*,PyCallable*)" return-type="bool">
- <inject-code class="target" position="beginning">
- // %FUNCTION_NAME() - disable generation of function call.
- %RETURN_TYPE %0 = qobjectDisconnectCallback(%CPPSELF, %1, %2);
- %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0);
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qobject-disconnect-1"/>
</add-function>
<add-function signature="disconnect(const QObject*,const char*,PyCallable*)" return-type="bool" static="yes">
- <inject-code class="target" position="beginning">
- // %FUNCTION_NAME() - disable generation of function call.
- %RETURN_TYPE %0 = qobjectDisconnectCallback(%1, %2, %3);
- %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0);
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qobject-disconnect-2"/>
</add-function>
- <inject-code class="native" file="glue/qobject_findchild.cpp"/>
+ <inject-code class="native" file="../glue/qtcore.cpp" snippet="qobject-findchild-1"/>
<add-function signature="findChild(PyTypeObject*,const QString&amp;)" return-type="PyObject*">
<inject-documentation format="target" mode="append">
To find the child of a certain QObject, the first argument of this function should be the child's type, and the second the name of the child:
@@ -2316,37 +1634,28 @@
child2 = parent.findChild(QWidget, "child_widget")
</inject-documentation>
- <inject-code class="target" position="beginning">
- QObject *child = _findChildHelper(%CPPSELF, %2, (PyTypeObject*)%PYARG_1);
- %PYARG_0 = %CONVERTTOPYTHON[QObject*](child);
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qobject-findchild-2"/>
<modify-argument index="return">
<parent index="this" action="add"/>
</modify-argument>
<modify-argument index="2">
- <replace-default-expression with="QString()" />
+ <replace-default-expression with="QString()"/>
</modify-argument>
</add-function>
<add-function signature="findChildren(PyTypeObject*,const QString&amp;)" return-type="PySequence*" >
<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">
- %PYARG_0 = PyList_New(0);
- _findChildrenHelper(%CPPSELF, %2, (PyTypeObject*)%PYARG_1, %PYARG_0);
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qobject-findchildren-1"/>
<modify-argument index="return">
<parent index="this" action="add"/>
</modify-argument>
<modify-argument index="2">
- <replace-default-expression with="QString()" />
+ <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">
- %PYARG_0 = PyList_New(0);
- _findChildrenHelper(%CPPSELF, %2, (PyTypeObject*)%PYARG_1, %PYARG_0);
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qobject-findchildren-2"/>
<modify-argument index="return">
<parent index="this" action="add"/>
</modify-argument>
@@ -2360,33 +1669,11 @@
<replace-default-expression with="-1"/>
</modify-argument>
- <inject-code class="target" position="beginning">
- QString result;
- if (QCoreApplication::instance()) {
- PyObject *klass = PyObject_GetAttrString(%PYSELF, "__class__");
- PyObject *cname = PyObject_GetAttrString(klass, "__name__");
- result = QString(QCoreApplication::instance()->translate(Shiboken::String::toCString(cname),
- /* %1, %2, QCoreApplication::CodecForTr, %3)); */
- %1, %2, %3));
-
- Py_DECREF(klass);
- Py_DECREF(cname);
- } else {
- result = QString(QString::fromLatin1(%1));
- }
- %PYARG_0 = %CONVERTTOPYTHON[QString](result);
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qobject-tr"/>
</add-function>
<modify-function signature="receivers(const char*)const">
- <inject-code class="target" position="beginning">
- // Avoid return +1 because SignalManager connect to "destroyed()" signal to control object timelife
- int ret = %CPPSELF.%FUNCTION_NAME(%1);
- if (ret > 0 &amp;&amp; ((strcmp(%1, SIGNAL(destroyed())) == 0) || (strcmp(%1, SIGNAL(destroyed(QObject*))) == 0)))
- ret -= PySide::SignalManager::instance().countConnectionsWith(%CPPSELF);
-
- %PYARG_0 = %CONVERTTOPYTHON[int](ret);
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qobject-receivers"/>
</modify-function>
<modify-function signature="destroyed(QObject*)">
@@ -2420,12 +1707,12 @@
<include file-name="QSize" location="global"/>
</extra-includes>
</object-type>
- <value-type name="QUrlQuery" since="5.0" />
+ <value-type name="QUrlQuery" since="5.0"/>
<value-type name="QUrl" hash-function="PySide::hash">
<!-- Qt5: lots of changes -->
<enum-type name="ComponentFormattingOption" flags="ComponentFormattingOptions,FormattingOptions"/>
<!-- note: above duplication of attribute is not by default XML compliant! -->
- <enum-type name="UrlFormattingOption" />
+ <enum-type name="UrlFormattingOption"/>
<enum-type name="UserInputResolutionOption" flags="UserInputResolutionOptions"/>
<enum-type name="ParsingMode"/>
<extra-includes>
@@ -2434,8 +1721,8 @@
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="repr_code">
- <replace from="%REPR_FORMAT" to="'%s'" />
- <replace from="%REPR_ARGS" to="qPrintable(%CPPSELF.toString())" />
+ <replace from="%REPR_FORMAT" to="'%s'"/>
+ <replace from="%REPR_ARGS" to="qPrintable(%CPPSELF.toString())"/>
</insert-template>
</inject-code>
</add-function>
@@ -2443,8 +1730,8 @@
<add-function signature="__reduce__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="reduce_code">
- <replace from="%REDUCE_FORMAT" to="s" />
- <replace from="%REDUCE_ARGS" to="qPrintable(%CPPSELF.toString())" />
+ <replace from="%REDUCE_FORMAT" to="s"/>
+ <replace from="%REDUCE_ARGS" to="qPrintable(%CPPSELF.toString())"/>
</insert-template>
</inject-code>
</add-function>
@@ -2458,8 +1745,8 @@
<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()" />
+ <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>
@@ -2467,8 +1754,8 @@
<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()" />
+ <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>
@@ -2502,10 +1789,7 @@
# t == "A \\emph{bon mot}."
</inject-documentation>
- <inject-code class="target" position="beginning">
- %1.replace(*%CPPSELF, %2);
- %PYARG_0 = %CONVERTTOPYTHON[QString](%1);
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qregexp-replace"/>
</add-function>
</value-type>
@@ -2525,8 +1809,8 @@
<add-function signature="__reduce__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="reduce_code">
- <replace from="%REDUCE_FORMAT" to="s" />
- <replace from="%REDUCE_ARGS" to="qPrintable(%CPPSELF.filePath())" />
+ <replace from="%REDUCE_FORMAT" to="s"/>
+ <replace from="%REDUCE_ARGS" to="qPrintable(%CPPSELF.filePath())"/>
</insert-template>
</inject-code>
</add-function>
@@ -2535,22 +1819,10 @@
<enum-type name="Base64Option" flags="Base64Options" since="5.2"/>
<conversion-rule>
<target-to-native>
- <add-conversion type="Py_None">
- %out = %OUTTYPE();
- </add-conversion>
- <add-conversion type="PyBytes">
- #ifdef IS_PY3K
- %out = %OUTTYPE(PyBytes_AS_STRING(%in), PyBytes_GET_SIZE(%in));
- #else
- %out = %OUTTYPE(Shiboken::String::toCString(%in), Shiboken::String::len(%in));
- #endif
- </add-conversion>
- <add-conversion type="PyByteArray">
- %out = %OUTTYPE(PyByteArray_AsString(%in), PyByteArray_Size(%in));
- </add-conversion>
- <add-conversion type="PyString" check="Shiboken::String::check(%in) &amp;&amp; !PyUnicode_Check(%in)">
- %out = %OUTTYPE(Shiboken::String::toCString(%in), Shiboken::String::len(%in));
- </add-conversion>
+ <add-conversion type="Py_None" file="../glue/qtcore.cpp" snippet="conversion-pynone"/>
+ <add-conversion type="PyBytes" file="../glue/qtcore.cpp" snippet="conversion-qbytearray-pybytes"/>
+ <add-conversion type="PyByteArray" file="../glue/qtcore.cpp" snippet="conversion-qbytearray-pybytearray"/>
+ <add-conversion type="PyString" check="Shiboken::String::check(%in) &amp;&amp; !PyUnicode_Check(%in)" file="../glue/qtcore.cpp" snippet="conversion-qbytearray-pystring"/>
</target-to-native>
</conversion-rule>
@@ -2559,204 +1831,118 @@
</extra-includes>
<!-- ### 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="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" />
+ <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>
- QByteArray ba = QByteArray(PyBytes_AS_STRING(%PYARG_1), PyBytes_GET_SIZE(%PYARG_1)) + *%CPPSELF;
- %PYARG_0 = %CONVERTTOPYTHON[QByteArray](ba);
- </inject-code>
+ <inject-code file="../glue/qtcore.cpp" snippet="qbytearray-operatorplus-1"/>
</add-function>
<add-function signature="operator+(PyByteArray, QByteArray)" return-type="QByteArray">
- <inject-code>
- QByteArray ba = QByteArray(PyByteArray_AsString(%PYARG_1), PyByteArray_Size(%PYARG_1)) + *%CPPSELF;
- %PYARG_0 = %CONVERTTOPYTHON[QByteArray](ba);
- </inject-code>
+ <inject-code file="../glue/qtcore.cpp" snippet="qbytearray-operatorplus-2"/>
</add-function>
<add-function signature="operator+(PyByteArray)" return-type="QByteArray">
- <inject-code>
- QByteArray ba = *%CPPSELF + QByteArray(PyByteArray_AsString(%PYARG_1), PyByteArray_Size(%PYARG_1));
- %PYARG_0 = %CONVERTTOPYTHON[QByteArray](ba);
- </inject-code>
+ <inject-code file="../glue/qtcore.cpp" snippet="qbytearray-operatorplus-3"/>
</add-function>
<add-function signature="operator+=(PyByteArray)" return-type="QByteArray">
- <inject-code>
- *%CPPSELF += QByteArray(PyByteArray_AsString(%PYARG_1), PyByteArray_Size(%PYARG_1));
- </inject-code>
+ <inject-code file="../glue/qtcore.cpp" snippet="qbytearray-operatorplusequal"/>
</add-function>
<add-function signature="operator==(PyUnicode)">
- <inject-code>
- if (PyUnicode_CheckExact(%PYARG_1)) {
- Shiboken::AutoDecRef data(PyUnicode_AsASCIIString(%PYARG_1));
- QByteArray ba = QByteArray(PyBytes_AsString(data.object()), PyBytes_GET_SIZE(data.object()));
- bool cppResult = %CPPSELF == ba;
- %PYARG_0 = %CONVERTTOPYTHON[bool](cppResult);
- }
- </inject-code>
+ <inject-code file="../glue/qtcore.cpp" snippet="qbytearray-operatorequalequal"/>
</add-function>
<add-function signature="operator!=(PyUnicode)">
- <inject-code>
- if (PyUnicode_CheckExact(%PYARG_1)) {
- Shiboken::AutoDecRef data(PyUnicode_AsASCIIString(%PYARG_1));
- QByteArray ba = QByteArray(PyBytes_AsString(data.object()), PyBytes_GET_SIZE(data.object()));
- bool cppResult = %CPPSELF != ba;
- %PYARG_0 = %CONVERTTOPYTHON[bool](cppResult);
- }
- </inject-code>
+ <inject-code file="../glue/qtcore.cpp" snippet="qbytearray-operatornotequal"/>
</add-function>
<add-function signature="operator&gt;(PyUnicode)">
- <inject-code>
- if (PyUnicode_CheckExact(%PYARG_1)) {
- Shiboken::AutoDecRef data(PyUnicode_AsASCIIString(%PYARG_1));
- QByteArray ba = QByteArray(PyBytes_AsString(data.object()), PyBytes_GET_SIZE(data.object()));
- bool cppResult = %CPPSELF &gt; ba;
- %PYARG_0 = %CONVERTTOPYTHON[bool](cppResult);
- }
- </inject-code>
+ <inject-code file="../glue/qtcore.cpp" snippet="qbytearray-operatorgreater"/>
</add-function>
<add-function signature="operator&gt;=(PyUnicode)">
- <inject-code>
- if (PyUnicode_CheckExact(%PYARG_1)) {
- Shiboken::AutoDecRef data(PyUnicode_AsASCIIString(%PYARG_1));
- QByteArray ba = QByteArray(PyBytes_AsString(data.object()), PyBytes_GET_SIZE(data.object()));
- bool cppResult = %CPPSELF &gt;= ba;
- %PYARG_0 = %CONVERTTOPYTHON[bool](cppResult);
- }
- </inject-code>
+ <inject-code file="../glue/qtcore.cpp" snippet="qbytearray-operatorgreaterequal"/>
</add-function>
<add-function signature="operator&lt;(PyUnicode)">
- <inject-code>
- if (PyUnicode_CheckExact(%PYARG_1)) {
- Shiboken::AutoDecRef data(PyUnicode_AsASCIIString(%PYARG_1));
- QByteArray ba = QByteArray(PyBytes_AsString(data.object()), PyBytes_GET_SIZE(data.object()));
- bool cppResult = %CPPSELF &lt; ba;
- %PYARG_0 = %CONVERTTOPYTHON[bool](cppResult);
- }
- </inject-code>
+ <inject-code file="../glue/qtcore.cpp" snippet="qbytearray-operatorlower"/>
</add-function>
<add-function signature="operator&lt;=(PyUnicode)">
- <inject-code>
- if (PyUnicode_CheckExact(%PYARG_1)) {
- Shiboken::AutoDecRef data(PyUnicode_AsASCIIString(%PYARG_1));
- QByteArray ba = QByteArray(PyBytes_AsString(data.object()), PyBytes_GET_SIZE(data.object()));
- bool cppResult = %CPPSELF &lt;= ba;
- %PYARG_0 = %CONVERTTOPYTHON[bool](cppResult);
- }
- </inject-code>
+ <inject-code file="../glue/qtcore.cpp" snippet="qbytearray-operatorlowerequal"/>
</add-function>
<!-- ### -->
<add-function signature="__repr__" return-type="PyObject*">
- <inject-code class="target" position="beginning">
- PyObject *aux = PyBytes_FromStringAndSize(%CPPSELF.constData(), %CPPSELF.size());
- if (aux == NULL) {
- return NULL;
- }
- QByteArray b(Py_TYPE(%PYSELF)->tp_name);
- #ifdef IS_PY3K
- %PYARG_0 = PyUnicode_FromFormat("%s(%R)", b.constData(), aux);
- #else
- aux = PyObject_Repr(aux);
- b += "(";
- b += QByteArray(PyBytes_AS_STRING(aux), PyBytes_GET_SIZE(aux));
- b += ")";
- %PYARG_0 = Shiboken::String::fromStringAndSize(b.constData(), b.size());
- #endif
- Py_DECREF(aux);
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qbytearray-repr"/>
</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="N" />
- <replace from="%REDUCE_ARGS" to="PyBytes_FromStringAndSize(%CPPSELF.constData(), %CPPSELF.size())" />
+ <replace from="%REDUCE_FORMAT" to="N"/>
+ <replace from="%REDUCE_ARGS" to="PyBytes_FromStringAndSize(%CPPSELF.constData(), %CPPSELF.size())"/>
</insert-template>
</inject-code>
</add-function>
<modify-function signature="QByteArray(const char*,int)">
<!-- Keep \x00 bytes passed in python strings -->
- <inject-code class="target" position="beginning">
- if (PyBytes_Check(%PYARG_1)) {
- %0 = new QByteArray(PyBytes_AsString(%PYARG_1), PyBytes_GET_SIZE(%PYARG_1));
- } else if (Shiboken::String::check(%PYARG_1)) {
- %0 = new QByteArray(Shiboken::String::toCString(%PYARG_1), Shiboken::String::len(%PYARG_1));
- }
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qbytearray-1"/>
</modify-function>
- <add-function signature="QByteArray(PyByteArray)" allow-thread="yes">>
- <inject-code class="target" position="beginning">
- %0 = new QByteArray(PyByteArray_AsString(%PYARG_1), PyByteArray_Size(%PYARG_1));
- </inject-code>
+ <add-function signature="QByteArray(PyByteArray)">
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qbytearray-2"/>
</add-function>
- <add-function signature="QByteArray(PyBytes)" allow-thread="yes">
- <inject-code class="target" position="beginning">
- %0 = new QByteArray(PyBytes_AS_STRING(%PYARG_1), PyBytes_GET_SIZE(%PYARG_1));
- </inject-code>
+ <add-function signature="QByteArray(PyBytes)">
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qbytearray-3"/>
</add-function>
<!-- buffer protocol -->
- <inject-code class="native" position="beginning" file="glue/qbytearray_bufferprotocol.cpp" />
- <inject-code class="target" position="end">
- #if PY_VERSION_HEX &lt; 0x03000000
- Shiboken::SbkType&lt;QByteArray>()->tp_as_buffer = &amp;SbkQByteArrayBufferProc;
- Shiboken::SbkType&lt;QByteArray>()->tp_flags |= Py_TPFLAGS_HAVE_GETCHARBUFFER;
- #endif
- </inject-code>
+ <inject-code class="native" position="beginning" file="../glue/qtcore.cpp" snippet="qbytearray-bufferprotocol"/>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="qbytearray-py3"/>
<modify-function signature="data()">
- <inject-code class="target" position="beginning">
- %PYARG_0 = PyBytes_FromStringAndSize(%CPPSELF.%FUNCTION_NAME(), %CPPSELF.size());
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qbytearray-data"/>
</modify-function>
<!-- removed functions -->
@@ -2775,12 +1961,12 @@
<modify-function signature="number(qulonglong,int)" remove="all"/>
<modify-function signature="operator+=(const char*)" remove="all"/>
<modify-function signature="operator+(char,QByteArray)" remove="all"/>
- <modify-function signature="operator==(const char*,QByteArray)" remove="all" />
- <modify-function signature="operator!=(const char*,QByteArray)" remove="all" />
- <modify-function signature="operator&lt;(const char*,QByteArray)" remove="all" />
- <modify-function signature="operator&lt;=(const char*,QByteArray)" remove="all" />
- <modify-function signature="operator>(const char*,QByteArray)" remove="all" />
- <modify-function signature="operator>=(const char*,QByteArray)" remove="all" />
+ <modify-function signature="operator==(const char*,QByteArray)" remove="all"/>
+ <modify-function signature="operator!=(const char*,QByteArray)" remove="all"/>
+ <modify-function signature="operator&lt;(const char*,QByteArray)" remove="all"/>
+ <modify-function signature="operator&lt;=(const char*,QByteArray)" remove="all"/>
+ <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. -->
@@ -2877,10 +2063,7 @@
<modify-argument index="2">
<remove-argument />
</modify-argument>
- <inject-code class="target">
- %RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(PyBytes_AsString(%PYARG_1), PyBytes_GET_SIZE(%PYARG_1));
- %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0);
- </inject-code>
+ <inject-code class="target" file="../glue/qtcore.cpp" snippet="qbytearray-fromrawdata"/>
</modify-function>
<modify-function signature="toDouble(bool*)const">
<modify-argument index="1">
@@ -2899,52 +2082,22 @@
</inject-code>
</modify-function>
<add-function signature="__str__" return-type="PyObject*">
- <inject-code class="target" position="beginning">
- PyObject *aux = PyBytes_FromStringAndSize(%CPPSELF.constData(), %CPPSELF.size());
- if (aux == NULL) {
- return NULL;
- }
- #ifdef IS_PY3K
- %PYARG_0 = PyObject_Repr(aux);
- Py_DECREF(aux);
- #else
- %PYARG_0 = aux;
- #endif
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qbytearray-str"/>
</add-function>
<add-function signature="__len__">
- <inject-code class="target" position="beginning">
- return %CPPSELF.count();
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qbytearray-len"/>
</add-function>
<add-function signature="__getitem__">
- <inject-code class="target" position="beginning">
- if (_i &lt; 0 || _i >= %CPPSELF.size()) {
- PyErr_SetString(PyExc_IndexError, "index out of bounds");
- return 0;
- } else {
- char res[2];
- res[0] = %CPPSELF.at(_i);
- res[1] = 0;
- return PyBytes_FromStringAndSize(res, 1);
- }
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qbytearray-getitem"/>
</add-function>
<add-function signature="__mgetitem__">
- <inject-code class="target" position="beginning" file="glue/qbytearray_mgetitem.cpp" />
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qbytearray-mgetitem"/>
</add-function>
<add-function signature="__setitem__">
- <inject-code class="target" position="beginning">
- %CPPSELF.remove(_i, 1);
- PyObject *args = Py_BuildValue("(nO)", _i, _value);
- PyObject *result = Sbk_QByteArrayFunc_insert(self, args);
- Py_DECREF(args);
- Py_XDECREF(result);
- return !result ? -1 : 0;
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qbytearray-setitem"/>
</add-function>
<add-function signature="__msetitem__">
- <inject-code class="target" position="beginning" file="glue/qbytearray_msetitem.cpp" />
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qbytearray-msetitem"/>
</add-function>
</value-type>
<value-type name="QTextBoundaryFinder">
@@ -2956,12 +2109,32 @@
<object-type name="QXmlStreamEntityResolver"/>
<!-- 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-argument index="3">
+ <remove-argument/>
+ <conversion-rule class="native">
+ <insert-template name="return_native_eventfilter_conversion_variables"/>
+ </conversion-rule>
+ </modify-argument>
+ <modify-argument index="return">
+ <replace-type modified-type="PyObject"/>
+ <conversion-rule class="native">
+ <insert-template name="return_native_eventfilter_conversion"/>
+ </conversion-rule>
+ </modify-argument>
+ <inject-code position="end">
+ <insert-template name="return_native_eventfilter"/>
+ </inject-code>
+ </modify-function>
+ </object-type>
<object-type name="QEventLoop">
<enum-type name="ProcessEventsFlag" flags="ProcessEventsFlags"/>
- <modify-function signature="exec(QFlags&lt;QEventLoop::ProcessEventsFlag>)" rename="exec_" allow-thread="yes" />
- <modify-function signature="processEvents(QFlags&lt;QEventLoop::ProcessEventsFlag>)" allow-thread="yes" />
- <modify-function signature="processEvents(QFlags&lt;QEventLoop::ProcessEventsFlag>,int)" allow-thread="yes" />
+ <modify-function signature="exec(QFlags&lt;QEventLoop::ProcessEventsFlag>)" rename="exec_" allow-thread="yes"/>
+ <modify-function signature="processEvents(QFlags&lt;QEventLoop::ProcessEventsFlag>)" allow-thread="yes"/>
+ <modify-function signature="processEvents(QFlags&lt;QEventLoop::ProcessEventsFlag>,int)" allow-thread="yes"/>
</object-type>
<object-type name="QFileDevice" since="5.0">
<enum-type name="FileError"/>
@@ -2976,19 +2149,13 @@
<modify-argument index="1">
<replace-type modified-type="PyBuffer"/>
</modify-argument>
- <inject-code>
- uchar *ptr = reinterpret_cast&lt;uchar*&gt;(Shiboken::Buffer::getPointer(%PYARG_1));
- %RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(ptr);
- %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0);
- </inject-code>
+ <inject-code file="../glue/qtcore.cpp" snippet="qfiledevice-unmap"/>
</modify-function>
<modify-function signature="map(qint64,qint64,QFileDevice::MemoryMapFlags)">
<modify-argument index="return">
<replace-type modified-type="PyObject"/>
</modify-argument>
- <inject-code>
- %PYARG_0 = Shiboken::Buffer::newObject(%CPPSELF.%FUNCTION_NAME(%1, %2, %3), %2, Shiboken::Buffer::ReadWrite);
- </inject-code>
+ <inject-code file="../glue/qtcore.cpp" snippet="qfiledevice-map"/>
</modify-function>
<modify-function signature="flush()" allow-thread="yes"/>
</object-type>
@@ -3003,7 +2170,7 @@
<modify-function signature="rename(const QString&amp;,const QString&amp;)" allow-thread="yes"/>
</object-type>
<object-type name="QSaveFile"/>
- <object-type name="QFileSelector" />
+ <object-type name="QFileSelector"/>
<object-type name="QIODevice">
<enum-type name="OpenModeFlag" flags="OpenMode"/>
@@ -3030,54 +2197,28 @@
<remove-default-expression />
</modify-argument>
<inject-code class="target" position="beginning">
- <insert-template name="fix_char*" />
+ <insert-template name="fix_char*"/>
</inject-code>
</modify-function>
<modify-function signature="readData(char*,qint64)">
- <inject-code class="target">
- QByteArray ba(1 + int(%2), char(0));
- %CPPSELF.%FUNCTION_NAME(ba.data(), int(%2));
- %PYARG_0 = Shiboken::String::fromCString(ba.constData());
- </inject-code>
+ <inject-code class="target" file="../glue/qtcore.cpp" snippet="qiodevice-readData"/>
<modify-argument index="1">
<remove-argument />
</modify-argument>
<modify-argument index="return">
<replace-type modified-type="PyObject"/>
- <conversion-rule class="native">
- %RETURN_TYPE %out = 0;
- if (PyBytes_Check(%PYARG_0)) {
- %out = PyBytes_GET_SIZE((PyObject*)%PYARG_0);
- memcpy(%1, PyBytes_AS_STRING((PyObject*)%PYARG_0), %out);
- } else if (Shiboken::String::check(%PYARG_0)) {
- %out = Shiboken::String::len((PyObject*)%PYARG_0);
- memcpy(%1, Shiboken::String::toCString((PyObject*)%PYARG_0), %out);
- }
- </conversion-rule>
</modify-argument>
+ <inject-code class="native" position="end" file="../glue/qtcore.cpp" snippet="return-readData"/>
</modify-function>
<modify-function signature="readLineData(char*,qint64)">
- <inject-code class="target">
- QByteArray ba(1 + int(%2), char(0));
- %CPPSELF.%FUNCTION_NAME(ba.data(), int(%2));
- %PYARG_0 = Shiboken::String::fromCString(ba.constData());
- </inject-code>
+ <inject-code class="target" file="../glue/qtcore.cpp" snippet="qiodevice-readData"/>
<modify-argument index="1">
<remove-argument />
</modify-argument>
<modify-argument index="return">
<replace-type modified-type="PyObject"/>
- <conversion-rule class="native">
- %RETURN_TYPE %out = 0;
- if (PyBytes_Check(%PYARG_0)) {
- %out = PyBytes_GET_SIZE((PyObject*)%PYARG_0);
- memcpy(%1, PyBytes_AS_STRING((PyObject*)%PYARG_0), %out);
- } else if (Shiboken::String::check(%PYARG_0)) {
- %out = Shiboken::String::len((PyObject*)%PYARG_0);
- memcpy(%1, Shiboken::String::toCString((PyObject*)%PYARG_0), %out);
- }
- </conversion-rule>
</modify-argument>
+ <inject-code class="native" position="end" file="../glue/qtcore.cpp" snippet="return-readData"/>
</modify-function>
</object-type>
<object-type name="QCryptographicHash">
@@ -3086,9 +2227,7 @@
<modify-argument index="2">
<remove-argument />
</modify-argument>
- <inject-code>
- %CPPSELF.%FUNCTION_NAME(Shiboken::String::toCString(%PYARG_1), Shiboken::String::len(%PYARG_1));
- </inject-code>
+ <inject-code file="../glue/qtcore.cpp" snippet="qcryptographichash-adddata"/>
</modify-function>
</object-type>
<value-type name="QOperatingSystemVersion" since="5.9">
@@ -3109,11 +2248,9 @@
<reference-count action="set"/>
</modify-argument>
</modify-function>
- <add-function signature="__enter__()" />
+ <add-function signature="__enter__()"/>
<add-function signature="__exit__(PyObject*,PyObject*,PyObject*)">
- <inject-code>
- %CPPSELF.unlock();
- </inject-code>
+ <inject-code file="../glue/qtcore.cpp" snippet="unlock"/>
</add-function>
</object-type>
@@ -3129,7 +2266,7 @@
<modify-function signature="tryLock(int)" allow-thread="yes"/>
</object-type>
<object-type name="QRandomGenerator" since="5.10">
- <modify-function signature="global()" rename="global_" allow-thread="yes" />
+ <modify-function signature="global()" rename="global_" allow-thread="yes"/>
<modify-function signature="operator()()" remove="all"/>
</object-type>
<object-type name="QRandomGenerator64" since="5.10">
@@ -3145,25 +2282,10 @@
<enum-type name="Type"/>
<add-function signature="QSocketNotifier(PyObject*, QSocketNotifier::Type, QObject*)">
<modify-argument index="3">
- <replace-default-expression with="0" />
- <rename to="parent" />
+ <replace-default-expression with="0"/>
+ <rename to="parent"/>
</modify-argument>
- <inject-code>
- Shiboken::AutoDecRef socket(%PYARG_1);
- if (!socket.isNull()) {
- // We use qintptr as PyLong, but we check for int
- // since it is currently an alias to be Python2 compatible.
- // Internally, ints are qlonglongs.
- if (%CHECKTYPE[int](socket)) {
- int cppSocket = %CONVERTTOCPP[int](socket);
- qintptr socket = (qintptr)cppSocket;
- %0 = new %TYPE(socket, %2, %3);
- } else {
- PyErr_SetString(PyExc_TypeError,
- "QSocketNotifier: first argument (socket) must be an int.");
- }
- }
- </inject-code>
+ <inject-code file="../glue/qtcore.cpp" snippet="qsocketnotifier"/>
</add-function>
</object-type>
@@ -3198,19 +2320,19 @@
</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" />
+ <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" />
+ <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" />
+ <modify-function signature="fromUnicode(const QChar*,int)" remove="all"/>
</object-type>
<object-type name="QTimeLine">
<enum-type name="CurveShape"/>
@@ -3220,17 +2342,12 @@
<object-type name="QTranslator">
<modify-function signature="load(const uchar*,int,QString)">
<modify-argument index="1">
- <replace-type modified-type="PyBuffer" />
+ <replace-type modified-type="PyBuffer"/>
</modify-argument>
<modify-argument index="2">
<remove-argument />
</modify-argument>
- <inject-code>
- Py_ssize_t size;
- uchar *ptr = reinterpret_cast&lt;uchar*&gt;(Shiboken::Buffer::getPointer(%PYARG_1, &amp;size));
- %RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(const_cast&lt;const uchar*&gt;(ptr), size);
- %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0);
- </inject-code>
+ <inject-code file="../glue/qtcore.cpp" snippet="qtranslator-load"/>
</modify-function>
</object-type>
<object-type name="QWaitCondition">
@@ -3250,67 +2367,10 @@
</object-type>
<object-type name="QTimer">
<modify-function signature="singleShot(int,const QObject*,const char*)">
- <inject-code class="target" position="beginning">
- // %FUNCTION_NAME() - disable generation of c++ function call
- (void) %2; // remove warning about unused variable
- Shiboken::AutoDecRef emptyTuple(PyTuple_New(0));
- PyObject *pyTimer = reinterpret_cast&lt;PyTypeObject *&gt;(Shiboken::SbkType&lt;QTimer&gt;())->tp_new(Shiboken::SbkType&lt;QTimer&gt;(), emptyTuple, 0);
- reinterpret_cast&lt;PyTypeObject *&gt;(Shiboken::SbkType&lt;QTimer&gt;())->tp_init(pyTimer, emptyTuple, 0);
-
- QTimer* timer = %CONVERTTOCPP[QTimer*](pyTimer);
- Shiboken::AutoDecRef result(
- PyObject_CallMethod(pyTimer,
- const_cast&lt;char*&gt;("connect"),
- const_cast&lt;char*&gt;("OsOs"),
- pyTimer,
- SIGNAL(timeout()),
- %PYARG_2,
- %3)
- );
- Shiboken::Object::releaseOwnership((SbkObject*)pyTimer);
- Py_XDECREF(pyTimer);
- timer->setSingleShot(true);
- timer->connect(timer, SIGNAL(timeout()), timer, SLOT(deleteLater()));
- timer->start(%1);
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qtimer-singleshot-1"/>
</modify-function>
<add-function signature="singleShot(int,PyCallable*)" static="yes">
- <inject-code class="target" position="beginning">
- // %FUNCTION_NAME() - disable generation of c++ function call
- Shiboken::AutoDecRef emptyTuple(PyTuple_New(0));
- PyObject *pyTimer = reinterpret_cast&lt;PyTypeObject *&gt;(Shiboken::SbkType&lt;QTimer&gt;())->tp_new(Shiboken::SbkType&lt;QTimer&gt;(), emptyTuple, 0);
- reinterpret_cast&lt;PyTypeObject *&gt;(Shiboken::SbkType&lt;QTimer&gt;())->tp_init(pyTimer, emptyTuple, 0);
- QTimer* timer = %CONVERTTOCPP[QTimer*](pyTimer);
- timer->setSingleShot(true);
-
- if (PyObject_TypeCheck(%2, PySideSignalInstanceTypeF())) {
- PySideSignalInstance *signalInstance = reinterpret_cast&lt;PySideSignalInstance*&gt;(%2);
- Shiboken::AutoDecRef signalSignature(Shiboken::String::fromFormat("2%s", PySide::Signal::getSignature(signalInstance)));
- Shiboken::AutoDecRef result(
- PyObject_CallMethod(pyTimer,
- const_cast&lt;char*&gt;("connect"),
- const_cast&lt;char*&gt;("OsOO"),
- pyTimer,
- SIGNAL(timeout()),
- PySide::Signal::getObject(signalInstance),
- signalSignature.object())
- );
- } else {
- Shiboken::AutoDecRef result(
- PyObject_CallMethod(pyTimer,
- const_cast&lt;char*&gt;("connect"),
- const_cast&lt;char*&gt;("OsO"),
- pyTimer,
- SIGNAL(timeout()),
- %PYARG_2)
- );
- }
-
- timer->connect(timer, SIGNAL(timeout()), timer, SLOT(deleteLater()), Qt::DirectConnection);
- Shiboken::Object::releaseOwnership((SbkObject*)pyTimer);
- Py_XDECREF(pyTimer);
- timer->start(%1);
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qtimer-singleshot-2"/>
</add-function>
</object-type>
<object-type name="QProcess">
@@ -3335,37 +2395,22 @@
<modify-argument index="return">
<replace-type modified-type="(retval, pid)"/>
</modify-argument>
- <inject-code class="target" position="beginning">
- qint64 pid;
- %RETURN_TYPE retval = %TYPE::%FUNCTION_NAME(%1, %2, %3, &amp;pid);
- %PYARG_0 = PyTuple_New(2);
- PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](retval));
- PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[qint64](pid));
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qprocess-startdetached"/>
</modify-function>
<!-- Function removed because on windows it returns a win32 specific structure -->
- <modify-function signature="pid()const" remove="all" />
+ <modify-function signature="pid()const" remove="all"/>
<add-function signature="pid()" return-type="long">
- <inject-code>
- long result;
- #ifdef WIN32
- _PROCESS_INFORMATION *procInfo = %CPPSELF.%FUNCTION_NAME();
- result = procInfo ? procInfo->dwProcessId : 0;
- #else
- result = %CPPSELF.%FUNCTION_NAME();
- #endif
- %PYARG_0 = %CONVERTTOPYTHON[long](result);
- </inject-code>
+ <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" />
+ <object-type name="QSignalMapper"/>
- <object-type name="QCollatorSortKey" since="5.2" />
- <object-type name="QCollator" since="5.2" />
+ <object-type name="QCollatorSortKey" since="5.2"/>
+ <object-type name="QCollator" since="5.2"/>
<object-type name="QCommandLineOption" since="5.2">
<enum-type name="Flag" flags="Flags" since="5.8"/>
@@ -3376,7 +2421,7 @@
</object-type>
<object-type name="QCoreApplication">
- <!--Qt5: gone <enum-type name="Encoding" /> -->
+ <!--Qt5: gone <enum-type name="Encoding"/> -->
<enum-type identified-by-value="ApplicationFlags" since="4.8" revision="4800"/>
<extra-includes>
<include file-name="QStringList" location="global"/>
@@ -3395,17 +2440,10 @@
method.
</inject-documentation>
<add-function signature="QCoreApplication(QStringList)">
- <inject-code>
- QCoreApplicationConstructor(%PYSELF, args, &amp;%0);
- </inject-code>
+ <inject-code file="../glue/qtcore.cpp" snippet="qcoreapplication-1"/>
</add-function>
<add-function signature="QCoreApplication()">
- <inject-code>
- PyObject *empty = PyTuple_New(2);
- if (!PyTuple_SetItem(empty, 0, PyList_New(0))) {
- QCoreApplicationConstructor(%PYSELF, empty, &amp;%0);
- }
- </inject-code>
+ <inject-code file="../glue/qtcore.cpp" snippet="qcoreapplication-2"/>
</add-function>
<!-- blocking functions -->
<modify-function signature="processEvents(QFlags&lt;QEventLoop::ProcessEventsFlag&gt;,int)" allow-thread="yes"/>
@@ -3414,22 +2452,7 @@
<modify-function signature="sendEvent(QObject*,QEvent*)" allow-thread="yes"/>
<modify-function signature="sendPostedEvents(QObject*,int)" allow-thread="yes"/>
<modify-function signature="instance()">
- <inject-code class="target">
- QCoreApplication *app = QCoreApplication::instance();
- PyObject *pyApp = Py_None;
- if (app) {
- pyApp = reinterpret_cast&lt;PyObject*&gt;(
- Shiboken::BindingManager::instance().retrieveWrapper(app));
- if (!pyApp)
- pyApp = %CONVERTTOPYTHON[QCoreApplication*](app);
- // this will keep app live after python exit (extra ref)
- }
- // PYSIDE-571: make sure that we return the singleton "None"
- if (pyApp == Py_None)
- Py_DECREF(MakeSingletonQAppWrapper(0)); // here qApp and instance() diverge
- %PYARG_0 = pyApp;
- Py_XINCREF(%PYARG_0);
- </inject-code>
+ <inject-code class="target" file="../glue/qtcore.cpp" snippet="qcoreapplication-instance"/>
</modify-function>
<modify-function signature="exec()" rename="exec_" allow-thread="yes"/>
@@ -3437,37 +2460,12 @@
<modify-argument index="2" invalidate-after-use="yes"/>
</modify-function>
<modify-function signature="QCoreApplication(int &amp;,char **,int)" access="private"/>
- <inject-code class="native" file="glue/qcoreapplication_init.cpp" position="beginning" />
+ <inject-code class="native" position="beginning" file="../glue/qtcore.cpp" snippet="qcoreapplication-init"/>
<modify-function signature="postEvent(QObject*,QEvent*,int)">
<modify-argument index="2">
<define-ownership owner="c++"/>
</modify-argument>
</modify-function>
- <modify-function signature="winEventFilter(MSG*,long*)">
- <modify-argument index="2">
- <remove-argument />
- <conversion-rule class="native">
- long *%out = new long;
- %out = 0;
- </conversion-rule>
- </modify-argument>
- <modify-argument index="return">
- <replace-type modified-type="PyObject"/>
- <conversion-rule class="native">
- %RETURN_TYPE %out = false;
- if (PySequence_Check(%PYARG_0) &amp;&amp; (PySequence_Size(%PYARG_0) == 2)) {
- Shiboken::AutoDecRef pyResult(PySequence_GetItem(%PYARG_0, 0));
- %out = %CONVERTTOCPP[bool](pyResult);
- }
- </conversion-rule>
- </modify-argument>
- <inject-code position="end">
- %PYARG_0 = PyTuple_New(2);
- PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](%0));
- PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[long](*result_out));
- delete result_out;
- </inject-code>
- </modify-function>
</object-type>
<object-type name="QSettings">
<enum-type name="Format"/>
@@ -3492,28 +2490,18 @@
</modify-function>
</object-type>
<object-type name="QEvent" polymorphic-id-expression="%1-&gt;type() == QEvent::None">
- <enum-type name="Type" extensible="yes" />
+ <enum-type name="Type"/>
</object-type>
<object-type name="QChildEvent" polymorphic-id-expression="%1-&gt;type() == QEvent::ChildAdded || %1-&gt;type() == QEvent::ChildPolished || %1-&gt;type() == QEvent::ChildRemoved">
- <modify-field name="c" read="false" write="false"/>
<modify-function signature="child()const">
<modify-argument index="return">
<define-ownership class="target" owner="default"/>
</modify-argument>
</modify-function>
</object-type>
- <object-type name="QTimerEvent" polymorphic-id-expression="%1-&gt;type() == QEvent::Timer" />
- <object-type name="QDynamicPropertyChangeEvent" polymorphic-id-expression="%1-&gt;type() == QEvent::DynamicPropertyChange" />
+ <object-type name="QTimerEvent" polymorphic-id-expression="%1-&gt;type() == QEvent::Timer"/>
+ <object-type name="QDynamicPropertyChangeEvent" polymorphic-id-expression="%1-&gt;type() == QEvent::DynamicPropertyChange"/>
- <template name="stream_read_method">
- %RETURN_TYPE _cpp_result;
- (*%CPPSELF) &gt;&gt; _cpp_result;
- %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](_cpp_result);
- </template>
-
- <template name="stream_write_method">
- (*%CPPSELF) &lt;&lt; %1;
- </template>
<object-type name="QDataStream" stream="yes">
<enum-type name="FloatingPointPrecision" since="4.6"/>
@@ -3560,202 +2548,123 @@
<modify-function signature="operator&lt;&lt;(const char*)" remove="all"/>
<!-- ### -->
<add-function signature="operator&lt;&lt;(const QString&amp;)">
- <inject-code class="target" position="end">
- <insert-template name="stream_write_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-write-method"/>
</add-function>
<add-function signature="writeQString(const QString&amp;)">
- <inject-code class="target" position="end">
- <insert-template name="stream_write_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-write-method"/>
</add-function>
<add-function signature="readQString()" return-type="QString">
- <inject-code class="target" position="end">
- <insert-template name="stream_read_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-read-method"/>
</add-function>
<add-function signature="writeQChar(const QChar&amp;)">
- <inject-code class="target" position="end">
- <insert-template name="stream_write_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-write-method"/>
</add-function>
<add-function signature="readQChar()" return-type="QChar">
- <inject-code class="target" position="end">
- <insert-template name="stream_read_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-read-method"/>
</add-function>
<add-function signature="writeQStringList(const QStringList&amp;)">
- <inject-code class="target" position="end">
- <insert-template name="stream_write_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-write-method"/>
</add-function>
<add-function signature="readQStringList()" return-type="QStringList">
- <inject-code class="target" position="end">
- <insert-template name="stream_read_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-read-method"/>
</add-function>
<add-function signature="writeQVariant(const QVariant&amp;)">
- <inject-code class="target" position="end">
- <insert-template name="stream_write_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-write-method"/>
</add-function>
<add-function signature="readQVariant()" return-type="QVariant">
- <inject-code class="target" position="end">
- <insert-template name="stream_read_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-read-method"/>
</add-function>
<modify-function signature="readRawData(char*,int)">
<modify-argument index="1">
<remove-argument />
</modify-argument>
- <inject-code class="target">
- QByteArray data;
- data.resize(%2);
- int result = %CPPSELF.%FUNCTION_NAME(data.data(), data.size());
- if (result == -1) {
- Py_INCREF(Py_None);
- %PYARG_0 = Py_None;
- } else {
- %PYARG_0 = PyBytes_FromStringAndSize(data.data(), result);
- }
- </inject-code>
+ <inject-code class="target" file="../glue/qtcore.cpp" snippet="qdatastream-readrawdata"/>
</modify-function>
<modify-function signature="writeRawData(const char*,int)">
<modify-argument index="2">
<remove-argument />
</modify-argument>
- <inject-code class="target">
- int r = %CPPSELF.%FUNCTION_NAME(%1, Shiboken::String::len(%PYARG_1));
- %PYARG_0 = %CONVERTTOPYTHON[int](r);
- </inject-code>
+ <inject-code class="target" file="../glue/qtcore.cpp" snippet="qdatastream-writerawdata"/>
</modify-function>
<!-- Extra functions for primitive type handling -->
<add-function signature="readBool()" return-type="bool">
- <inject-code class="target" position="end">
- <insert-template name="stream_read_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-read-method"/>
</add-function>
<add-function signature="readInt8()" return-type="qint8">
- <inject-code class="target" position="end">
- <insert-template name="stream_read_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-read-method"/>
</add-function>
<add-function signature="readUInt8()" return-type="quint8">
- <inject-code class="target" position="end">
- <insert-template name="stream_read_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-read-method"/>
</add-function>
<add-function signature="readUInt16()" return-type="quint16">
- <inject-code class="target" position="end">
- <insert-template name="stream_read_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-read-method"/>
</add-function>
<add-function signature="readInt16()" return-type="qint16">
- <inject-code class="target" position="end">
- <insert-template name="stream_read_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-read-method"/>
</add-function>
<add-function signature="readInt32()" return-type="qint32">
- <inject-code class="target" position="end">
- <insert-template name="stream_read_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-read-method"/>
</add-function>
<add-function signature="readUInt32()" return-type="quint32">
- <inject-code class="target" position="end">
- <insert-template name="stream_read_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-read-method"/>
</add-function>
<add-function signature="readInt64()" return-type="qint64">
- <inject-code class="target" position="end">
- <insert-template name="stream_read_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-read-method"/>
</add-function>
<add-function signature="readUInt64()" return-type="quint64">
- <inject-code class="target" position="end">
- <insert-template name="stream_read_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-read-method"/>
</add-function>
<add-function signature="readFloat()" return-type="float">
- <inject-code class="target" position="end">
- <insert-template name="stream_read_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-read-method"/>
</add-function>
<add-function signature="readDouble()" return-type="qreal">
- <inject-code class="target" position="end">
- <insert-template name="stream_read_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-read-method"/>
</add-function>
<add-function signature="readString()" return-type="QString">
- <inject-code class="target" position="end">
- <insert-template name="stream_read_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-read-method"/>
</add-function>
<add-function signature="writeBool(bool)">
- <inject-code class="target" position="end">
- <insert-template name="stream_write_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-write-method"/>
</add-function>
<add-function signature="writeInt8(qint8)">
- <inject-code class="target" position="end">
- <insert-template name="stream_write_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-write-method"/>
</add-function>
<add-function signature="writeUInt8(quint8)">
- <inject-code class="target" position="end">
- <insert-template name="stream_write_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-write-method"/>
</add-function>
<add-function signature="writeUInt16(quint16)">
- <inject-code class="target" position="end">
- <insert-template name="stream_write_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-write-method"/>
</add-function>
<add-function signature="writeInt16(qint16)">
- <inject-code class="target" position="end">
- <insert-template name="stream_write_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-write-method"/>
</add-function>
<add-function signature="writeInt32(qint32)">
- <inject-code class="target" position="end">
- <insert-template name="stream_write_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-write-method"/>
</add-function>
<add-function signature="writeUInt32(quint32)">
- <inject-code class="target" position="end">
- <insert-template name="stream_write_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-write-method"/>
</add-function>
<add-function signature="writeInt64(qint64)">
- <inject-code class="target" position="end">
- <insert-template name="stream_write_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-write-method"/>
</add-function>
<add-function signature="writeUInt64(quint64)">
- <inject-code class="target" position="end">
- <insert-template name="stream_write_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-write-method"/>
</add-function>
<add-function signature="writeFloat(float)">
- <inject-code class="target" position="end">
- <insert-template name="stream_write_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-write-method"/>
</add-function>
<add-function signature="writeDouble(qreal)">
- <inject-code class="target" position="end">
- <insert-template name="stream_write_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-write-method"/>
</add-function>
<add-function signature="writeString(QString)">
- <inject-code class="target" position="end">
- <insert-template name="stream_write_method"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="stream-write-method"/>
</add-function>
<!-- ### deprecated method -->
<modify-function signature="readBytes(char*&amp;,uint&amp;)" remove="all"/>
- <modify-function signature="writeBytes(const char*,uint)" remove="all" />
+ <modify-function signature="writeBytes(const char*,uint)" remove="all"/>
</object-type>
<value-type name="QTextStreamManipulator" default-constructor="QTextStreamManipulator(0, 0)">
@@ -3804,13 +2713,7 @@
<modify-function signature="operator&gt;&gt;(QString&amp;)" remove="all"/>
<modify-function signature="string()const">
- <modify-argument index="return">
- <!--<replace-type modified-type="QString" />-->
- <conversion-rule class="target">
- QString &amp;res = *%0;
- %PYARG_0 = %CONVERTTOPYTHON[QString](res);
- </conversion-rule>
- </modify-argument>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="return-qstring-ref"/>
</modify-function>
<modify-function signature="flush()" allow-thread="yes"/>
@@ -3830,19 +2733,17 @@
<object-type name="QThreadPool">
<modify-function signature="start(QRunnable*,int)">
<modify-argument index="1">
- <parent index="this" action="add" />
+ <parent index="this" action="add"/>
</modify-argument>
</modify-function>
<modify-function signature="tryStart(QRunnable*)">
<modify-argument index="1">
- <parent index="this" action="add" />
+ <parent index="this" action="add"/>
</modify-argument>
</modify-function>
<modify-function signature="globalInstance()" >
- <inject-code position="end">
- Shiboken::Object::releaseOwnership(%PYARG_0);
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="releaseownership"/>
</modify-function>
</object-type>
<value-type name="QXmlStreamAttribute"/>
@@ -3853,7 +2754,7 @@
<modify-function signature="pop_front()" remove="all"/>
<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" />
+ <modify-function signature="operator+=(QVector&lt;QXmlStreamAttribute&gt;)" remove="all"/>
</value-type>
<value-type name="QXmlStreamNamespaceDeclaration"/>
<value-type name="QXmlStreamNotationDeclaration"/>
@@ -3865,7 +2766,7 @@
</object-type>
<object-type name="QXmlStreamWriter">
<!-- Removed because it expect QString to be mutable -->
- <modify-function signature="QXmlStreamWriter(QString*)" remove="all" />
+ <modify-function signature="QXmlStreamWriter(QString*)" remove="all"/>
<modify-function signature="codec()const">
<modify-argument index="return">
<define-ownership class="target" owner="default"/>
@@ -3873,11 +2774,6 @@
</modify-function>
</object-type>
<value-type name="QModelIndex" hash-function="qHash">
- <modify-function signature="internalPointer()const">
- <inject-code class="target" position="beginning">
- <insert-template name="return_internal_pointer" />
- </inject-code>
- </modify-function>
<modify-function signature="model()const">
<modify-argument index="return">
<define-ownership class="target" owner="default"/>
@@ -3886,40 +2782,40 @@
</value-type>
<value-type name="QGenericArgument">
- <include file-name="qobjectdefs.h" location="global" />
+ <include file-name="qobjectdefs.h" location="global"/>
</value-type>
<value-type name="QGenericReturnArgument">
- <include file-name="qobjectdefs.h" location="global" />
+ <include file-name="qobjectdefs.h" location="global"/>
</value-type>
<object-type name="QMessageLogContext">
- <modify-function signature="copy(const QMessageLogContext &amp;)" remove="all" />
+ <modify-function signature="copy(const QMessageLogContext &amp;)" remove="all"/>
</object-type>
<value-type name="QMetaMethod">
<enum-type name="Access"/>
<enum-type name="MethodType"/>
<!-- This isn't part of Qt public API -->
- <modify-function signature="attributes()const" remove="all" />
- <modify-function signature="getParameterTypes(int*)const" remove="all" />
+ <modify-function signature="attributes()const" remove="all"/>
+ <modify-function signature="getParameterTypes(int*)const" remove="all"/>
</value-type>
<object-type name="QMetaObject">
<enum-type name="Call"/>
- <include file-name="qobjectdefs.h" location="global" />
+ <include file-name="qobjectdefs.h" location="global"/>
<!-- This isn't part of Qt public API -->
- <modify-function signature="connect(const QObject*,int,const QObject*,int,int,int*)" remove="all" />
+ <modify-function signature="connect(const QObject*,int,const QObject*,int,int,int*)" remove="all"/>
</object-type>
<object-type name="QMetaObject::Connection">
- <include file-name="qobjectdefs.h" location="global" />
+ <include file-name="qobjectdefs.h" location="global"/>
</object-type>
<value-type name="QMetaProperty" >
<!-- This isn't part of Qt public API -->
- <modify-function signature="enclosingMetaObject()const" remove="all" />
+ <modify-function signature="enclosingMetaObject()const" remove="all"/>
</value-type>
<value-type name="QMetaClassInfo">
<!-- This isn't part of Qt public API -->
- <modify-function signature="enclosingMetaObject()const" remove="all" />
+ <modify-function signature="enclosingMetaObject()const" remove="all"/>
</value-type>
<value-type name="QMetaEnum">
@@ -3928,7 +2824,7 @@
<remove-argument />
</modify-argument>
<modify-argument index="return">
- <replace-type modified-type="PyTuple" />
+ <replace-type modified-type="PyTuple"/>
</modify-argument>
<inject-code class="target" position="beginning">
<insert-template name="fix_args,bool*"/>
@@ -3939,17 +2835,14 @@
<remove-argument />
</modify-argument>
<modify-argument index="return">
- <replace-type modified-type="PyTuple" />
+ <replace-type modified-type="PyTuple"/>
</modify-argument>
<inject-code class="target" position="beginning">
<insert-template name="fix_args,bool*"/>
</inject-code>
</modify-function>
<!-- This isn't part of Qt public API -->
- <modify-function signature="enclosingMetaObject()const" remove="all" />
- <!-- Qt5.5: "template<typename T> static QMetaEnum fromType()" is not understood by the compiler.
- We therefore ignore this 5.5 addition for now: -->
- <modify-function signature="fromType()" since="5.5" remove="all" />
+ <modify-function signature="enclosingMetaObject()const" remove="all"/>
</value-type>
<!-- From Qt4.6 -->
@@ -3968,7 +2861,7 @@
</object-type>
<object-type name="QAbstractTransition" since="4.6">
- <enum-type name="TransitionType" since="5.5" />
+ <enum-type name="TransitionType" since="5.5"/>
<modify-function signature="QAbstractTransition(QState*)">
<modify-argument index="1">
@@ -3996,19 +2889,19 @@
<modify-function signature="targetState()const">
<modify-argument index="return">
- <reference-count action="set" variable-name="setTargetState(QAbstractState*)1" />
+ <reference-count action="set" variable-name="setTargetState(QAbstractState*)1"/>
</modify-argument>
</modify-function>
<modify-function signature="targetStates()const">
<modify-argument index="return">
- <reference-count action="set" variable-name="setTargetState(QAbstractState*)1" />
+ <reference-count action="set" variable-name="setTargetState(QAbstractState*)1"/>
</modify-argument>
</modify-function>
<modify-function signature="setTargetStates(QList&lt;QAbstractState*&gt;)">
<modify-argument index="1">
- <reference-count action="set" variable-name="setTargetState(QAbstractState*)1" />
+ <reference-count action="set" variable-name="setTargetState(QAbstractState*)1"/>
</modify-argument>
</modify-function>
@@ -4040,42 +2933,25 @@
</modify-function>
<modify-function signature="clear()" >
- <inject-code class="target" position="beginning">
- for (int counter = 0; counter &lt; %CPPSELF.animationCount(); ++counter ) {
- QAbstractAnimation *animation = %CPPSELF.animationAt(counter);
- PyObject *obj = %CONVERTTOPYTHON[QAbstractAnimation*](animation);
- Shiboken::Object::setParent(NULL, obj);
- Py_DECREF(obj);
- }
- %CPPSELF.clear();
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qanimationgroup-clear"/>
</modify-function>
</object-type>
<!-- We will use inject code to implement the function below -->
- <rejection class="QEasingCurve" function-name="setCustomType" />
- <rejection class="QEasingCurve" function-name="customType" />
+ <rejection class="QEasingCurve" function-name="setCustomType"/>
+ <rejection class="QEasingCurve" function-name="customType"/>
<value-type name="QEasingCurve" since="4.6">
<extra-includes>
<include file-name="pysideweakref.h" location="global"/>
<include file-name="glue/qeasingcurve_glue.h" location="local"/>
</extra-includes>
- <inject-code>
- PySideEasingCurveFunctor::init();
- </inject-code>
- <enum-type name="Type" />
+ <inject-code file="../glue/qtcore.cpp" snippet="qeasingcurve"/>
+ <enum-type name="Type"/>
<add-function signature="setCustomType(PyObject*)">
- <inject-code>
- QEasingCurve::EasingFunction func = PySideEasingCurveFunctor::createCustomFuntion(%PYSELF, %PYARG_1);
- if (func)
- %CPPSELF.%FUNCTION_NAME(func);
- </inject-code>
+ <inject-code file="../glue/qtcore.cpp" snippet="qeasingcurve-setcustomtype"/>
</add-function>
<add-function signature="customType()" return-type="PyObject">
- <inject-code>
- //%FUNCTION_NAME()
- %PYARG_0 = PySideEasingCurveFunctor::callable(%PYSELF);
- </inject-code>
+ <inject-code file="../glue/qtcore.cpp" snippet="qeasingcurve-customtype"/>
</add-function>
</value-type>
@@ -4086,11 +2962,11 @@
</value-type>
<value-type name="QJsonDocument">
- <enum-type name="DataValidation" />
- <enum-type name="JsonFormat" />
+ <enum-type name="DataValidation"/>
+ <enum-type name="JsonFormat"/>
</value-type>
- <rejection class="QJsonDocument" field-name="BinaryFormatTag" />
+ <rejection class="QJsonDocument" field-name="BinaryFormatTag"/>
<value-type name="QJsonParseError">
<enum-type name="ParseError"/>
@@ -4120,10 +2996,10 @@
</object-type>
- <object-type name="QFinalState" since="4.6" />
+ <object-type name="QFinalState" since="4.6"/>
<object-type name="QHistoryState" since="4.6">
- <enum-type name="HistoryType" />
+ <enum-type name="HistoryType"/>
<modify-documentation xpath='description/code'>
&lt;code>machine = QStateMachine()
@@ -4163,20 +3039,9 @@ s1.addTransition(button.clicked, s1h)&lt;/code>
<object-type name="QSignalTransition" since="4.6">
<add-function signature="QSignalTransition(PyObject*,QState*)" return-type="QSignalTransition*">
<modify-argument index="2">
- <replace-default-expression with="0" />
+ <replace-default-expression with="0"/>
</modify-argument>
- <inject-code>
- if (PyObject_TypeCheck(%1, PySideSignalInstanceTypeF())) {
- PyObject *dataSource = PySide::Signal::getObject((PySideSignalInstance*)%PYARG_1);
- Shiboken::AutoDecRef obType(PyObject_Type(dataSource));
- QObject* sender = %CONVERTTOCPP[QObject*](dataSource);
- if (sender) {
- const char*dataSignature = PySide::Signal::getSignature((PySideSignalInstance*)%PYARG_1);
- QByteArray signature(dataSignature); // Append SIGNAL flag (2)
- %0 = new QSignalTransitionWrapper(sender,"2" + signature,%2);
- }
- }
- </inject-code>
+ <inject-code file="../glue/qtcore.cpp" snippet="qsignaltransition"/>
</add-function>
</object-type>
@@ -4193,16 +3058,7 @@ s1.addTransition(button.clicked, s1h)&lt;/code>
<modify-argument index="return">
<parent index="this" action="add"/>
</modify-argument>
- <inject-code class="target" position="beginning">
- QString signalName(%2);
- if (PySide::SignalManager::registerMetaMethod(%1, signalName.mid(1).toLatin1().data(), QMetaMethod::Signal)) {
- QSignalTransition *%0 = %CPPSELF->addTransition(%1, %2, %3);
- %PYARG_0 = %CONVERTTOPYTHON[QSignalTransition*](%0);
- } else {
- Py_INCREF(Py_None);
- %PYARG_0 = Py_None;
- }
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qstate-addtransition-1"/>
</modify-function>
<modify-function signature="addTransition(QAbstractState*)">
<modify-argument index="1">
@@ -4217,18 +3073,7 @@ s1.addTransition(button.clicked, s1h)&lt;/code>
<modify-argument index="return">
<parent index="this" action="add"/>
</modify-argument>
- <inject-code class="target" position="beginning">
- // Obviously the label used by the following goto is a very awkward solution,
- // since it refers to a name very tied to the generator implementation.
- // Check bug #362 for more information on this
- // http://bugs.openbossa.org/show_bug.cgi?id=362
- if (!PyObject_TypeCheck(%1, PySideSignalInstanceTypeF()))
- goto Sbk_%TYPEFunc_%FUNCTION_NAME_TypeError;
- PySideSignalInstance *signalInstance = reinterpret_cast&lt;PySideSignalInstance*&gt;(%1);
- QObject* sender = %CONVERTTOCPP[QObject*](PySide::Signal::getObject(signalInstance));
- QSignalTransition *%0 = %CPPSELF->%FUNCTION_NAME(sender, PySide::Signal::getSignature(signalInstance),%2);
- %PYARG_0 = %CONVERTTOPYTHON[QSignalTransition*](%0);
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qstate-addtransition-2"/>
</add-function>
<modify-function signature="removeTransition(QAbstractTransition*)">
@@ -4257,27 +3102,13 @@ s1.addTransition(button.clicked, s1h)&lt;/code>
</modify-function>
<add-function signature="configuration()" return-type="list of QAbstractState" >
- <inject-code class="target" position="beginning">
- %PYARG_0 = PySet_New(0);
- foreach(QAbstractState *abs_state, %CPPSELF.configuration()) {
- Shiboken::AutoDecRef obj(%CONVERTTOPYTHON[QAbstractState*](abs_state));
- Shiboken::Object::setParent(self, obj);
- PySet_Add(%PYARG_0, obj);
- }
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qstatemachine-configuration"/>
</add-function>
<!-- Replaced by a added function -->
<modify-function signature="defaultAnimations()const" remove="all"/>
<add-function signature="defaultAnimations()" return-type="list of QAbstractAnimation" >
- <inject-code class="target" position="beginning">
- %PYARG_0 = PyList_New(0);
- foreach(QAbstractAnimation *abs_anim, %CPPSELF.defaultAnimations()) {
- Shiboken::AutoDecRef obj(%CONVERTTOPYTHON[QAbstractAnimation*](abs_anim));
- Shiboken::Object::setParent(self, obj);
- PyList_Append(%PYARG_0, obj);
- }
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qstatemachine-defaultanimations"/>
</add-function>
</object-type>
@@ -4294,73 +3125,45 @@ s1.addTransition(button.clicked, s1h)&lt;/code>
<!-- From Qt4.6 ^^^ -->
<add-function signature="SIGNAL(const char*)" return-type="str">
- <inject-code class="target" position="beginning">
- %PYARG_0 = Shiboken::String::fromFormat("2%s",QMetaObject::normalizedSignature(%1).constData());
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qt-signal"/>
</add-function>
<add-function signature="SLOT(const char*)" return-type="str">
- <inject-code class="target" position="beginning">
- %PYARG_0 = Shiboken::String::fromFormat("1%s",QMetaObject::normalizedSignature(%1).constData());
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qt-slot"/>
</add-function>
<add-function signature="QT_TR_NOOP(PyObject)" return-type="PyObject*">
<inject-code class="target" position="beginning">
- <insert-template name="return_argument"><replace from="#" to="1" /></insert-template>
+ <insert-template name="return_argument"><replace from="#" to="1"/></insert-template>
</inject-code>
</add-function>
<add-function signature="QT_TR_NOOP_UTF8(PyObject)" return-type="PyObject*">
<inject-code class="target" position="beginning">
- <insert-template name="return_argument"><replace from="#" to="1" /></insert-template>
+ <insert-template name="return_argument"><replace from="#" to="1"/></insert-template>
</inject-code>
</add-function>
<add-function signature="QT_TRANSLATE_NOOP(PyObject,PyObject)" return-type="PyObject*">
<inject-code class="target" position="beginning">
- <insert-template name="return_argument"><replace from="#" to="2" /></insert-template>
+ <insert-template name="return_argument"><replace from="#" to="2"/></insert-template>
</inject-code>
</add-function>
<add-function signature="QT_TRANSLATE_NOOP3(PyObject,PyObject,PyObject)" return-type="PyObject*">
<inject-code class="target" position="beginning">
- <insert-template name="return_argument"><replace from="#" to="2" /></insert-template>
+ <insert-template name="return_argument"><replace from="#" to="2"/></insert-template>
</inject-code>
</add-function>
<add-function signature="QT_TRANSLATE_NOOP_UTF8(PyObject)" return-type="PyObject*">
<inject-code class="target" position="beginning">
- <insert-template name="return_argument"><replace from="#" to="1" /></insert-template>
+ <insert-template name="return_argument"><replace from="#" to="1"/></insert-template>
</inject-code>
</add-function>
- <inject-code class="native" position="beginning">
- QT_BEGIN_NAMESPACE
- extern bool
- qRegisterResourceData(int,
- const unsigned char *,
- const unsigned char *,
- const unsigned char *);
-
- extern bool
- qUnregisterResourceData(int,
- const unsigned char *,
- const unsigned char *,
- const unsigned char *);
- QT_END_NAMESPACE
- </inject-code>
+ <inject-code class="native" position="beginning" file="../glue/qtcore.cpp" snippet="qt-registerresourcedata"/>
<add-function signature="qRegisterResourceData(int,PyBytes,PyBytes,PyBytes)" return-type="bool">
- <inject-code class="target" position="beginning">
- %RETURN_TYPE %0 = %FUNCTION_NAME(%1, reinterpret_cast&lt;uchar*&gt;(PyBytes_AS_STRING(%PYARG_2)),
- reinterpret_cast&lt;uchar*&gt;(PyBytes_AS_STRING(%PYARG_3)),
- reinterpret_cast&lt;uchar*&gt;(PyBytes_AS_STRING(%PYARG_4)));
- %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0);
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qt-qregisterresourcedata"/>
</add-function>
<add-function signature="qUnregisterResourceData(int,PyBytes,PyBytes,PyBytes)" return-type="bool">
- <inject-code class="target" position="beginning">
- %RETURN_TYPE %0 = %FUNCTION_NAME(%1, reinterpret_cast&lt;uchar*&gt;(PyBytes_AS_STRING(%PYARG_2)),
- reinterpret_cast&lt;uchar*&gt;(PyBytes_AS_STRING(%PYARG_3)),
- reinterpret_cast&lt;uchar*&gt;(PyBytes_AS_STRING(%PYARG_4)));
- %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0);
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtcore.cpp" snippet="qt-qunregisterresourcedata"/>
</add-function>
<object-type name="QFactoryInterface"/>
@@ -4369,9 +3172,9 @@ s1.addTransition(button.clicked, s1h)&lt;/code>
<object-type name="QPluginLoader"/>
<object-type name="QStringListModel"/>
- <suppress-warning text="Unable to decide type of property: 'QLibrary::LoadHints' in class 'QPluginLoader'" />
- <suppress-warning text="enum '_ISalnum' does not have a type entry or is not an enum" />
- <suppress-warning text="enum 'Qt::Initialization' does not have a type entry or is not an enum" />
+ <suppress-warning text="Unable to decide type of property: 'QLibrary::LoadHints' in class 'QPluginLoader'"/>
+ <suppress-warning text="enum '_ISalnum' does not have a type entry or is not an enum"/>
+ <suppress-warning text="enum 'Qt::Initialization' does not have a type entry or is not an enum"/>
<suppress-warning text="visibility of function '*' modified in class '*'"/>
<suppress-warning text="hiding of function '*' in class '*'"/>
<suppress-warning text="namespace '*' does not have a type entry"/>
@@ -4390,55 +3193,57 @@ s1.addTransition(button.clicked, s1h)&lt;/code>
<suppress-warning text="unhandled enum value: (sizeof(void*)&lt;&lt;3) in QSysInfo::Sizes"/>
<suppress-warning text="unmatched enum ~0u"/>
<suppress-warning text="unmatched enum (sizeof(void*)&lt;&lt;3)"/>
- <suppress-warning text="signature 'setCustomType(float)' for function modification in 'QEasingCurve' not found. Possible candidates: setCustomType(double) in QEasingCurve"/>
- <suppress-warning text="enum 'enum_4' does not have a type entry or is not an enum" />
- <suppress-warning text="enum 'enum_5' does not have a type entry or is not an enum" />
- <suppress-warning text="enum 'FP_NORMAL' does not have a type entry or is not an enum" />
- <suppress-warning text="Shadowing: *" />
+ <suppress-warning text="^signature 'setCustomType(float)' for function modification in 'QEasingCurve' not found.*$"/>
+ <suppress-warning text="enum 'enum_4' does not have a type entry or is not an enum"/>
+ <suppress-warning text="enum 'enum_5' does not have a type entry or is not an enum"/>
+ <suppress-warning text="enum 'FP_NORMAL' does not have a type entry or is not an enum"/>
+ <suppress-warning text="Shadowing: *"/>
+ <!-- QCborStreamReader: Suppress warnings about 32/64bit signatures not found depending on qsizetype -->
+ <suppress-warning text="^signature 'readStringChunk\(char.*in 'QCborStreamReader' not found.*$"/>
<!-- this enum is defined on Qt global header but only used in QtGui module -->
- <suppress-warning text="enum 'PM_MessageBoxHeight' does not have a type entry or is not an enum" />
+ <suppress-warning text="enum 'PM_MessageBoxHeight' does not have a type entry or is not an enum"/>
<!-- this function only exists on Windows -->
- <suppress-warning text="signature 'winEventFilter(MSG*,long*)' for function modification in 'QCoreApplication' not found. Possible candidates:*"/>
+ <suppress-warning text="^signature 'winEventFilter(MSG*,long*)' for function modification in 'QCoreApplication' not found.*"/>
<!-- this is necessary to avoid warning on other modules -->
- <suppress-warning text="signature 'operator*(QByteArray,const char*)' for function modification in 'QByteArray' not found. Possible candidates:*"/>
- <suppress-warning text="signature 'operator+(QByteArray,QString)' for function modification in 'QByteArray' not found. Possible candidates:*"/>
+ <suppress-warning text="^signature 'operator*(QByteArray,const char*)' for function modification in 'QByteArray' not found.*"/>
+ <suppress-warning text="^signature 'operator+(QByteArray,QString)' for function modification in 'QByteArray' not found.*"/>
<!-- This enum is intenaly used -->
- <suppress-warning text="enum 'PM_CbaIconHeight' does not have a type entry or is not an enum" />
+ <suppress-warning text="enum 'PM_CbaIconHeight' does not have a type entry or is not an enum"/>
<!-- TODO: this need be removed -->
- <suppress-warning text="skipping function '*', unmatched return type '*'"/>
- <suppress-warning text="skipping function '*', unmatched type '*"/>
+ <suppress-warning text="^skipping function '.*', unmatched return type '.*$"/>
+ <suppress-warning text="^skipping function '.*', unmatched type '.*$"/>
<suppress-warning text="enum 'q_static_assert_result39' does not have a type entry or is not an enum"/>
<suppress-warning text="horribly broken type ''"/>
- <suppress-warning text="Pure virtual method 'QTextCodec::convertFromUnicode(const QChar*,int,QTextCodec::ConverterState*)const' must be implement but was completely removed on type system." />
+ <suppress-warning text="Pure virtual method 'QTextCodec::convertFromUnicode(const QChar*,int,QTextCodec::ConverterState*)const' must be implement but was completely removed on type system."/>
<!-- Qt5.5: No idea how to get rid of the following five enums, which are moved elsewhere since 5.5: -->
- <suppress-warning text="enum 'QLocale::MeasurementSystem' is specified in typesystem, but not declared" />
- <suppress-warning text="enum 'QState::RestorePolicy' is specified in typesystem, but not declared" />
- <!-- <suppress-warning text="enum 'QLocale::FormatType' is specified in typesystem, but not declared" /> -->
- <suppress-warning text="enum 'QAbstractAnimation::DeletionPolicy' is specified in typesystem, but not declared" />
- <!-- <suppress-warning text="enum 'QAbstractAnimation::State' is specified in typesystem, but not declared" /> -->
+ <suppress-warning text="enum 'QLocale::MeasurementSystem' is specified in typesystem, but not declared"/>
+ <suppress-warning text="enum 'QState::RestorePolicy' is specified in typesystem, but not declared"/>
+ <!-- <suppress-warning text="enum 'QLocale::FormatType' is specified in typesystem, but not declared"/> -->
+ <suppress-warning text="enum 'QAbstractAnimation::DeletionPolicy' is specified in typesystem, but not declared"/>
+ <!-- <suppress-warning text="enum 'QAbstractAnimation::State' is specified in typesystem, but not declared"/> -->
<!-- Qt5.5: we also suppress these warnings, instead of adding wrong enums -->
- <suppress-warning text="enum 'InterfaceType' does not have a type entry or is not an enum" />
- <suppress-warning text="enum 'TextBoundaryType' does not have a type entry or is not an enum" />
- <suppress-warning text="enum 'RelationFlag' does not have a type entry or is not an enum" />
- <suppress-warning text="enum 'Role' does not have a type entry or is not an enum" />
+ <suppress-warning text="enum 'InterfaceType' does not have a type entry or is not an enum"/>
+ <suppress-warning text="enum 'TextBoundaryType' does not have a type entry or is not an enum"/>
+ <suppress-warning text="enum 'RelationFlag' does not have a type entry or is not an enum"/>
+ <suppress-warning text="enum 'Role' does not have a type entry or is not an enum"/>
<!-- Anonymous enum in qtbase/src/corelib/global/qtypeinfo.h -->
- <suppress-warning text="enum 'Q_RELOCATABLE_TYPE' does not have a type entry or is not an enum" />
+ <suppress-warning text="Anonymous enum (Q_COMPLEX_TYPE, ... , Q_RELOCATABLE_TYPE) does not have a type entry"/>
<!-- Another anonymous enum / value pair in in qtbase/src/corelib/kernel/qcoreapplication.h -->
- <suppress-warning text="no matching enum 'QT_VERSION'" />
- <suppress-warning text="unhandled enum value: QT_VERSION in QCoreApplication::ApplicationFlags from header 'qcoreapplication.h'" />
- <suppress-warning text="unmatched enum QT_VERSION from header 'qcoreapplication.h'" />
+ <suppress-warning text="no matching enum 'QT_VERSION'"/>
+ <suppress-warning text="unhandled enum value: QT_VERSION in QCoreApplication::ApplicationFlags from header 'qcoreapplication.h'"/>
+ <suppress-warning text="unmatched enum QT_VERSION from header 'qcoreapplication.h'"/>
- <suppress-warning text="skipping field 'QSysInfo::WindowsVersion' with unmatched type 'const QSysInfo::WinVersion'" />
- <suppress-warning text="template baseclass 'QListSpecialMethods&lt;T&gt;' of 'QList' is not known" />
+ <suppress-warning text="skipping field 'QSysInfo::WindowsVersion' with unmatched type 'const QSysInfo::WinVersion'"/>
+ <suppress-warning text="template baseclass 'QListSpecialMethods&lt;T&gt;' of 'QList' is not known"/>
</typesystem>
diff --git a/sources/pyside2/PySide2/QtCore/typesystem_core_mac.xml b/sources/pyside2/PySide2/QtCore/typesystem_core_mac.xml
index 583c1c08..c1a1abcb 100644
--- a/sources/pyside2/PySide2/QtCore/typesystem_core_mac.xml
+++ b/sources/pyside2/PySide2/QtCore/typesystem_core_mac.xml
@@ -40,7 +40,7 @@
****************************************************************************/
-->
<typesystem package="PySide2.QtCore">
- <primitive-type name="Qt::HANDLE" target-lang-api-name="PyObject" />
+ <primitive-type name="Qt::HANDLE" target-lang-api-name="PyObject"/>
<!-- Qt5: had to move QAbstractEventDispatcher into os-specific files because of Windows -->
<object-type name="QAbstractEventDispatcher">
<modify-function signature="processEvents(QFlags&lt;QEventLoop::ProcessEventsFlag>)" allow-thread="yes"/>
@@ -50,8 +50,8 @@
<object-type name="QSysInfo">
<enum-type name="Endian"/>
<enum-type name="Sizes"/>
- <enum-type name="MacVersion" since="5.5" />
+ <enum-type name="MacVersion" since="5.5"/>
</object-type>
- <suppress-warning text="skipping field 'QSysInfo::WindowsVersion' with unmatched type 'QSysInfo::WinVersion'" />
- <suppress-warning text="enum 'QSysInfo::WinVersion' does not have a type entry or is not an enum" />
+ <suppress-warning text="skipping field 'QSysInfo::WindowsVersion' with unmatched type 'QSysInfo::WinVersion'"/>
+ <suppress-warning text="enum 'QSysInfo::WinVersion' does not have a type entry or is not an enum"/>
</typesystem>
diff --git a/sources/pyside2/PySide2/QtCore/typesystem_core_win.xml b/sources/pyside2/PySide2/QtCore/typesystem_core_win.xml
index 41018728..afd733b3 100644
--- a/sources/pyside2/PySide2/QtCore/typesystem_core_win.xml
+++ b/sources/pyside2/PySide2/QtCore/typesystem_core_win.xml
@@ -43,7 +43,7 @@
<extra-includes>
<include file-name="windows.h" location="global"/>
</extra-includes>
- <primitive-type name="Qt::HANDLE" target-lang-api-name="PyObject" />
+ <primitive-type name="Qt::HANDLE" target-lang-api-name="PyObject"/>
<primitive-type name="HWND">
<!-- Qt5: Add this include there to insert ti in the global qtcore header (needed by qprocess_wrapper) -->
<include file-name="wtypes.h" location="global"/>
@@ -74,7 +74,7 @@
</inject-code>
<!-- Qt5: had to move QAbstractEventDispatcher into os-specific files because of Windows -->
- <object-type name="QWinEventNotifier" />
+ <object-type name="QWinEventNotifier"/>
<object-type name="QAbstractEventDispatcher">
<modify-function signature="processEvents(QFlags&lt;QEventLoop::ProcessEventsFlag>)" allow-thread="yes"/>
<!-- Qt5: had to add this recursive object def. This was crucial to get rid of "pure virtual" -->
@@ -83,8 +83,8 @@
<object-type name="QSysInfo">
<enum-type name="Endian"/>
<enum-type name="Sizes"/>
- <enum-type name="WinVersion" since="5.5" />
+ <enum-type name="WinVersion" since="5.5"/>
</object-type>
- <suppress-warning text="skipping field 'QSysInfo::MacintoshVersion' with unmatched type 'QSysInfo::MacVersion'" />
- <suppress-warning text="enum 'QSysInfo::MacVersion' does not have a type entry or is not an enum" />
+ <suppress-warning text="skipping field 'QSysInfo::MacintoshVersion' with unmatched type 'QSysInfo::MacVersion'"/>
+ <suppress-warning text="enum 'QSysInfo::MacVersion' does not have a type entry or is not an enum"/>
</typesystem>
diff --git a/sources/pyside2/PySide2/QtCore/typesystem_core_x11.xml b/sources/pyside2/PySide2/QtCore/typesystem_core_x11.xml
index d5b0bae3..c3cbd366 100644
--- a/sources/pyside2/PySide2/QtCore/typesystem_core_x11.xml
+++ b/sources/pyside2/PySide2/QtCore/typesystem_core_x11.xml
@@ -54,8 +54,8 @@
<enum-type name="Endian"/>
<enum-type name="Sizes"/>
</object-type>
- <suppress-warning text="skipping field 'QSysInfo::MacintoshVersion' with unmatched type 'QSysInfo::MacVersion'" />
- <suppress-warning text="skipping field 'QSysInfo::WindowsVersion' with unmatched type 'QSysInfo::MacVersion'" />
- <suppress-warning text="enum 'QSysInfo::MacVersion' does not have a type entry or is not an enum" />
- <suppress-warning text="enum 'QSysInfo::WinVersion' does not have a type entry or is not an enum" />
+ <suppress-warning text="skipping field 'QSysInfo::MacintoshVersion' with unmatched type 'QSysInfo::MacVersion'"/>
+ <suppress-warning text="skipping field 'QSysInfo::WindowsVersion' with unmatched type 'QSysInfo::MacVersion'"/>
+ <suppress-warning text="enum 'QSysInfo::MacVersion' does not have a type entry or is not an enum"/>
+ <suppress-warning text="enum 'QSysInfo::WinVersion' does not have a type entry or is not an enum"/>
</typesystem>
diff --git a/sources/pyside2/PySide2/QtDataVisualization/CMakeLists.txt b/sources/pyside2/PySide2/QtDataVisualization/CMakeLists.txt
index e61a7023..59c779fb 100644
--- a/sources/pyside2/PySide2/QtDataVisualization/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtDataVisualization/CMakeLists.txt
@@ -61,10 +61,9 @@ set(QtDataVisualization_libraries pyside2
set(QtDataVisualization_deps QtCore QtGui)
-create_pyside_module(QtDataVisualization
- QtDataVisualization_include_dirs
- QtDataVisualization_libraries
- QtDataVisualization_deps
- QtDataVisualization_SOURCE_DIR
- QtDataVisualization_SRC
- "")
+create_pyside_module(NAME QtDataVisualization
+ INCLUDE_DIRS QtDataVisualization_include_dirs
+ LIBRARIES QtDataVisualization_libraries
+ DEPS QtDataVisualization_deps
+ TYPESYSTEM_PATH QtDataVisualization_SOURCE_DIR
+ SOURCES QtDataVisualization_SRC)
diff --git a/sources/pyside2/PySide2/QtDataVisualization/typesystem_datavisualization.xml b/sources/pyside2/PySide2/QtDataVisualization/typesystem_datavisualization.xml
index d2018ffc..94e6f4b8 100644
--- a/sources/pyside2/PySide2/QtDataVisualization/typesystem_datavisualization.xml
+++ b/sources/pyside2/PySide2/QtDataVisualization/typesystem_datavisualization.xml
@@ -41,38 +41,7 @@
-->
<typesystem package="PySide2.QtDataVisualization">
- <template name="cppqlistofptrtoqvectors_to_py_conversion">
- const int rowCount = %in.size();
- PyObject* %out = PyList_New(rowCount);
- for (int r = 0; r &lt; rowCount; ++r) {
- const QVector&lt;%INTYPE_0&gt; *row = %in.at(r);
- const int columnCount = row->size();
- PyObject *pyRow = PyList_New(columnCount);
- for (int c = 0; c &lt; columnCount; ++c) {
- const %INTYPE_0 &amp;cppItem = row->at(c);
- PyList_SET_ITEM(pyRow, c, %CONVERTTOPYTHON[%INTYPE_0](cppItem));
- }
- PyList_SET_ITEM(%out, r, pyRow);
- }
- return %out;
- </template>
- <template name="py_to_cppqlistofptrtoqvectors_conversion">
- const int rowCount = int(PySequence_Size(%in));
- %OUTTYPE &amp;result = %out;
- result.reserve(rowCount);
- for (int r = 0; r &lt; rowCount; ++r) {
- Shiboken::AutoDecRef rowItem(PySequence_GetItem(%in, r));
- const int columnCount = int(PySequence_Size(rowItem));
- QVector&lt;%OUTTYPE_0&gt; *row = new QVector&lt;%OUTTYPE_0&gt;;
- row->reserve(columnCount);
- for (int c = 0; c &lt; columnCount; ++c) {
- Shiboken::AutoDecRef pyItem(PySequence_GetItem(rowItem, c));
- %OUTTYPE_0 v = %CONVERTTOCPP[%OUTTYPE_0](pyItem);
- row->append(v);
- }
- result.append(row);
- }
- </template>
+ <load-typesystem name="templates/datavisualization_common.xml" generate="no" />
<load-typesystem name="QtGui/typesystem_gui.xml" generate="no" />
<namespace-type name="QtDataVisualization">
<primitive-type name="QBarDataArray">
@@ -313,9 +282,7 @@
<modify-argument index="1">
<reference-count action="set"/>
</modify-argument>
- <inject-code>
- Shiboken::Object::releaseOwnership(%PYARG_1);
- </inject-code>
+ <inject-code file="../glue/qtdatavisualization.cpp" snippet="releaseownership"/>
</modify-function>
<modify-function signature="setColumnAxis(QtDataVisualization::QCategory3DAxis*)">
<modify-argument index="1">
@@ -343,9 +310,7 @@
<modify-argument index="1">
<reference-count action="set"/>
</modify-argument>
- <inject-code>
- Shiboken::Object::releaseOwnership(%PYARG_1);
- </inject-code>
+ <inject-code file="../glue/qtdatavisualization.cpp" snippet="releaseownership"/>
</modify-function>
<modify-function signature="setAxisX(QtDataVisualization::QValue3DAxis*)">
<modify-argument index="1">
@@ -374,9 +339,7 @@
<modify-argument index="1">
<reference-count action="set"/>
</modify-argument>
- <inject-code>
- Shiboken::Object::releaseOwnership(%PYARG_1);
- </inject-code>
+ <inject-code file="../glue/qtdatavisualization.cpp" snippet="releaseownership"/>
</modify-function>
<modify-function signature="setAxisX(QtDataVisualization::QValue3DAxis*)">
<modify-argument index="1">
@@ -418,25 +381,19 @@
<modify-argument index="1">
<reference-count action="set"/>
</modify-argument>
- <inject-code>
- Shiboken::Object::releaseOwnership(%PYARG_1);
- </inject-code>
+ <inject-code file="../glue/qtdatavisualization.cpp" snippet="releaseownership"/>
</modify-function>
<modify-function signature="releaseInputHandler(QtDataVisualization::QAbstract3DInputHandler*)">
<modify-argument index="1">
<reference-count action="set"/>
</modify-argument>
- <inject-code>
- Shiboken::Object::releaseOwnership(%PYARG_1);
- </inject-code>
+ <inject-code file="../glue/qtdatavisualization.cpp" snippet="releaseownership"/>
</modify-function>
<modify-function signature="releaseTheme(QtDataVisualization::Q3DTheme*)">
<modify-argument index="1">
<reference-count action="set"/>
</modify-argument>
- <inject-code>
- Shiboken::Object::releaseOwnership(%PYARG_1);
- </inject-code>
+ <inject-code file="../glue/qtdatavisualization.cpp" snippet="releaseownership"/>
</modify-function>
<modify-function signature="setActiveInputHandler(QtDataVisualization::QAbstract3DInputHandler*)">
<modify-argument index="1">
diff --git a/sources/pyside2/PySide2/QtGui/CMakeLists.txt b/sources/pyside2/PySide2/QtGui/CMakeLists.txt
index 1fe743c0..f514ea7c 100644
--- a/sources/pyside2/PySide2/QtGui/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtGui/CMakeLists.txt
@@ -2,11 +2,9 @@ project(QtGui)
qt5_wrap_cpp(QPYTEXTOBJECT_MOC "${pyside2_SOURCE_DIR}/qpytextobject.h")
-set(QtGui_OPTIONAL_SRC)
set(QtGui_DROPPED_ENTRIES)
-check_qt_class(QtGui QOpenGLTimeMonitor QtGui_OPTIONAL_SRC QtGui_DROPPED_ENTRIES)
-check_qt_class(QtGui QOpenGLTimerQuery QtGui_OPTIONAL_SRC QtGui_DROPPED_ENTRIES)
+get_property(QtGui_enabled_features TARGET Qt5::Gui PROPERTY INTERFACE_QT_ENABLED_FEATURES)
set(QtGui_SRC
${QtGui_GEN_DIR}/qabstractopenglfunctions_wrapper.cpp
@@ -207,11 +205,23 @@ ${QtGui_GEN_DIR}/qwhatsthisclickedevent_wrapper.cpp
${QtGui_GEN_DIR}/qwheelevent_wrapper.cpp
${QtGui_GEN_DIR}/qwindow_wrapper.cpp
${QtGui_GEN_DIR}/qwindowstatechangeevent_wrapper.cpp
-${QtGui_OPTIONAL_SRC}
# module is always needed
${QtGui_GEN_DIR}/qtgui_module_wrapper.cpp
)
+# 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 "Qt5Gui: Dropping Desktop OpenGL classes (GLES2)")
+else()
+ list(APPEND QtGui_SRC
+ ${QtGui_GEN_DIR}/qopengltimemonitor_wrapper.cpp
+ ${QtGui_GEN_DIR}/qopengltimerquery_wrapper.cpp)
+ message(STATUS "Qt5Gui: Adding Desktop OpenGL classes")
+endif()
+
configure_file("${QtGui_SOURCE_DIR}/typesystem_gui.xml.in"
"${QtGui_BINARY_DIR}/typesystem_gui.xml" @ONLY)
@@ -234,17 +244,15 @@ set(QtGui_libraries pyside2
${Qt5Gui_LIBRARIES})
set(QtGui_deps QtCore)
-create_pyside_module(QtGui
- QtGui_include_dirs
- QtGui_libraries
- QtGui_deps
- QtGui_SOURCE_DIR
- QtGui_SRC
- QPYTEXTOBJECT_MOC
- ${QtGui_BINARY_DIR}/typesystem_gui.xml
- ""
- ""
- QtGui_DROPPED_ENTRIES)
+create_pyside_module(NAME QtGui
+ INCLUDE_DIRS QtGui_include_dirs
+ LIBRARIES QtGui_libraries
+ DEPS QtGui_deps
+ TYPESYSTEM_PATH QtGui_SOURCE_DIR
+ SOURCES QtGui_SRC
+ STATIC_SOURCES QPYTEXTOBJECT_MOC
+ TYPESYSTEM_NAME ${QtGui_BINARY_DIR}/typesystem_gui.xml
+ DROPPED_ENTRIES QtGui_DROPPED_ENTRIES)
install(FILES ${pyside2_SOURCE_DIR}/qpytextobject.h DESTINATION include/PySide2/QtGui/)
diff --git a/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml b/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml
index 70fd1692..2181ff07 100644
--- a/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml
+++ b/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml
@@ -41,36 +41,27 @@
-->
<typesystem package="PySide2.QtGui">
<load-typesystem name="QtCore/typesystem_core.xml" generate="no"/>
+ <load-typesystem name="templates/core_common.xml" generate="no"/>
+ <load-typesystem name="templates/gui_common.xml" generate="no"/>
- <template name="QFontCharFix">
- int size = Shiboken::String::len(%PYARG_1);
- if (size == 1) {
- const char *str = Shiboken::String::toCString(%PYARG_1);
- QChar ch(str[0]);
- %RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(ch);
- %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0);
- } else {
- PyErr_SetString(PyExc_TypeError, "String must have only one character");
- }
- </template>
<rejection class="^Q.*$" argument-type="^QPlatform.*$"/>
- <function signature="qAlpha(uint)" />
- <function signature="qBlue(uint)" />
- <function signature="qGray(int,int,int)" />
- <function signature="qGray(uint)" />
- <function signature="qGreen(uint)" />
- <function signature="qIsGray(uint)" />
- <function signature="qRed(uint)" />
- <function signature="qRgb(int,int,int)" />
- <function signature="qRgba(int,int,int,int)" />
- <function signature="qFuzzyCompare(QMatrix,QMatrix)" />
- <function signature="qFuzzyCompare(QTransform,QTransform)" />
- <function signature="qFuzzyCompare(QQuaternion,QQuaternion)" />
- <function signature="qFuzzyCompare(QMatrix4x4,QMatrix4x4)" />
- <function signature="qFuzzyCompare(QVector2D,QVector2D)" />
- <function signature="qFuzzyCompare(QVector3D,QVector3D)" />
- <function signature="qFuzzyCompare(QVector4D,QVector4D)" />
+ <function signature="qAlpha(uint)"/>
+ <function signature="qBlue(uint)"/>
+ <function signature="qGray(int,int,int)"/>
+ <function signature="qGray(uint)"/>
+ <function signature="qGreen(uint)"/>
+ <function signature="qIsGray(uint)"/>
+ <function signature="qRed(uint)"/>
+ <function signature="qRgb(int,int,int)"/>
+ <function signature="qRgba(int,int,int,int)"/>
+ <function signature="qFuzzyCompare(QMatrix,QMatrix)"/>
+ <function signature="qFuzzyCompare(QTransform,QTransform)"/>
+ <function signature="qFuzzyCompare(QQuaternion,QQuaternion)"/>
+ <function signature="qFuzzyCompare(QMatrix4x4,QMatrix4x4)"/>
+ <function signature="qFuzzyCompare(QVector2D,QVector2D)"/>
+ <function signature="qFuzzyCompare(QVector3D,QVector3D)"/>
+ <function signature="qFuzzyCompare(QVector4D,QVector4D)"/>
<rejection class="*" function-name="qobject_interface_iid&lt;QStyleFactoryInterface*&gt;"/>
<rejection class="*" function-name="qobject_interface_iid&lt;QAccessibleFactoryInterface*&gt;"/>
<rejection class="*" function-name="qobject_interface_iid&lt;QInputContextFactoryInterface*&gt;"/>
@@ -97,21 +88,21 @@
<rejection class="*" function-name="d_func"/>
<rejection class="*" field-name="d_ptr"/>
<rejection class="*" field-name="d"/>
- <rejection class="^QOpenGL.*$" argument-type="^GLboolean( const)?\*$"/>
+ <rejection class="^QOpenGL.*$" argument-type="^(const )?GLboolean ?\*$"/>
<rejection class="^QOpenGL.*$" argument-type="^GLchar\*$"/>
- <rejection class="^QOpenGL.*$" argument-type="GLchar *const const*"/>
+ <rejection class="^QOpenGL.*$" argument-type="^(const )?GLchar ?\*(const)?\*$"/>
<rejection class="^QOpenGL.*$" argument-type="^char\*$"/>
- <rejection class="^QOpenGL.*$" argument-type="^char( const)?\*\*$"/>
+ <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="^QMatrix.x.( 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="^QVector.D( const)?\*$"/>
- <rejection class="^QOpenGL.*$" argument-type="^void( const)?\*\*$"/>
+ <rejection class="^QOpenGL.*$" argument-type="^(const )?QVector.D ?\*$"/>
+ <rejection class="^QOpenGL.*$" argument-type="^(const )?void ?\*\*$"/>
<!--
Event classes have a lot of non-documented protected fields, those fields
@@ -212,13 +203,9 @@
<primitive-type name="WId" target-lang-api-name="PyLong">
<conversion-rule>
- <native-to-target>
- return PyLong_FromVoidPtr(reinterpret_cast&lt;void *&gt;(%in));
- </native-to-target>
+ <native-to-target file="../glue/qtgui.cpp" snippet="return-pylong-voidptr"/>
<target-to-native>
- <add-conversion type="PyLong">
- %out = reinterpret_cast&lt;%OUTTYPE&gt;(PyLong_AsVoidPtr(%in));
- </add-conversion>
+ <add-conversion type="PyLong" file="../glue/qtgui.cpp" snippet="conversion-pylong"/>
</target-to-native>
</conversion-rule>
</primitive-type>
@@ -257,9 +244,9 @@
<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, %f, %f, %f" />
+ <replace from="%REPR_FORMAT" to="%f, %f, %f, %f, %f, %f, %f, %f, %f"/>
<replace from="%REPR_ARGS"
- to="%CPPSELF.m11(), %CPPSELF.m12(), %CPPSELF.m13(), %CPPSELF.m21(), %CPPSELF.m22(), %CPPSELF.m23(), %CPPSELF.m31(), %CPPSELF.m32(), %CPPSELF.m33()" />
+ to="%CPPSELF.m11(), %CPPSELF.m12(), %CPPSELF.m13(), %CPPSELF.m21(), %CPPSELF.m22(), %CPPSELF.m23(), %CPPSELF.m31(), %CPPSELF.m32(), %CPPSELF.m33()"/>
</insert-template>
</inject-code>
</add-function>
@@ -267,16 +254,16 @@
<add-function signature="__reduce__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="reduce_code">
- <replace from="%REDUCE_FORMAT" to="ddddddddd" />
+ <replace from="%REDUCE_FORMAT" to="ddddddddd"/>
<replace from="%REDUCE_ARGS"
- to="%CPPSELF.m11(), %CPPSELF.m12(), %CPPSELF.m13(), %CPPSELF.m21(), %CPPSELF.m22(), %CPPSELF.m23(), %CPPSELF.m31(), %CPPSELF.m32(), %CPPSELF.m33()" />
+ to="%CPPSELF.m11(), %CPPSELF.m12(), %CPPSELF.m13(), %CPPSELF.m21(), %CPPSELF.m22(), %CPPSELF.m23(), %CPPSELF.m31(), %CPPSELF.m32(), %CPPSELF.m33()"/>
</insert-template>
</inject-code>
</add-function>
<modify-function signature="map(qreal,qreal,qreal*,qreal*)const">
<modify-argument index="0">
- <replace-type modified-type="PyObject" />
+ <replace-type modified-type="PyObject"/>
</modify-argument>
<modify-argument index="3">
<remove-argument/>
@@ -286,7 +273,7 @@
</modify-argument>
<inject-code class="target" position="beginning">
<insert-template name="fix_args,number*,number*">
- <replace from="$TYPE" to="qreal" />
+ <replace from="$TYPE" to="qreal"/>
</insert-template>
</inject-code>
</modify-function>
@@ -306,38 +293,14 @@
</inject-code>
</modify-function>
<add-function signature="quadToQuad(QPolygonF&amp;,QPolygonF&amp;)" return-type="PyObject*" static="true">
- <inject-code>
- QTransform _result;
- if (QTransform::quadToQuad(%1, %2, _result)) {
- %PYARG_0 = %CONVERTTOPYTHON[QTransform](_result);
- } else {
- Py_INCREF(Py_None);
- %PYARG_0 = Py_None;
- }
- </inject-code>
+ <inject-code file="../glue/qtgui.cpp" snippet="qtransform-quadtoquad"/>
</add-function>
<add-function signature="quadToSquare(QPolygonF &amp;)" return-type="PyObject*" static="true">
- <inject-code>
- QTransform _result;
- if (QTransform::quadToSquare(%1, _result)) {
- %PYARG_0 = %CONVERTTOPYTHON[QTransform](_result);
- } else {
- Py_INCREF(Py_None);
- %PYARG_0 = Py_None;
- }
- </inject-code>
+ <inject-code file="../glue/qtgui.cpp" snippet="qtransform-quadtosquare"/>
</add-function>
<add-function signature="squareToQuad(QPolygonF &amp;)" return-type="PyObject*" static="true">
- <inject-code>
- QTransform _result;
- if (QTransform::squareToQuad(%1, _result)) {
- %PYARG_0 = %CONVERTTOPYTHON[QTransform](_result);
- } else {
- Py_INCREF(Py_None);
- %PYARG_0 = Py_None;
- }
- </inject-code>
+ <inject-code file="../glue/qtgui.cpp" snippet="qtransform-squaretoquad"/>
</add-function>
<!-- Disambiguate from Qt3DCore/qtransform.h -->
<include file-name="QtGui/qtransform.h" location="global"/>
@@ -346,21 +309,17 @@
<value-type name="QStaticText">
<enum-type name="PerformanceHint"/>
</value-type>
- <value-type name="QTextFragment" />
+ <value-type name="QTextFragment"/>
<value-type name="QBitmap" >
<modify-function signature="fromData(QSize,const uchar*,QImage::Format)">
<modify-argument index="2">
<replace-type modified-type="PyBuffer"/>
</modify-argument>
- <inject-code>
- uchar *buffer = reinterpret_cast&lt;uchar*&gt;(Shiboken::Buffer::getPointer(%PYARG_2));
- QBitmap %0 = QBitmap::fromData(%1, buffer, %3);
- %PYARG_0 = %CONVERTTOPYTHON[QBitmap](%0);
- </inject-code>
+ <inject-code file="../glue/qtgui.cpp" snippet="qbitmap-fromdata"/>
</modify-function>
</value-type>
- <value-type name="QTextInlineObject" />
- <value-type name="QTextDocumentFragment" />
+ <value-type name="QTextInlineObject"/>
+ <value-type name="QTextDocumentFragment"/>
<value-type name="QTextOption">
<enum-type name="Flag" flags="Flags"/>
<enum-type name="TabType"/>
@@ -370,19 +329,12 @@
<value-type name="QTextLine" >
<enum-type name="CursorPosition"/>
<enum-type name="Edge"/>
- <modify-function signature="cursorToX(int*,QTextLine::Edge)const" remove="all" />
+ <modify-function signature="cursorToX(int*,QTextLine::Edge)const" remove="all"/>
<modify-function signature="cursorToX(int,QTextLine::Edge)const">
<modify-argument index="0">
- <replace-type modified-type="PyObject" />
+ <replace-type modified-type="PyObject"/>
</modify-argument>
- <inject-code class="target" position="beginning">
- %BEGIN_ALLOW_THREADS
- %RETURN_TYPE %0 = %CPPSELF->::%TYPE::%FUNCTION_NAME(&amp;%1, %2);
- %END_ALLOW_THREADS
- %PYARG_0 = PyTuple_New(2);
- PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](%0));
- PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[%ARG1_TYPE](%1));
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtgui.cpp" snippet="qtextline-cursortox"/>
</modify-function>
<modify-function signature="xToCursor(qreal,QTextLine::CursorPosition)const">
<modify-argument index="2">
@@ -390,12 +342,11 @@
</modify-argument>
</modify-function>
</value-type>
- <value-type name="QTextTableFormat" />
- <value-type name="QTextImageFormat" />
+ <value-type name="QTextTableFormat"/>
+ <value-type name="QTextImageFormat"/>
<value-type name="QTextFrameFormat" >
<enum-type name="BorderStyle"/>
<enum-type name="Position"/>
- <modify-function signature="isValid()const" access="non-final"/>
</value-type>
<value-type name="QTextLength">
<enum-type name="Type"/>
@@ -403,18 +354,15 @@
<value-type name="QPainterPath">
<enum-type name="ElementType"/>
<value-type name="Element">
- <modify-field name="x" write="false"/>
- <modify-field name="y" write="false"/>
- <modify-field name="type" write="false"/>
<include file-name="QPainterPath" location="global"/>
</value-type>
</value-type>
<value-type name="QPalette">
- <enum-type name="ColorGroup" />
- <enum-type name="ColorRole" />
+ <enum-type name="ColorGroup"/>
+ <enum-type name="ColorRole"/>
</value-type>
<object-type name="QInputMethod">
- <enum-type name="Action" />
+ <enum-type name="Action"/>
</object-type>
<value-type name="QKeySequence">
<enum-type name="SequenceFormat"/>
@@ -424,9 +372,9 @@
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="repr_code">
- <replace from="%REPR_FORMAT" to="%i, %i, %i, %i" />
+ <replace from="%REPR_FORMAT" to="%i, %i, %i, %i"/>
<replace from="%REPR_ARGS"
- to="(*%CPPSELF)[0], (*%CPPSELF)[1], (*%CPPSELF)[2], (*%CPPSELF)[3]" />
+ to="(*%CPPSELF)[0], (*%CPPSELF)[1], (*%CPPSELF)[2], (*%CPPSELF)[3]"/>
</insert-template>
</inject-code>
</add-function>
@@ -434,22 +382,15 @@
<add-function signature="__reduce__" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="reduce_code">
- <replace from="%REDUCE_FORMAT" to="iiii" />
- <replace from="%REDUCE_ARGS" to="(*%CPPSELF)[0], (*%CPPSELF)[1], (*%CPPSELF)[2], (*%CPPSELF)[3]" />
+ <replace from="%REDUCE_FORMAT" to="iiii"/>
+ <replace from="%REDUCE_ARGS" to="(*%CPPSELF)[0], (*%CPPSELF)[1], (*%CPPSELF)[2], (*%CPPSELF)[3]"/>
</insert-template>
</inject-code>
</add-function>
<modify-function signature="operator[](uint)const" remove="all"/>
<add-function signature="__getitem__">
- <inject-code class="target" position="beginning">
- if (_i &lt; 0 || _i >= %CPPSELF.count()) {
- PyErr_SetString(PyExc_IndexError, "index out of bounds");
- return 0;
- }
- int item = (*%CPPSELF)[_i];
- return %CONVERTTOPYTHON[int](item);
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtgui.cpp" snippet="qkeysequence-getitem"/>
</add-function>
<!-- ### Not necessary due the PySide QVariant conversion rules -->
@@ -465,25 +406,22 @@
<modify-argument index="return">
<replace-type modified-type="PyObject"/>
</modify-argument>
- <inject-code>
- %PYARG_0 = Shiboken::Buffer::newObject(%CPPSELF.data(), %CPPSELF.size());
- </inject-code>
+ <inject-code file="../glue/qtgui.cpp" snippet="qpicture-data"/>
</modify-function>
<modify-function signature="setData(const char*,uint)">
<modify-argument index="1">
<replace-type modified-type="PyBuffer"/>
<conversion-rule class="target">
- PyObject *%out = Shiboken::Buffer::newObject(%in, size);
+ <insert-template name="const_char_pybuffer"/>
</conversion-rule>
<conversion-rule class="native">
- Py_ssize_t bufferLen;
- char *%out = reinterpret_cast&lt;char*&gt;(Shiboken::Buffer::getPointer(%PYARG_1, &amp;bufferLen));
+ <insert-template name="pybuffer_const_char"/>
</conversion-rule>
</modify-argument>
<modify-argument index="2">
<remove-argument/>
<conversion-rule class="native">
- uint %out = bufferLen;
+ <insert-template name="uint_remove"/>
</conversion-rule>
</modify-argument>
</modify-function>
@@ -506,13 +444,13 @@
<!-- ### -->
<add-function signature="__iter__()" return-type="PyObject*">
<inject-code class="target" position="beginning">
- <insert-template name="__iter__" />
+ <insert-template name="__iter__"/>
</inject-code>
</add-function>
<add-function signature="__next__()" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="__next__">
- <replace from="%CPPSELF_TYPE" to="QTextBlock::iterator" />
+ <replace from="%CPPSELF_TYPE" to="QTextBlock::iterator"/>
</insert-template>
</inject-code>
</add-function>
@@ -520,48 +458,34 @@
<add-function signature="__iter__()" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="__iter_parent__">
- <replace from="%CPPSELF_TYPE" to="QTextBlock::iterator" />
+ <replace from="%CPPSELF_TYPE" to="QTextBlock::iterator"/>
</insert-template>
</inject-code>
</add-function>
<modify-function signature="setUserData(QTextBlockUserData*)">
- <inject-code class="target" position="end">
- const QTextDocument *doc = %CPPSELF.document();
- if (doc) {
- Shiboken::AutoDecRef pyDocument(%CONVERTTOPYTHON[QTextDocument*](doc));
- Shiboken::Object::setParent(pyDocument, %PYARG_1);
- }
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtgui.cpp" snippet="qtextblock-setuserdata"/>
</modify-function>
<modify-function signature="userData()const">
<modify-argument index="return">
<define-ownership class="target" owner="default"/>
</modify-argument>
- <inject-code class="target" position="end">
- const QTextDocument *doc = %CPPSELF.document();
- if (doc) {
- Shiboken::AutoDecRef pyDocument(%CONVERTTOPYTHON[QTextDocument*](doc));
- Shiboken::Object::setParent(pyDocument, %PYARG_0);
- }
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtgui.cpp" snippet="qtextblock-userdata"/>
</modify-function>
</value-type>
<value-type name="QTextBlockFormat">
<enum-type name="LineHeightTypes" since="4.8" revision="4800"/>
</value-type>
- <value-type name="QTextTableCellFormat" />
+ <value-type name="QTextTableCellFormat"/>
<value-type name="QTextCharFormat" >
<enum-type name="FontPropertiesInheritanceBehavior"/>
<enum-type name="UnderlineStyle"/>
<enum-type name="VerticalAlignment"/>
- <modify-function signature="isValid()const" access="non-final"/>
</value-type>
<value-type name="QTextFormat" >
<enum-type name="FormatType"/>
<enum-type name="ObjectTypes"/>
<enum-type name="PageBreakFlag" flags="PageBreakFlags"/>
- <enum-type name="Property" />
- <modify-function signature="isValid()const" access="non-final"/>
+ <enum-type name="Property"/>
</value-type>
<value-type name="QTextListFormat">
<enum-type name="Style"/>
@@ -572,17 +496,10 @@
<include file-name="QTransform" location="global"/>
</extra-includes>
<add-function signature="__reduce__" return-type="PyObject*">
- <inject-code class="target" position="beginning">
- PyObject *points = PyList_New(%CPPSELF.count());
- for (int i = 0, max = %CPPSELF.count(); i &lt; max; ++i){
- int x, y;
- %CPPSELF.point(i, &amp;x, &amp;y);
- QPoint pt = QPoint(x, y);
- PyList_SET_ITEM(points, i, %CONVERTTOPYTHON[QPoint](pt));
- }
+ <inject-code class="target" position="beginning" file="../glue/qtgui.cpp" snippet="qpolygon-reduce">
<insert-template name="reduce_code">
- <replace from="%REDUCE_FORMAT" to="N" />
- <replace from="%REDUCE_ARGS" to="points" />
+ <replace from="%REDUCE_FORMAT" to="N"/>
+ <replace from="%REDUCE_ARGS" to="points"/>
</insert-template>
</inject-code>
</add-function>
@@ -592,18 +509,10 @@
<!-- ### A QVector parameter, for no defined type, will generate wrong code. -->
<modify-function signature="operator+=(QVector&lt;QPoint&gt;)" remove="all"/>
<modify-function signature="operator&lt;&lt;(QPoint)">
- <inject-code>
- // %FUNCTION_NAME()
- *%CPPSELF &lt;&lt; %1;
- %PYARG_0 = %CONVERTTOPYTHON[QPolygon*](%CPPSELF);
- </inject-code>
+ <inject-code file="../glue/qtgui.cpp" snippet="qpolygon-operatorlowerlower"/>
</modify-function>
<modify-function signature="operator&lt;&lt;(QVector&lt;QPoint&gt;)">
- <inject-code>
- // %FUNCTION_NAME()
- *%CPPSELF &lt;&lt; %1;
- %PYARG_0 = %CONVERTTOPYTHON[QPolygon*](%CPPSELF);
- </inject-code>
+ <inject-code file="../glue/qtgui.cpp" snippet="qpolygon-operatorlowerlower"/>
</modify-function>
<!-- ### -->
</value-type>
@@ -631,26 +540,6 @@
</modify-function>
</value-type>
- <template name="load_xpm">
- Shiboken::AutoDecRef strList(PySequence_Fast(%PYARG_1, "Invalid sequence."));
- int lineCount = PySequence_Fast_GET_SIZE(strList.object());
- for (int line = 0; line &lt; lineCount; ++line) {
- if (!Shiboken::String::check(PySequence_Fast_GET_ITEM(strList.object(), line))) {
- PyErr_SetString(PyExc_TypeError, "The argument must be a sequence of strings.");
- break;
- }
- }
-
- const char **xpm = reinterpret_cast&lt;const char**&gt;(malloc(lineCount * sizeof(const char**)));
- for (int line = 0; line &lt; lineCount; ++line)
- xpm[line] = Shiboken::String::toCString(PySequence_Fast_GET_ITEM(strList.object(), line));
-
- %BEGIN_ALLOW_THREADS
- %0 = new %TYPE(xpm);
- %END_ALLOW_THREADS
-
- free(xpm);
- </template>
<value-type name="QPixmap" >
<!--<conversion-rule>-->
<!--<target-to-native replace="no">-->
@@ -664,16 +553,14 @@
<modify-argument index="1">
<rename to="image"/>
</modify-argument>
- <inject-code class="target" position="beginning">
- %0 = new %TYPE(QPixmap::fromImage(%1));
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtgui.cpp" snippet="qpixmap"/>
</add-function>
- <modify-function signature="QPixmap(const char*[])">
+ <modify-function signature="QPixmap(const char*const[])">
<modify-argument index="1">
- <replace-type modified-type="PySequence" />
+ <replace-type modified-type="PySequence"/>
</modify-argument>
<inject-code class="target" position="beginning">
- <insert-template name="load_xpm" />
+ <insert-template name="load_xpm"/>
</inject-code>
</modify-function>
@@ -681,16 +568,28 @@
<modify-function signature="operator!()const" remove="all"/>
<modify-function signature="loadFromData(const uchar*,uint,const char*,QFlags&lt;Qt::ImageConversionFlag&gt;)">
+ <inject-documentation format="target" mode="append">
+ This method must be used with an QPixmap object, not the class:
+
+ ::
+
+ # Wrong
+ pixmap = QPixmap.loadFromData(...)
+
+ # Right
+ pixmap = QPixmap().loadFromData(...)
+
+ </inject-documentation>
<modify-argument index="1">
<replace-type modified-type="PyBytes"/>
<conversion-rule class="native">
- const uchar *%out = reinterpret_cast&lt;const uchar*>(PyBytes_AS_STRING(%PYARG_1));
+ <insert-template name="pybytes_const_uchar"/>
</conversion-rule>
</modify-argument>
<modify-argument index="2">
<remove-argument/>
<conversion-rule class="native">
- uint %out = static_cast&lt;uint>(PyBytes_Size(%PYARG_1));
+ <insert-template name="pybytes_uint"/>
</conversion-rule>
</modify-argument>
</modify-function>
@@ -705,7 +604,7 @@
<enum-type name="SelectionType"/>
<modify-function signature="selectedTableCells(int*,int*,int*,int*)const">
<modify-argument index="0">
- <replace-type modified-type="PyObject" />
+ <replace-type modified-type="PyObject"/>
</modify-argument>
<modify-argument index="1">
<remove-argument/>
@@ -721,12 +620,12 @@
</modify-argument>
<inject-code class="target" position="beginning">
<insert-template name="fix_number*,number*,number*,number*">
- <replace from="$TYPE" to="int" />
+ <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" />
+ <replace from="$TYPE" to="int"/>
</insert-template>
</inject-code>
</modify-function>
@@ -755,9 +654,9 @@
<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_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()" />
+ to="%CPPSELF.m11(), %CPPSELF.m12(), %CPPSELF.m21(), %CPPSELF.m22(), %CPPSELF.dx(), %CPPSELF.dy()"/>
</insert-template>
</inject-code>
</add-function>
@@ -765,18 +664,11 @@
<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()" />
+ <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>
- <template name="qmatrix_map">
- %ARG1_TYPE a, b;
- %CPPSELF.%FUNCTION_NAME(%1, %2, &amp;a, &amp;b);
- %PYARG_0 = PyTuple_New(2);
- PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%ARG1_TYPE](a));
- PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[%ARG1_TYPE](b));
- </template>
<modify-function signature="map(int,int,int*,int*)const">
<modify-argument index="3">
<remove-argument />
@@ -785,7 +677,7 @@
<remove-argument />
</modify-argument>
<inject-code>
- <insert-template name="qmatrix_map" />
+ <insert-template name="qmatrix_map"/>
</inject-code>
</modify-function>
<modify-function signature="map(qreal,qreal,qreal*,qreal*)const">
@@ -796,9 +688,15 @@
<remove-argument />
</modify-argument>
<inject-code>
- <insert-template name="qmatrix_map" />
+ <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/>
@@ -812,15 +710,15 @@
</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" />
+ <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"/>
<value-type name="QFont" >
<enum-type name="Capitalization"/>
<enum-type name="SpacingType"/>
<enum-type name="Stretch"/>
<enum-type name="Style"/>
- <enum-type name="StyleHint" />
+ <enum-type name="StyleHint"/>
<enum-type name="StyleStrategy"/>
<enum-type name="Weight"/>
<enum-type name="HintingPreference" since="4.8" revision="4800"/>
@@ -843,7 +741,7 @@
<include file-name="QImage" location="global"/>
</extra-includes>
</function> -->
- <primitive-type name="QImageCleanupFunction" />
+ <primitive-type name="QImageCleanupFunction"/>
<value-type name="QImage">
<enum-type name="Format"/>
<enum-type name="InvertMode"/>
@@ -852,17 +750,13 @@
<include file-name="QMatrix" location="global"/>
</extra-includes>
- <template name="qimage_buffer_constructor">
- uchar *ptr = reinterpret_cast&lt;uchar*&gt;(Shiboken::Buffer::getPointer(%PYARG_1));
- %0 = new %TYPE(ptr, %ARGS);
- </template>
<modify-function signature="QImage(uchar*,int,int,int,QImage::Format,QImageCleanupFunction,void*)">
<modify-argument index="1">
<replace-type modified-type="PyBuffer"/>
</modify-argument>
<inject-code>
<insert-template name="qimage_buffer_constructor">
- <replace from="%ARGS" to="%2, %3, %4, %5" />
+ <replace from="%ARGS" to="%2, %3, %4, %5"/>
</insert-template>
</inject-code>
</modify-function>
@@ -872,7 +766,7 @@
</modify-argument>
<inject-code>
<insert-template name="qimage_buffer_constructor">
- <replace from="%ARGS" to="%2, %3, %4" />
+ <replace from="%ARGS" to="%2, %3, %4"/>
</insert-template>
</inject-code>
</modify-function>
@@ -880,61 +774,52 @@
<add-function signature="QImage(QString&amp;,int,int,int,QImage::Format)">
<inject-code>
<insert-template name="qimage_buffer_constructor">
- <replace from="%ARGS" to="%2, %3, %4, %5" />
+ <replace from="%ARGS" to="%2, %3, %4, %5"/>
</insert-template>
</inject-code>
</add-function>
<add-function signature="QImage(QString&amp;,int,int,QImage::Format)">
<inject-code>
<insert-template name="qimage_buffer_constructor">
- <replace from="%ARGS" to="%2, %3, %4" />
+ <replace from="%ARGS" to="%2, %3, %4"/>
</insert-template>
</inject-code>
</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,QImage::Format,QImageCleanupFunction,void*)" remove="all" />
+ <modify-function signature="QImage(const uchar*,int,int,QImage::Format,QImageCleanupFunction,void*)" remove="all"/>
<!-- ### -->
- <modify-function signature="QImage(const char*[])">
+ <modify-function signature="QImage(const char*const[])">
<modify-argument index="1">
- <replace-type modified-type="PySequence" />
+ <replace-type modified-type="PySequence"/>
</modify-argument>
<inject-code class="target" position="beginning">
- <insert-template name="load_xpm" />
+ <insert-template name="load_xpm"/>
</inject-code>
</modify-function>
<!-- ### There is already an fromData with a QByteArray type (that is convertible from Python's str) as the first type. -->
<modify-function signature="fromData(const uchar*,int,const char*)" remove="all"/>
<!-- ### There is already an loadFromData with a QByteArray type (that is convertible from Python's str) as the first type. -->
- <modify-function signature="loadFromData(const uchar*,int,const char*)" remove="all" />
+ <modify-function signature="loadFromData(const uchar*,int,const char*)" remove="all"/>
<modify-function signature="constBits()const" since="4.7">
- <inject-code>
- %PYARG_0 = Shiboken::Buffer::newObject(%CPPSELF.%FUNCTION_NAME(), %CPPSELF.byteCount());
- </inject-code>
+ <inject-code file="../glue/qtgui.cpp" snippet="qimage-constbits"/>
</modify-function>
<modify-function signature="bits()">
- <inject-code>
- // byteCount() is only available on Qt4.7, so we use bytesPerLine * height
- %PYARG_0 = Shiboken::Buffer::newObject(%CPPSELF.%FUNCTION_NAME(), %CPPSELF.bytesPerLine() * %CPPSELF.height(), Shiboken::Buffer::ReadWrite);
- </inject-code>
+ <inject-code file="../glue/qtgui.cpp" snippet="qimage-bits"/>
</modify-function>
<modify-function signature="constScanLine(int)const" since="4.7">
- <inject-code>
- %PYARG_0 = Shiboken::Buffer::newObject(%CPPSELF.%FUNCTION_NAME(%1), %CPPSELF.bytesPerLine());
- </inject-code>
+ <inject-code file="../glue/qtgui.cpp" snippet="qimage-constscanline"/>
<modify-argument index="return">
- <replace-type modified-type="PyObject" />
+ <replace-type modified-type="PyObject"/>
</modify-argument>
</modify-function>
<modify-function signature="scanLine(int)">
- <inject-code>
- %PYARG_0 = Shiboken::Buffer::newObject(%CPPSELF.%FUNCTION_NAME(%1), %CPPSELF.bytesPerLine(), Shiboken::Buffer::ReadWrite);
- </inject-code>
+ <inject-code file="../glue/qtgui.cpp" snippet="qimage-scanline"/>
<modify-argument index="return">
- <replace-type modified-type="PyObject" />
+ <replace-type modified-type="PyObject"/>
</modify-argument>
</modify-function>
<!--
@@ -961,8 +846,8 @@
<extra-includes>
<include file-name="QStringList" location="global"/>
</extra-includes>
- <enum-type name="SystemFont" />
- <enum-type name="WritingSystem" />
+ <enum-type name="SystemFont"/>
+ <enum-type name="WritingSystem"/>
</value-type>
<value-type name="QPen">
<extra-includes>
@@ -975,48 +860,6 @@
</extra-includes>
</value-type>
- <template name="qcolor_repr">
- switch(%CPPSELF.spec()) {
- case QColor::Rgb:
- {
- qreal r, g, b, a;
- %CPPSELF.getRgbF(&amp;r, &amp;g, &amp;b, &amp;a);
- QString repr = QString().sprintf("PySide2.QtGui.QColor.fromRgbF(%.6f, %.6f, %.6f, %.6f)", r, g, b, a);
- %PYARG_0 = Shiboken::String::fromCString(qPrintable(repr));
- break;
- }
- case QColor::Hsv:
- {
- qreal h, s, v, a;
- %CPPSELF.getHsvF(&amp;h, &amp;s, &amp;v, &amp;a);
- QString repr = QString().sprintf("PySide2.QtGui.QColor.fromHsvF(%.6f, %.6f, %.6f, %.6f)", h, s, v, a);
- %PYARG_0 = Shiboken::String::fromCString(qPrintable(repr));
- break;
- }
- case QColor::Cmyk:
- {
- qreal c, m, y, k, a;
- %CPPSELF.getCmykF(&amp;c, &amp;m, &amp;y, &amp;k, &amp;a);
- QString repr = QString().sprintf("PySide2.QtGui.QColor.fromCmykF(%.6f, %.6f, %.6f, %.6f, %.6f)", c, m, y, k, a);
- %PYARG_0 = Shiboken::String::fromCString(qPrintable(repr));
- break;
- }
- #if QT_VERSION >= 0x040600
- case QColor::Hsl:
- {
- qreal h, s, l, a;
- %CPPSELF.getHslF(&amp;h, &amp;s, &amp;l, &amp;a);
- QString repr = QString().sprintf("PySide2.QtGui.QColor.fromHslF(%.6f, %.6f, %.6f, %.6f)", h, s, l, a);
- %PYARG_0 = Shiboken::String::fromCString(qPrintable(repr));
- break;
- }
- #endif
- default:
- {
- %PYARG_0 = Shiboken::String::fromCString("PySide2.QtGui.QColor()");
- }
- }
- </template>
<value-type name="QColor">
<enum-type name="NameFormat"/>
<enum-type name="Spec"/>
@@ -1025,117 +868,36 @@
</extra-includes>
<add-function signature="__repr__" return-type="PyObject*">
<inject-code class="target" position="beginning">
- <insert-template name="qcolor_repr" />
+ <insert-template name="qcolor_repr"/>
</inject-code>
</add-function>
<add-function signature="__str__" return-type="PyObject*">
<inject-code class="target" position="beginning">
- <insert-template name="qcolor_repr" />
+ <insert-template name="qcolor_repr"/>
</inject-code>
</add-function>
<add-function signature="__setstate__(PyObject*)" return-type="PyObject">
- <inject-code>
- Shiboken::AutoDecRef func(PyObject_GetAttr(%PYSELF, PyTuple_GET_ITEM(%1, 0)));
- PyObject *args = PyTuple_GET_ITEM(%1, 1);
- %PYARG_0 = PyObject_Call(func, args, NULL);
- </inject-code>
+ <inject-code file="../glue/qtgui.cpp" snippet="qcolor-setstate"/>
</add-function>
<add-function signature="__reduce__" return-type="PyObject">
- <inject-code class="target" position="beginning">
- switch(%CPPSELF.spec()) {
- case QColor::Rgb:
- {
- qreal r, g, b, a;
- %CPPSELF.getRgbF(&amp;r, &amp;g, &amp;b, &amp;a);
- %PYARG_0 = Py_BuildValue("(ON(s(ffff)))", Py_TYPE(%PYSELF), PyTuple_New(0), "setRgbF", (float)r, (float)g, (float)b, (float)a);
- break;
- }
- case QColor::Hsv:
- {
- qreal h, s, v, a;
- %CPPSELF.getHsvF(&amp;h, &amp;s, &amp;v, &amp;a);
- %PYARG_0 = Py_BuildValue("(ON(s(ffff)))", Py_TYPE(%PYSELF), PyTuple_New(0), "setHsvF", (float)h, (float)s, (float)v, (float)a);
- break;
- }
- case QColor::Cmyk:
- {
- qreal c, m, y, k, a;
- %CPPSELF.getCmykF(&amp;c, &amp;m, &amp;y, &amp;k, &amp;a);
- %PYARG_0 = Py_BuildValue("(ON(s(fffff)))", Py_TYPE(%PYSELF), PyTuple_New(0), "setCmykF", (float)c, (float)m, (float)y, (float)k, (float)a);
- break;
- }
- #if QT_VERSION >= 0x040600
- case QColor::Hsl:
- {
- qreal h, s, l, a;
- %CPPSELF.getHslF(&amp;h, &amp;s, &amp;l, &amp;a);
- %PYARG_0 = Py_BuildValue("(ON(s(ffff)))", Py_TYPE(%PYSELF), PyTuple_New(0), "setHslF", (float)h, (float)s, (float)l, (float)a);
- break;
- }
- #endif
- default:
- {
- %PYARG_0 = Py_BuildValue("(N(O))", PyObject_Type(%PYSELF), Py_None);
- }
- }
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtgui.cpp" snippet="qcolor-reduce"/>
</add-function>
<add-function signature="toTuple" return-type="PyObject">
- <inject-code class="target" position="beginning">
- switch(%CPPSELF.spec()) {
- case QColor::Rgb:
- {
- int r, g, b, a;
- %CPPSELF.getRgb(&amp;r, &amp;g, &amp;b, &amp;a);
- %PYARG_0 = Py_BuildValue("iiii", r, g, b, a);
- break;
- }
- case QColor::Hsv:
- {
- int h, s, v, a;
- %CPPSELF.getHsv(&amp;h, &amp;s, &amp;v, &amp;a);
- %PYARG_0 = Py_BuildValue("iiii", h, s, v, a);
- break;
- }
- case QColor::Cmyk:
- {
- int c, m, y, k, a;
- %CPPSELF.getCmyk(&amp;c, &amp;m, &amp;y, &amp;k, &amp;a);
- %PYARG_0 = Py_BuildValue("iiiii", c, m, y, k, a);
- break;
- }
- case QColor::Hsl:
- {
- int h, s, l, a;
- %CPPSELF.getHsl(&amp;h, &amp;s, &amp;l, &amp;a);
- %PYARG_0 = Py_BuildValue("iiii", h, s, l, a);
- break;
- }
- default:
- {
- %PYARG_0 = 0;
- }
- }
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtgui.cpp" snippet="qcolor-totuple"/>
</add-function>
<!-- ### "QColor(QColor::Spec)" is an internal method. -->
<modify-function signature="QColor(QColor::Spec)" remove="all"/>
<!-- ### Constructor removed because we already have an overload using QString. -->
- <modify-function signature="QColor(const char*)" remove="all" />
+ <modify-function signature="QColor(const char*)" remove="all"/>
<!-- ### -->
<add-function signature="QColor(QVariant)">
- <inject-code class="target" position="beginning">
- if (%1.type() == QVariant::Color)
- %0 = new %TYPE(%1.value&lt;QColor>());
- else
- PyErr_SetString(PyExc_TypeError, "QVariant must be holding a QColor");
- </inject-code>
+ <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-argument index="0">
- <replace-type modified-type="PyObject *" />
+ <replace-type modified-type="PyObject *"/>
</modify-argument>
<modify-argument index="1">
<remove-argument/>
@@ -1156,13 +918,13 @@
<inject-code class="target" position="beginning">
<insert-template name="fix_number*,number*,number*,number*,number*">
- <replace from="$TYPE" to="int" />
+ <replace from="$TYPE" to="int"/>
</insert-template>
</inject-code>
</modify-function>
<modify-function signature="getCmykF(qreal*,qreal*,qreal*,qreal*,qreal*)">
<modify-argument index="0">
- <replace-type modified-type="PyObject *" />
+ <replace-type modified-type="PyObject *"/>
</modify-argument>
<modify-argument index="1">
<remove-argument/>
@@ -1183,13 +945,13 @@
<inject-code class="target" position="beginning">
<insert-template name="fix_number*,number*,number*,number*,number*">
- <replace from="$TYPE" to="qreal" />
+ <replace from="$TYPE" to="qreal"/>
</insert-template>
</inject-code>
</modify-function>
<modify-function signature="getHsl(int*,int*,int*,int*)const" since="4.6">
<modify-argument index="0">
- <replace-type modified-type="PyObject *" />
+ <replace-type modified-type="PyObject *"/>
</modify-argument>
<modify-argument index="1">
<remove-argument/>
@@ -1206,13 +968,13 @@
</modify-argument>
<inject-code class="target" position="beginning">
<insert-template name="fix_number*,number*,number*,number*">
- <replace from="$TYPE" to="int" />
+ <replace from="$TYPE" to="int"/>
</insert-template>
</inject-code>
</modify-function>
<modify-function signature="getHslF(qreal*,qreal*,qreal*,qreal*)const" since="4.6">
<modify-argument index="0">
- <replace-type modified-type="PyObject *" />
+ <replace-type modified-type="PyObject *"/>
</modify-argument>
<modify-argument index="1">
<remove-argument/>
@@ -1229,13 +991,13 @@
</modify-argument>
<inject-code class="target" position="beginning">
<insert-template name="fix_number*,number*,number*,number*">
- <replace from="$TYPE" to="qreal" />
+ <replace from="$TYPE" to="qreal"/>
</insert-template>
</inject-code>
</modify-function>
<modify-function signature="getHsv(int*,int*,int*,int*)const">
<modify-argument index="0">
- <replace-type modified-type="PyObject *" />
+ <replace-type modified-type="PyObject *"/>
</modify-argument>
<modify-argument index="1">
<remove-argument/>
@@ -1252,13 +1014,13 @@
</modify-argument>
<inject-code class="target" position="beginning">
<insert-template name="fix_number*,number*,number*,number*">
- <replace from="$TYPE" to="int" />
+ <replace from="$TYPE" to="int"/>
</insert-template>
</inject-code>
</modify-function>
<modify-function signature="getHsvF(qreal*,qreal*,qreal*,qreal*)const">
<modify-argument index="0">
- <replace-type modified-type="PyObject *" />
+ <replace-type modified-type="PyObject *"/>
</modify-argument>
<modify-argument index="1">
<remove-argument/>
@@ -1275,13 +1037,13 @@
</modify-argument>
<inject-code class="target" position="beginning">
<insert-template name="fix_number*,number*,number*,number*">
- <replace from="$TYPE" to="qreal" />
+ <replace from="$TYPE" to="qreal"/>
</insert-template>
</inject-code>
</modify-function>
<modify-function signature="getRgb(int*,int*,int*,int*)const">
<modify-argument index="0">
- <replace-type modified-type="PyObject *" />
+ <replace-type modified-type="PyObject *"/>
</modify-argument>
<modify-argument index="1">
<remove-argument/>
@@ -1298,13 +1060,13 @@
</modify-argument>
<inject-code class="target" position="beginning">
<insert-template name="fix_number*,number*,number*,number*">
- <replace from="$TYPE" to="int" />
+ <replace from="$TYPE" to="int"/>
</insert-template>
</inject-code>
</modify-function>
<modify-function signature="getRgbF(qreal*,qreal*,qreal*,qreal*)const">
<modify-argument index="0">
- <replace-type modified-type="PyObject *" />
+ <replace-type modified-type="PyObject *"/>
</modify-argument>
<modify-argument index="1">
<remove-argument/>
@@ -1321,7 +1083,7 @@
</modify-argument>
<inject-code class="target" position="beginning">
<insert-template name="fix_number*,number*,number*,number*">
- <replace from="$TYPE" to="qreal" />
+ <replace from="$TYPE" to="qreal"/>
</insert-template>
</inject-code>
</modify-function>
@@ -1350,56 +1112,14 @@
<modify-argument index="5">
<replace-type modified-type="PyObject"/>
</modify-argument>
- <inject-code class="target" position="beginning">
- int *array = nullptr;
- bool errorOccurred = false;
-
- if (numArgs == 5) {
- array = Shiboken::sequenceToIntArray(%PYARG_5, true);
- if (PyErr_Occurred()) {
- if (array)
- delete []array;
- errorOccurred = true;
- }
- }
-
- if (!errorOccurred) {
- %RETURN_TYPE retval = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, array);
-
- if (array)
- delete []array;
-
- %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](retval);
- }
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtgui.cpp" snippet="qfontmetricsf-boundingrect"/>
</modify-function>
<modify-function signature="size(int,QString,int,int*)const">
<modify-argument index="4">
<replace-type modified-type="PyObject"/>
</modify-argument>
- <inject-code class="target" position="beginning">
- int *array = nullptr;
- bool errorOccurred = false;
-
- if (numArgs == 4) {
- array = Shiboken::sequenceToIntArray(%PYARG_4, true);
- if (PyErr_Occurred()) {
- if (array)
- delete []array;
- errorOccurred = true;
- }
- }
-
- if (!errorOccurred) {
- %RETURN_TYPE retval = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, array);
-
- if (array)
- delete []array;
-
- %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](retval);
- }
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtgui.cpp" snippet="qfontmetricsf-size"/>
</modify-function>
</value-type>
<value-type name="QFontMetrics" >
@@ -1426,107 +1146,44 @@
<modify-argument index="8">
<replace-type modified-type="PyObject"/>
</modify-argument>
- <inject-code class="target" position="beginning">
- int *array = nullptr;
- bool errorOccurred = false;
-
- if (numArgs == 8) {
- array = Shiboken::sequenceToIntArray(%PYARG_8, true);
- if (PyErr_Occurred()) {
- if (array)
- delete []array;
- errorOccurred = true;
- }
- }
-
- if (!errorOccurred) {
- %RETURN_TYPE retval = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, %5, %6, %7, array);
-
- if (array)
- delete []array;
-
- %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](retval);
- }
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtgui.cpp" snippet="qfontmetrics-boundingrect-1"/>
</modify-function>
<modify-function signature="boundingRect(QRect,int,QString,int,int*)const">
<modify-argument index="5">
<replace-type modified-type="PyObject"/>
</modify-argument>
- <inject-code class="target" position="beginning">
- int *array = nullptr;
- bool errorOccurred = false;
-
- if (numArgs == 5) {
- array = Shiboken::sequenceToIntArray(%PYARG_5, true);
- if (PyErr_Occurred()) {
- if (array)
- delete []array;
- errorOccurred = true;
- }
- }
-
- if (!errorOccurred) {
- %RETURN_TYPE retval = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4, array);
-
- if (array)
- delete []array;
-
- %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](retval);
- }
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtgui.cpp" snippet="qfontmetrics-boundingrect-2"/>
</modify-function>
<modify-function signature="size(int,QString,int,int*)const">
<modify-argument index="4">
<replace-type modified-type="PyObject"/>
</modify-argument>
- <inject-code class="target" position="beginning">
- int *array = nullptr;
- bool errorOccurred = false;
-
- if (numArgs == 4) {
- array = Shiboken::sequenceToIntArray(%PYARG_4, true);
- if (PyErr_Occurred()) {
- if (array)
- delete []array;
- errorOccurred = true;
- }
- }
-
- if (!errorOccurred) {
- %RETURN_TYPE retval = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, array);
-
- if (array)
- delete []array;
-
- %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](retval);
- }
-
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtgui.cpp" snippet="qfontmetrics-size"/>
</modify-function>
</value-type>
- <value-type name="QGradient" force-abstract="yes" polymorphic-id-expression="%1-&gt;type() == QGradient::NoGradient">
+ <value-type name="QGradient" polymorphic-id-expression="%1-&gt;type() == QGradient::NoGradient">
<enum-type name="CoordinateMode"/>
<enum-type name="InterpolationMode"/>
- <enum-type name="Spread" lower-bound="QGradient.PadSpread" upper-bound="QGradient.RepeatSpread"/>
+ <enum-type name="Preset" since="5.12"/>
+ <enum-type name="Spread"/>
<enum-type name="Type"/>
</value-type>
- <value-type name="QLinearGradient" polymorphic-id-expression="%1-&gt;type() == QGradient::LinearGradient" />
+ <value-type name="QLinearGradient" polymorphic-id-expression="%1-&gt;type() == QGradient::LinearGradient"/>
<object-type name="QPaintDevice">
<enum-type name="PaintDeviceMetric"/>
</object-type>
<object-type name="QPagedPaintDevice">
- <value-type name="Margins" />
- <enum-type name="PageSize" />
+ <value-type name="Margins"/>
+ <enum-type name="PageSize"/>
<enum-type name="PdfVersion" since="5.10"/>
</object-type>
<object-type name="QAbstractTextDocumentLayout">
<value-type name="PaintContext" >
<include file-name="QAbstractTextDocumentLayout" location="global"/>
</value-type>
- <value-type name="Selection" />
+ <value-type name="Selection"/>
<modify-function signature="setPaintDevice(QPaintDevice*)">
<modify-argument index="1">
<parent index="this" action="add"/>
@@ -1539,15 +1196,15 @@
<modify-argument index="1" invalidate-after-use="yes"/>
</modify-function>
</object-type>
- <object-type name="QPyTextObject" />
+ <object-type name="QPyTextObject"/>
- <object-type name="QDesktopServices" since="4.2" />
+ <object-type name="QDesktopServices" since="4.2"/>
<object-type name="QDoubleValidator">
<enum-type name="Notation"/>
</object-type>
<object-type name="QIconEngine">
- <object-type name="AvailableSizesArgument" />
- <enum-type name="IconEngineHook" />
+ <object-type name="AvailableSizesArgument"/>
+ <enum-type name="IconEngineHook"/>
<modify-function signature="paint(QPainter*,QRect,QIcon::Mode,QIcon::State)">
<modify-argument index="1" invalidate-after-use="yes"/>
</modify-function>
@@ -1569,7 +1226,7 @@
</modify-function>
<modify-function signature="write(const QImage&amp;)" allow-thread="yes"/>
</object-type>
- <object-type name="QIntValidator" />
+ <object-type name="QIntValidator"/>
<object-type name="QPainterPathStroker" copyable="false"/>
<object-type name="QPictureIO">
@@ -1582,19 +1239,11 @@
<object-type name="QPixmapCache">
<value-type name="Key"/>
<add-function signature="find(QPixmapCache::Key&amp;)">
- <inject-code>
- QPixmap p;
- if (%CPPSELF.%FUNCTION_NAME(%1, &amp;p)) {
- %PYARG_0 = %CONVERTTOPYTHON[QPixmap](p);
- } else {
- %PYARG_0 = Py_None;
- Py_INCREF(%PYARG_0);
- }
- </inject-code>
+ <inject-code file="../glue/qtgui.cpp" snippet="qpixmapcache-find"/>
</add-function>
</object-type>
- <object-type name="QRegExpValidator" />
+ <object-type name="QRegExpValidator"/>
<object-type name="QStandardItem">
<enum-type name="ItemType"/>
@@ -1646,27 +1295,13 @@
</modify-function>
<modify-function signature="setChild(int,int,QStandardItem*)">
- <inject-code class="target" position="beginning">
- // Clear parent from the old child
- QStandardItem *_i = %CPPSELF->child(%1, %2);
- if (_i) {
- PyObject *_pyI = %CONVERTTOPYTHON[QStandardItem*](_i);
- Shiboken::Object::setParent(0, _pyI);
- }
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtgui.cpp" snippet="qstandarditem-setchild-1"/>
<modify-argument index="3">
<parent index="this" action="add"/>
</modify-argument>
</modify-function>
<modify-function signature="setChild(int,QStandardItem*)">
- <inject-code class="target" position="beginning">
- // Clear parent from the old child
- QStandardItem *_i = %CPPSELF->child(%1);
- if (_i) {
- PyObject *_pyI = %CONVERTTOPYTHON[QStandardItem*](_i);
- Shiboken::Object::setParent(0, _pyI);
- }
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtgui.cpp" snippet="qstandarditem-setchild-2"/>
<modify-argument index="2">
<parent index="this" action="add"/>
</modify-argument>
@@ -1705,8 +1340,8 @@
</modify-argument>
</modify-function>
</object-type>
- <object-type name="QTextBlockGroup" />
- <object-type name="QTextBlockUserData" />
+ <object-type name="QTextBlockGroup"/>
+ <object-type name="QTextBlockUserData"/>
<object-type name="QTextItem">
<enum-type name="RenderFlag" flags="RenderFlags"/>
</object-type>
@@ -1721,42 +1356,6 @@
</modify-function>
</object-type>
- <template name="validator_conversionrule">
- QValidator::State %out;
-
- if (PySequence_Check(%PYARG_0)) {
- Shiboken::AutoDecRef seq(PySequence_Fast(%PYARG_0, 0));
- int size = PySequence_Fast_GET_SIZE(seq.object());
-
- if (size > 1) {
- if (%ISCONVERTIBLE[QString](PySequence_Fast_GET_ITEM(seq.object(), 1)))
- %1 = %CONVERTTOCPP[QString](PySequence_Fast_GET_ITEM(seq.object(), 1));
- else
- qWarning("%TYPE::%FUNCTION_NAME: Second tuple element is not convertible to unicode.");
- }
-
- if (size > 2) {
- if (%ISCONVERTIBLE[int](PySequence_Fast_GET_ITEM(seq.object(), 2)))
- %2 = %CONVERTTOCPP[int](PySequence_Fast_GET_ITEM(seq.object(), 2));
- else
- qWarning("%TYPE::%FUNCTION_NAME: Second tuple element is not convertible to int.");
- }
- %PYARG_0 = PySequence_Fast_GET_ITEM(seq.object(), 0);
- Py_INCREF(%PYARG_0); // we need to incref, because "%PYARG_0 = ..." will decref the tuple and the tuple will be decrefed again at the end of this scope.
- }
-
- // check retrun value
- if (%ISCONVERTIBLE[QValidator::State](%PYARG_0)) {
- %out = %CONVERTTOCPP[QValidator::State](%PYARG_0);
- } else {
- PyErr_Format(PyExc_TypeError, "Invalid return value in function %s, expected %s, got %s.",
- "QValidator.validate",
- "PySide2.QtGui.QValidator.State, (PySide2.QtGui.QValidator.State,), (PySide2.QtGui.QValidator.State, unicode) or (PySide2.QtGui.QValidator.State, unicode, int)",
- Py_TYPE(pyResult)->tp_name);
- return QValidator::State();
- }
- </template>
-
<object-type name="QValidator">
<enum-type name="State"/>
<modify-function signature="fixup(QString &amp;)const">
@@ -1766,9 +1365,7 @@
<inject-code class="native" position="end">
<insert-template name="return_QString_native"/>
</inject-code>
- <inject-code class="target" position="end">
- <insert-template name="return_QString"/>
- </inject-code>
+ <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="qstring-return"/>
</modify-function>
<modify-function signature="validate(QString &amp;,int &amp;)const">
<modify-argument index="return">
@@ -1783,25 +1380,26 @@
</modify-function>
</object-type>
- <object-type name="QActionEvent" polymorphic-id-expression="%1-&gt;type() == QEvent::ActionAdded || %1-&gt;type() == QEvent::ActionRemoved || %1-&gt;type() == QEvent::ActionChanged" />
+ <object-type name="QActionEvent" polymorphic-id-expression="%1-&gt;type() == QEvent::ActionAdded || %1-&gt;type() == QEvent::ActionRemoved || %1-&gt;type() == QEvent::ActionChanged"/>
<object-type name="QCloseEvent" polymorphic-id-expression="%1-&gt;type() == QEvent::Close"/>
<object-type name="QContextMenuEvent" polymorphic-id-expression="%1-&gt;type() == QEvent::ContextMenu">
<enum-type name="Reason"/>
</object-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" />
+ <object-type name="QDragMoveEvent" polymorphic-id-expression="%1-&gt;type() == QEvent::DragMove"/>
<object-type name="QDropEvent" polymorphic-id-expression="%1-&gt;type() == QEvent::Drop">
<modify-function signature="source()const">
<modify-argument index="return">
- <define-ownership class="target" owner="default" />
+ <define-ownership class="target" owner="default"/>
</modify-argument>
</modify-function>
</object-type>
<object-type name="QEnterEvent" copyable="false" polymorphic-id-expression="%1-&gt;type() == QEvent::Enter"/>
- <object-type name="QExposeEvent" polymorphic-id-expression="%1-&gt;type() == QEvent::Expose" />
- <object-type name="QFileOpenEvent" polymorphic-id-expression="%1-&gt;type() == QEvent::FileOpen" />
- <object-type name="QFocusEvent" polymorphic-id-expression="%1-&gt;type() == QEvent::FocusIn || %1-&gt;type() == QEvent::FocusOut" />
+ <object-type name="QExposeEvent" polymorphic-id-expression="%1-&gt;type() == QEvent::Expose"/>
+ <object-type name="QFileOpenEvent" polymorphic-id-expression="%1-&gt;type() == QEvent::FileOpen"/>
+ <object-type name="QFocusEvent" polymorphic-id-expression="%1-&gt;type() == QEvent::FocusIn || %1-&gt;type() == QEvent::FocusOut"/>
<object-type name="QHelpEvent" copyable="false" polymorphic-id-expression="%1-&gt;type() == QEvent::ToolTip || %1-&gt;type() == QEvent::WhatsThis"/>
<object-type name="QHideEvent" copyable="false" polymorphic-id-expression="%1-&gt;type() == QEvent::Hide"/>
<object-type name="QHoverEvent" copyable="false" polymorphic-id-expression="%1-&gt;type() == QEvent::HoverEnter || %1-&gt;type() == QEvent::HoverLeave || %1-&gt;type() == QEvent::HoverMove"/>
@@ -1817,7 +1415,7 @@
</object-type>
<object-type name="QInputMethodQueryEvent" copyable="false" polymorphic-id-expression="%1-&gt;type() == QEvent::InputMethodQuery"/>
- <object-type name="QMoveEvent" copyable = "false" polymorphic-id-expression="%1-&gt;type() == QEvent::Move" />
+ <object-type name="QMoveEvent" copyable = "false" polymorphic-id-expression="%1-&gt;type() == QEvent::Move"/>
<object-type name="QNativeGestureEvent" copyable="false" polymorphic-id-expression="%1-&gt;type() == QEvent::NativeGesture"/>
<object-type name="QResizeEvent" copyable = "false" polymorphic-id-expression="%1-&gt;type() == QEvent::Resize"/>
<object-type name="QShortcutEvent" copyable = "false" polymorphic-id-expression="%1-&gt;type() == QEvent::Shortcut">
@@ -1832,18 +1430,13 @@
<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"/>
<!-- Qt5.5: suppress this nameless enum -->
- <suppress-warning text="enum 'QWheelEvent::DefaultDeltasPerStep' does not have a type entry or is not an enum" />
+ <suppress-warning text="enum 'QWheelEvent::DefaultDeltasPerStep' does not have a type entry or is not an enum"/>
<object-type name="QWindowStateChangeEvent" copyable="false" polymorphic-id-expression="%1-&gt;type() == QEvent::WindowStateChange"/>
- <object-type name="QInputEvent" copyable="false">
- <modify-function signature="modifiers()const" access="non-final"/>
- </object-type>
+ <object-type name="QInputEvent" copyable="false"/>
<object-type name="QKeyEvent" copyable= "false" polymorphic-id-expression="%1-&gt;type() == QEvent::KeyPress || %1-&gt;type() == QEvent::KeyRelease || %1-&gt;type() == QEvent::ShortcutOverride">
<add-function signature="operator!=(QKeySequence::StandardKey)">
- <inject-code class="target">
- bool ret = !(&amp;%CPPSELF == %1);
- %PYARG_0 = %CONVERTTOPYTHON[bool](ret);
- </inject-code>
+ <inject-code class="target" file="../glue/qtgui.cpp" snippet="qkeyevent-operatornotequal"/>
</add-function>
</object-type>
<object-type name="QMouseEvent" copyable= "false" polymorphic-id-expression="%1-&gt;type() == QEvent::MouseButtonDblClick || %1-&gt;type() == QEvent::MouseButtonPress || %1-&gt;type() == QEvent::MouseButtonRelease || %1-&gt;type() == QEvent::MouseMove"/>
@@ -1867,13 +1460,13 @@
<!-- ### -->
<add-function signature="__iter__()" return-type="PyObject*">
<inject-code class="target" position="beginning">
- <insert-template name="__iter__" />
+ <insert-template name="__iter__"/>
</inject-code>
</add-function>
<add-function signature="__next__()" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="__next__">
- <replace from="%CPPSELF_TYPE" to="QTextFrame::iterator" />
+ <replace from="%CPPSELF_TYPE" to="QTextFrame::iterator"/>
</insert-template>
</inject-code>
</add-function>
@@ -1881,7 +1474,7 @@
<add-function signature="__iter__()" return-type="PyObject*">
<inject-code class="target" position="beginning">
<insert-template name="__iter_parent__">
- <replace from="%CPPSELF_TYPE" to="QTextFrame::iterator" />
+ <replace from="%CPPSELF_TYPE" to="QTextFrame::iterator"/>
</insert-template>
</inject-code>
</add-function>
@@ -1891,7 +1484,7 @@
<include file-name="QRect" location="global"/>
</extra-includes>
<enum-type name="ImageOption"/>
- <enum-type name="Transformation" flags="Transformations" since="5.5" />
+ <enum-type name="Transformation" flags="Transformations" since="5.5"/>
<modify-function signature="setDevice(QIODevice*)">
<modify-argument index="1">
<parent index="this" action="add"/>
@@ -1910,7 +1503,7 @@
<enum-type name="ImageReaderError"/>
<!-- ### This method does not make sense in Python.
Update: perhaps it does, but no one is missing it. -->
- <modify-function signature="read(QImage*)" remove="all" />
+ <modify-function signature="read(QImage*)" remove="all"/>
<modify-function signature="setDevice(QIODevice*)">
<modify-argument index="1">
<parent index="this" action="add"/>
@@ -1971,170 +1564,135 @@
</extra-includes>
<modify-function signature="takeItem(int,int)">
<modify-argument index="return">
- <parent index="this" action="remove" />
+ <parent index="this" action="remove"/>
</modify-argument>
</modify-function>
<modify-function signature="takeHorizontalHeaderItem(int)">
<modify-argument index="return">
- <parent index="this" action="remove" />
+ <parent index="this" action="remove"/>
</modify-argument>
</modify-function>
<modify-function signature="takeVerticalHeaderItem(int)">
<modify-argument index="return">
- <parent index="this" action="remove" />
+ <parent index="this" action="remove"/>
</modify-argument>
</modify-function>
<modify-function signature="verticalHeaderItem(int)const">
<modify-argument index="return">
- <parent index="this" action="add" />
+ <parent index="this" action="add"/>
</modify-argument>
</modify-function>
<modify-function signature="horizontalHeaderItem(int)const">
<modify-argument index="return">
- <parent index="this" action="add" />
+ <parent index="this" action="add"/>
</modify-argument>
</modify-function>
<modify-function signature="invisibleRootItem()const">
<modify-argument index="return">
- <parent index="this" action="add" />
+ <parent index="this" action="add"/>
</modify-argument>
</modify-function>
<modify-function signature="item(int,int)const">
<modify-argument index="return">
- <parent index="this" action="add" />
+ <parent index="this" action="add"/>
</modify-argument>
</modify-function>
<modify-function signature="itemFromIndex(const QModelIndex&amp;)const">
<modify-argument index="return">
- <parent index="this" action="add" />
+ <parent index="this" action="add"/>
</modify-argument>
</modify-function>
<modify-function signature="itemPrototype()const">
<modify-argument index="return">
- <parent index="this" action="add" />
+ <parent index="this" action="add"/>
</modify-argument>
</modify-function>
<modify-function signature="appendRow(const QList&lt;QStandardItem*&gt;&amp;)">
<modify-argument index="1">
- <parent index="this" action="add" />
+ <parent index="this" action="add"/>
</modify-argument>
</modify-function>
<modify-function signature="appendRow(QStandardItem*)">
<modify-argument index="1">
- <parent index="this" action="add" />
+ <parent index="this" action="add"/>
</modify-argument>
</modify-function>
<modify-function signature="insertRow(int,QStandardItem*)">
<modify-argument index="2">
- <parent index="this" action="add" />
+ <parent index="this" action="add"/>
</modify-argument>
</modify-function>
<modify-function signature="setHorizontalHeaderItem(int,QStandardItem*)">
<modify-argument index="2">
- <parent index="this" action="add" />
+ <parent index="this" action="add"/>
</modify-argument>
</modify-function>
<modify-function signature="setItem(int,int,QStandardItem*)">
- <inject-code class="target" position="beginning">
- // Clear parent from the old child
- QStandardItem *_i = %CPPSELF->item(%1, %2);
- if (_i) {
- PyObject *_pyI = %CONVERTTOPYTHON[QStandardItem*](_i);
- Shiboken::Object::setParent(0, _pyI);
- }
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtgui.cpp" snippet="qstandarditemmodel-setitem-1"/>
<modify-argument index="3">
- <parent index="this" action="add" />
+ <parent index="this" action="add"/>
</modify-argument>
</modify-function>
<modify-function signature="setItem(int,QStandardItem*)">
- <inject-code class="target" position="beginning">
- // Clear parent from the old child
- QStandardItem *_i = %CPPSELF->item(%1);
- if (_i) {
- PyObject *_pyI = %CONVERTTOPYTHON[QStandardItem*](_i);
- Shiboken::Object::setParent(0, _pyI);
- }
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtgui.cpp" snippet="qstandarditemmodel-setitem-2"/>
<modify-argument index="2">
- <parent index="this" action="add" />
+ <parent index="this" action="add"/>
</modify-argument>
</modify-function>
<modify-function signature="setItemPrototype(const QStandardItem*)">
<modify-argument index="1">
- <parent index="this" action="add" />
+ <parent index="this" action="add"/>
</modify-argument>
</modify-function>
<modify-function signature="setVerticalHeaderItem(int,QStandardItem*)">
- <inject-code class="target" position="beginning">
- // Clear parent from the old child
- QStandardItem *_i = %CPPSELF->verticalHeaderItem(%1);
- if (_i) {
- PyObject *_pyI = %CONVERTTOPYTHON[QStandardItem*](_i);
- Shiboken::Object::setParent(0, _pyI);
- }
- </inject-code>
+ <inject-code class="target" position="beginning" file="../glue/qtgui.cpp" snippet="qstandarditemmodel-setverticalheaderitem"/>
<modify-argument index="2">
- <parent index="this" action="add" />
+ <parent index="this" action="add"/>
</modify-argument>
</modify-function>
<modify-function signature="takeColumn(int)">
<modify-argument index="return">
- <parent index="this" action="remove" />
+ <parent index="this" action="remove"/>
</modify-argument>
</modify-function>
<modify-function signature="takeRow(int)">
<modify-argument index="return">
- <parent index="this" action="remove" />
+ <parent index="this" action="remove"/>
</modify-argument>
</modify-function>
<modify-function signature="findItems(const QString&amp;,QFlags&lt;Qt::MatchFlag&gt;,int)const">
<modify-argument index="return">
- <parent index="this" action="add" />
+ <parent index="this" action="add"/>
</modify-argument>
</modify-function>
<modify-function signature="insertColumn(int,const QList&lt;QStandardItem*&gt;&amp;)">
<modify-argument index="2">
- <parent index="this" action="add" />
+ <parent index="this" action="add"/>
</modify-argument>
</modify-function>
<modify-function signature="insertRow(int,const QList&lt;QStandardItem*&gt;&amp;)">
<modify-argument index="2">
- <parent index="this" action="add" />
+ <parent index="this" action="add"/>
</modify-argument>
</modify-function>
<modify-function signature="appendColumn(const QList&lt;QStandardItem*&gt;&amp;)">
<modify-argument index="1">